Ubuntu Server 12.04下cobbler + dnsmasq +tftpd-hpa的安装配置(二)

简介:

二、安装和配置dnsmasq和tftpd-hpa

1.安装dnsmasq和tftpd-hpa

1.1 安装dnsmasq

dnsmasq是一个轻量级的tFTP、DHCP、PXE和DNS服务器。其中PXE、DHCP和tFTP服务是PXE网卡网络启动安装程序所必须的。我们在这里使用它提供DHCP和DNS服务。

# apt-get install dnsmasq

1.2 安装tftpd-hpa

tfpd-hpa是另外一个tFTP服务器。我们用tftpd-hpa来提供tFTP服务。

# apt-get install tftpd-hpa


2 配置cobbler 接管dnsmasq和tftpd-hpa

cobbler本身具备管理dnsmasq和tftpd-hpa的功能。所以我们只需要配置cobbler就可以了。

2.1 配置cobbler接管DHCP、DNS和tFTP服务

修改配置文件 /etc/cobbler/settings

需修改和修改后的值如下:

manage_dhcp: 1

manage_dns: 1

manage_tftpd: 1

restart_dhcp: 1

restart_dns: 1

pxe_just_once: 1

next_server: <server's IP address>

server: <server's IP address>

修改后:

# egrep -v '^#|^$' /etc/cobbler/settings 
--- 
allow_duplicate_hostnames: 0 
allow_duplicate_ips: 0 
allow_duplicate_macs: 0 
anamon_enabled: 0 
build_reporting_enabled: 0 
build_reporting_sender: "" 
build_reporting_email: [ 'root@localhost' ] 
build_reporting_smtp_server: "localhost" 
build_reporting_subject: "" 
cheetah_import_whitelist: 
   - "random" 
   - "re" 
   - "time" 
   - "orchestra" 
createrepo_flags: "-c cache -s sha" 
default_kickstart: /var/lib/cobbler/kickstarts/ubuntu-server.preseed 
default_name_servers: [] 
default_ownership: 
    - "admin" 
default_password_crypted: "" 
default_virt_bridge: virbr0 
default_virt_file_size: 5 
default_virt_ram: 512 
default_virt_type: qemu 
enable_menu: 1 
func_auto_setup: 0 
func_master: overlord.example.org 
http_port: 80 
kernel_options: 
    ksdevice: bootif 
    lang: ' ' 
    text: ~ 
    locale: en_US 
    priority: critical 
kernel_options_s390x: 
    RUNKS: 1 
    ramdisk_size: 40000 
    root: /dev/ram0 
    ro: ~ 
    ip: off 
    vnc: ~ 
ldap_server: "ldap.example.com" 
ldap_base_dn: "DC=example,DC=com" 
ldap_port: 389 
ldap_tls: 1 
ldap_anonymous_bind: 1 
ldap_search_bind_dn: '' 
ldap_search_passwd: '' 
ldap_search_prefix: 'uid=' 
mgmt_classes: [] 
mgmt_parameters: 
   from_cobbler: 1 
puppet_auto_setup: 0 
sign_puppet_certs_automatically: 0 
puppetca_path: "/usr/sbin/puppetca" 
remove_old_puppet_certs_automatically: 0 
manage_dhcp: 1 
manage_dns: 1 
manage_tftpd: 1 
manage_rsync: 0 
manage_forward_zones: [] 
manage_reverse_zones: [] 
next_server: 192.168.88.253 
power_management_default_type: 'ether_wake' 
power_template_dir: "/etc/cobbler/power" 
pxe_just_once: 1 
pxe_template_dir: "/etc/cobbler/pxe" 
consoles: "/var/consoles" 
redhat_management_type: "off" 
redhat_management_server: "xmlrpc.rhn.redhat.com" 
redhat_management_key: "" 
redhat_management_permissive: 0 
register_new_installs: 0 
reposync_flags: "-l -m -d" 
restart_dns: 1 
restart_dhcp: 1 
run_install_triggers: 1 
scm_track_enabled: 0 
scm_track_mode: "git" 
server: 192.168.88.253 
snippetsdir: /var/lib/cobbler/snippets 
template_remote_kickstarts: 0 
use_gpxe: 0 
virt_auto_boot: 1 
webdir: /var/www/cobbler 
xmlrpc_port: 25151 
yum_post_install_mirror: 1 
yum_distro_priority: 1


2.2 指定接管的DHCP、DNS和tFTP服务器类型

修改配置文件/etc/cobbler/modules.conf

修改后

# egrep -v '^#|^[ \t]*$' /etc/cobbler/modules.conf

[authentication]

module = authn_configfile

[authorization]

module = authz_allowall

[dns]

module = manage_dnsmasq # uses dnsmasq

[dhcp]

module = manage_dnsmasq # uses dnsmasq

[tftpd]

module = manage_in_tftpd  # defaut, uses the system's tftp server, in this example, use tftpd-hpa

3 配置DHCP、DNS、tFTP服务

由于我们配置了cobbler接管DHCP、DNS和tFTP服务,所以我们不需要单独修改dnsmasq和tftpd-hpa的配置文件,只需要修改Cobbler中DHCP、DNS和tFTP相应的配置模板即可。

Cobbler会自动帮助我们做同步工作。

3.1 配置DHCP和DNS服务

3.1.1 修改配置

修改/etc/cobbler/dnsmasq.template

修改后:

# Cobbler generated configuration file for dnsmasq

# $date

#

# resolve.conf .. ?

#no-poll

#enable-dbus

read-ethers

addn-hosts = /var/lib/cobbler/cobbler_hosts

#domain=

dhcp-range=192.168.88.100,192.168.88.254

dhcp-option=3,$next_server

dhcp-lease-max=1000

dhcp-authoritative

dhcp-boot=pxelinux.0

dhcp-boot=net:normalarch,pxelinux.0

dhcp-boot=net:ia64,$elilo

$insert_cobbler_system_definitions

3.1.2 同步配置

同步配置到dnsmasq

# cobbler sync

3.2 配置tFTP服务

3.2.1 修改配置

修改配置文件/etc/cobbler/tftpd.template

修改后:

# default: off

# description: The tftp server serves files using the trivial file transfer \

#       protocol.  The tftp protocol is often used to boot diskless \

#       workstations, download configuration files to network-aware printers, \

#       and to start the installation process for some operating systems.

service tftp

{

disable                 = no

        socket_type             = dgram

        protocol                = udp

        wait                    = yes

        user                    = $user

        server                  = $binary

        server_args             = -B 1380 $args

        per_source              = 11

        cps                     = 100 2

        flags                   = IPv4

}

3.2.2 同步配置

同步配置到tftp-hpa

# cobbler sync

4. 检查前边的操作

4.1 检查端口开放

# netstat -tunlp 
Active Internet connections (only servers) 
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name 
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      7548/apache2  
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      8875/dnsmasq  
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      2217/sshd       
tcp        0      0 127.0.0.1:3350          0.0.0.0:*               LISTEN      1083/xrdp-sesman 
tcp        0      0 0.0.0.0:3389            0.0.0.0:*               LISTEN      1078/xrdp       
tcp        0      0 127.0.0.1:25151         0.0.0.0:*               LISTEN      8387/python 
tcp6       0      0 :::53                   :::*                    LISTEN      8875/dnsmasq    
tcp6       0      0 :::22                   :::*                    LISTEN      2217/sshd       
udp        0      0 0.0.0.0:53              0.0.0.0:*                           8875/dnsmasq    
udp        0      0 0.0.0.0:67              0.0.0.0:*                           8875/dnsmasq    
udp        0      0 0.0.0.0:69              0.0.0.0:*                           7274/in.tftpd  
udp        0      0 0.0.0.0:177             0.0.0.0:*                           1213/lightdm    
udp6       0      0 :::53                   :::*                                8875/dnsmasq    
udp6       0      0 :::177                  :::*                                1213/lightdm

服务说明

80 Aapche服务

53 dnsmasqt程序的dns服务

67 dnsmasq程序的DHCP服务

69  tftp-hpa程序的tftp服务

25151 Apache2 的cobbler-web站点支持

4.2 检查PXE网络启动

在与cobbler服务器同一个网络找一台机器,BIOS调整从网络启动:

SUSE Linux Enterprise 11 64-bit-2013-11-02-01-31-28

重新启动机器,正常情况下应该会进入Cobbler的网络启动菜单:

SUSE Linux Enterprise 11 64-bit-2013-11-02-21-37-04

如果不能进入这个菜单,首先需要检查前边的步骤是否正确。还可以检查cobbler程序的日志。


     本文转自xiaoyuwang 51CTO博客,原文链接:http://blog.51cto.com/wangxiaoyu/1322194,如需转载请自行联系原作者



相关文章
|
3月前
|
人工智能 Ubuntu 前端开发
Dify部署全栈指南:AI从Ubuntu配置到HTTPS自动化的10倍秘籍
本文档介绍如何部署Dify后端服务及前端界面,涵盖系统环境要求、依赖安装、代码拉取、环境变量配置、服务启动、数据库管理及常见问题解决方案,适用于开发与生产环境部署。
855 1
|
4月前
|
Ubuntu Linux 网络安全
Linux服务器之Ubuntu的安装与配置
Ubuntu Desktop是目前最成功、最流行的图形界面的Linux发行版;而Ubuntu Server也在服务器端市场占据了较大的份额。今天为大家详细介绍了Ubuntu Server的安装与配置,希望对你能有所帮助。关于VMware、VirtualBox等虚拟化软件的使用,朱哥还会在后续的文章中为大家详细介绍,敬请关注!
|
5月前
|
Ubuntu 安全 Docker
Ubuntu Server上安装配置Docker的详细步骤
如果一切设置正确,这将下载一个测试镜像,并在容器中运行它,打印一条问候消息。
744 76
|
3月前
|
Ubuntu 安全 应用服务中间件
详细指南:配置Nginx服务器在Ubuntu平台上
以上步骤涵盖了基本流程:从软件包管理器获取 Ngnix, 设置系统服务, 调整UFW规则, 创建并激活服务器块(也称作虚拟主机), 并进行了初步优化与加固措施。这些操作都是建立在命令行界面上,并假设用户具有必要权限(通常是root用户)来执行这些命令。每个操作都有其特定原因:例如,设置开机启动确保了即使重启后也能自动运行 Ngnix;而编辑server block则定义了如何处理进入特定域名请求等等。
308 18
|
3月前
|
Ubuntu 安全 应用服务中间件
详细指南:配置Nginx服务器在Ubuntu平台上
以上步骤涵盖了基本流程:从软件包管理器获取 Ngnix, 设置系统服务, 调整UFW规则, 创建并激活服务器块(也称作虚拟主机), 并进行了初步优化与加固措施。这些操作都是建立在命令行界面上,并假设用户具有必要权限(通常是root用户)来执行这些命令。每个操作都有其特定原因:例如,设置开机启动确保了即使重启后也能自动运行 Ngnix;而编辑server block则定义了如何处理进入特定域名请求等等。
389 17
|
3月前
|
Ubuntu 安全 关系型数据库
安装与配置MySQL 8 on Ubuntu,包括权限授予、数据库备份及远程连接指南
以上步骤提供了在Ubuntu上从头开始设置、配置、授权、备份及恢复一个基础但完整的MySQL环境所需知识点。
473 7
|
4月前
|
缓存 Ubuntu Docker
Ubuntu环境下删除Docker镜像与容器、配置静态IP地址教程。
如果遇见问题或者想回滚改动, 可以重启系统.
331 16
|
3月前
|
消息中间件 人工智能 运维
Ubuntu环境下的 RabbitMQ 安装与配置详细教程
本文聚焦在Ubuntu下RabbitMQ安装与配置教程,旨在帮助读者快速构建稳定可用的消息队列服务。
|
4月前
|
缓存 监控 Ubuntu
在Ubuntu 16.04上配置GitLab Runner以激活GitLab CI/CD流程
完成以上步骤后,每当代码被推送到远端仓库中相对应分支上时,GitLb CI / CD 流水线就会自动触发,并由之前注册好了 GitLb runner 的机器去完成定义好了 ` .gitlabcicd.yml ` 文件里面定义好各种任务(如编译测试部署等).
240 13
|
4月前
|
XML Ubuntu Java
如何在Ubuntu系统上安装和配置JMeter和Ant进行性能测试
进入包含 build.xml 的目录并执行:
255 13