目录
安装Cobbler2.4.1
通过apt-get安装Cobbler和Cobbler-web
Cobbler为主程序,Cobbler-web 是Cobbler的web接口
1
sudo apt-get install cobbler cobbler-web
1
sudo apt-get install debmirror createrepo
bash
– 安装loaders程序,否则会出现Q&A中的第一条报错
1
sudo cobbler get-loaders
修改debmirror.conf配置,主要防止debmirror package is not installed, it will be required to manage debian deployments and repositories
这类问题的发生
1
2
3
4
cp /usr/share/doc/debmirror/examples/debmirror.conf /etc/
#注释掉@dists和@arches两行
sudo sed -i "s/@dists/#@dists/g" /etc/debmirror.conf
sudo sed -i "s/@arches/#@arches/g" /etc/debmirror.conf
1
2
sudo htdigest /etc/cobbler/users.digest "Cobbler" cobbler
sudo cobbler sync
安装dnsmasq和tftpd-hpa
dnsmasq是一个轻量级的TFTP、DHCP、PXE和DNS服务器。其中PXE、DHCP和TFTP服务是PXE网卡网络启动安装程序所必须的。我们在这里使用它提供DHCP和DNS服务
tfpd-hpa是另外一个TFTP服务器。我们用tftpd-hpa来提供TFTP服务
1
sudo apt-get install dnsmasq tftpd-hpa xinetd -y
修改Ubuntu启动项
主要原因是我使用的笔记本,在碰到一些公司没有类似cobbler需要光盘安装,U盘安装的系统时,才启用的服务,平时不会开启,以及避免DHCP冲突
1
2
3
sudo apt-get install sysv-rc-conf -y
sudo sysv-rc-conf
#将cobbler,dnsmasq,tftpd-hpa给取消掉,按Q退出
修改cobbler配置
编辑配置文件/etc/cobbler/settings,将dhcp,dns,tftpd,pxe进行接管
1
2
3
4
5
6
7
8
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>
编辑配置文件/etc/cobbler/modules.conf,配置cobbler所接管的服务类型
1
2
3
4
5
6
7
8
9
10
11
12
[ authentication]
module = authn_configfile
[ authorization]
module = authz_allowall
[ dns]
#module = manage_bind
module = manage_dnsmasq
[ dhcp]
#module = manage_isc
module = manage_dnsmasq
[ tftpd]
module = manage_in_tftpd
编辑配置文件/etc/cobbler/dnsmasq.template,来通过cobbler的摸版配置对相应接管的服务进行文件配置
这里需要注意的是如果你在已有DHCP环境下配置后重启服务前,请断开网络,否则会造成DHCP冲突
1
2
3
4
5
6
7
8
9
10
read -ethers
addn-hosts = /var/lib/cobbler/cobbler_hosts
dhcp-range= 192.168.250.5,192.168.250.200
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
编辑配置文件/etc/cobbler/tftpd.template
该配置保持原样,如下
1
2
3
4
5
6
7
8
9
10
11
12
13
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = $user
server = $binary
server_args = -B 1380 -v -s $args
per_source = 11
cps = 100 2
flags = IPv4
}
执行sudo cobbler sync 同步配置文件至/etc/xinetd.d/tftp,注意如果是在办公网络环境记得关闭dnsmasq,因为同步时会自动启动dnsmasq
检查服务是否启动
1
for i in xinetd dnsmasq apache python;do for b in 69 53 67 69 25151; do sudo netstat -lnutp |awk '{print $4,$6,$7}' |grep $b |grep $i ;done ;done
服务说明
80 Aapche服务
53 dnsmasq程序的dns服务
67 dnsmasq程序的DHCP服务
69 tftp-hpa程序的tftp服务
25151 Apache2 的cobbler-web站点支持
测试PXE
寻找一台机器,设置成网卡启动,用网线对连进行测试,如果进入了Cobbler的PXE界面说明前面部署的基本没啥问题。
制作Centos6.5源
挂载下载好的iso镜像,并挂载在mnt下,通过cobbler命令进行导入
需要注意的是,Centos的导入需要使用到createrepo,需要提前安装好
1
2
3
sudo mount /iso/CentOS-6.5-x86_64-bin-DVD1.iso /mnt/
sudo apt-get install createrepo
sudo cobbler import --path= /mnt/ --name= CentOS-6.5 --arch= x86_64
制作kickstart文件
Cobbler中默认的kickstart文件目录为,/var/lib/cobbler/kickstarts/,默认的Ks文件为 /var/lib/cobbler/kickstarts/sample.ks
可以通过摸版新建一个ks文件,这里我只是列出注意事项
langsupport
已经被取消,取而代之的是在%packages下添加支持的语言包
mouse
已经被取消,使用会导致终止安装
--resolvedeps
已经被取消了.目前依赖关系可以自动地被解析
--ignoredeps
已经被取消了.目前依赖关系可以自动地被解析
使用cobbler对机器网络安装Centos6.5
启动cobbler,tftpd-hpa,dnsmasq服务
1
2
3
sudo service cobbler restart #重启cobbler
sudo /etc/init.d/xinetd restart #重启xinetd下的tftp
sudo /etc/init.d/dnsmasq #重启dnsmasq 启用DHCP服务
寻找另一台机器在BIOS中设置网络启动
出现如下画面表示成功
Q&A
通过命令sudo cobbler check
发现以下报错
1
2
The following are potential configuration items that you may want to fix:
1 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
表示需要执行sudo cobbler get-loaders 命令来安装在loaders程序
出现ERROR | [Errno 98] Address already in use报错
1
原因是/etc/init.d/cobbler和service cobbler restart所启动的cobbler方式不同,但内容相同,会造成IP冲突。