一台已安装Linux系统的主机作为Cobbler Server, 本文中Cobbler Server使用的系统是CentOS 7;
若干台待安装CentOS7的裸主机作为Cobbler Client;
Cobbler Server与所有CobblerClient处于同一局域网中;
所有主机支持PXE启动安装方式。
== 配置本机静态IP
# vim /etc/sysconfig/network-scripts/ifcfg-eno16777736
修改:
BOOTPROTO="dhcp" ----> BOOTPROTO="static"
增加:
IPADDR=192.168.17.151
NETMASK=255.255.255.0
GATEWAY=192.168.17.2
DNS1=192.168.17.2
== 重启网络服务
# service network restart
== 安装 EPEL源
# yum install epel-release -y
== 安装 cobbler
# yum install cobbler –y
== 安装 dhcp
# yum install dhcp –y
== 配置 dhcp
# vim /etc/dhcp/dhcpd.conf
增加:
subnet 192.168.17.0 netmask255.255.255.0 {
range 192.168.17.101 192.168.17.149;
option routers 192.168.17.2;
option broadcast-address 192.168.17.255;
default-lease-time 3600;
max-lease-time 7200;
next-server 192.168.17.151;
filename "pxelinux.0";
}
== 启动 dhcp服务
# service dhcpd start
# systemctl enable dhcpd
== 关闭并配置开机自动关闭系统防火墙
# systemctl stop firewalld
# systemctl disable firewalld
== 安装tftp
# yum install -y tftp*
== 安装 xinetd守护进程, 因为 tftp 依赖于 xinetd
# yum install -y xinetd
== 修改 tftp配置文件
# vim /etc/xinetd.d/tftp
修改:
disable = yes ----> disable = no
== 启动并配置开机自动启动 xinetd与 tftp
# systemctl start xinetd
# systemctl enable xinetd
# systemctl start tftp
== 启动 httpd服务
# service httpd start
# systemctl enable httpd
== 启动 cobbler服务
# service cobblerd start
# systemctl enable cobblerd
== 关闭 SELinux
# setenforce 0
# vim /etc/selinux/config
修改:
SELINUX= enforcing ----> SELINUX=disable
== 设置server参数
# vim /etc/cobbler/settings
修改:
server: 127.0.0.1 ----> server: 192.168.17.151
next_server: 127.0.0.1 ----> next_server: 192.168.17.151
== 安装syslinux
# yum install syslinux -y
== 安装ksvalidator
# yum install pykickstart -y
== 重启 cobbler服务
# cobbler sync
# service cobblerd restart
== 挂载光盘镜像
# mkdir /mnt/flash
# mnt /dev/cdrom /mnt/flash
== 添加一个 distro (需要等待一段时间)
# cobbler import--name=CentOS-7-x86_64 --path=/mnt/flash/
== 检测是否添加成功
# cobbler distro list
CentOS-7-x86_64
== 配置ks文件
# cp /root/anaconda-ks.cfg /var/lib/cobbler/kickstarts/ks.cfg
# vim /var/lib/cobbler/kickstarts/ks.cfg
主要修改地方:
①安装源
②文本安装方式
③主机名
④自动重启
⑤预装软件
⑥关闭防火墙与SELinux
* ks.cfg文件配置可以参考另一个附件“anaconda-ks.cfg”
== 添加ks文件至cobbler的设置中
# cobbler profile add--name=CentOS-7-base --distro=CentOS-7-x86_64--kickstart=/var/lib/cobbler/kickstarts/ks.cfg
== 重启cobbler
# cobbler sync
# service dhcpd status
# service tftp status
# service httpd status
以上三者结果都应该为active(running)
# service firewalld status
结果都应该为inactive(dead)
检查待安装系统盘是否以及挂载到指定目录下(/var/cobbler/ks_mirror/)
如果以上状态均正常,可以开始启动CobblerClient,并将启动方式设置为PXE启动。
1、 Cobbler Server每次启动后IP地址都不相同?
答:应该讲Cobbler Server设置为静态IP,否则每次重启都需要根据新IP修改配置文件。
2、 Cobbler Server重启后无法使用?
答:Cobbler Server每次重启后需要重新打开tftp服务。
3、 Cobbler Server重启后是否需要重新挂载光盘文件至指定目录?
答:不需要,这也是它比传统PXE安装便捷的一个地方。