安装epel
[root@localhost ~]# yum -y install epel-release
安装缓存
[root@localhost ~]# yum makecache
安装需要的软件
[root@localhost ~]# yum -y install cobbler cobbler-web pykickstart debmirror
开启服务
systemctl restart httpd
systemctl enable httpd
systemctl start cobblerd
systemctl enable cobblerd
查看监听端口
[root@localhost ~]# netstat -antp |grep 25151 tcp 0 0 127.0.0.1:25151 0.0.0.0:* LISTEN 8079/python2
编辑配置文件,修改server和nextserver,指定服务器
[root@localhost ~]# vim /etc/cobbler/settings
server: 192.168.0.100 next_server: 192.168.0.100
获取更新配置文件
[root@localhost ~]# cobbler get-loaders
重启rsync
[root@localhost ~]# systemctl restart rsyncd
[root@localhost ~]# systemctl enable rsyncd
编辑配置文件,禁用32位和不标准化安装
[root@localhost ~]# vi /etc/debmirror.conf
#@dists="sid";
@sections="main,main/debian-installer,contrib,non-free";
#@arches="i386"
生成操作系统默认密码
[root@localhost ~]# openssl passwd -1 -salt $(openssl rand -hex 4)
$1$f53656d0$svkqiPvhzIsT0lD3jIY5o.
打开配置文件,修改密码
root@localhost ~]# vi /etc/cobbler/settings
default_password_crypted: "$1$f53656d0$svkqiPvhzIsT0lD3jIY5o."
安装cman fence
[root@localhost ~]# yum -y install cman fence-agents
编辑tftp
vi /etc/xinetd.d/tftp service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /var/lib/tftpboot disable = no per_source = 11 cps = 100 2 flags = IPv4 }
[root@localhost ~]# yum install -y syslinux
[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
#pxelinux.0文件名要和dhcp配置文件内的一致
[root@localhost pxeboot]# cp /mnt/cdrom/p_w_picpaths/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/
#copy光盘目录中的vmlinuz和initrd.img, 这两个文件相当于系统启动时/boot目录下的启动文件, 但这个用来引导anacoda而不是根
[root@localhost pxeboot]# cp /mnt/cdrom/isolinux/{boot.msg,vesamenu.c32,splash.png} /var/lib/tftpboot/
#copy pxe引导所需要的配置文件, splash.png:背景图. boot.msg启动标语, vesamenu.c32: 显示同行界面用的程序.
[root@localhost pxeboot]# mkdir /var/lib/tftpboot/pxelinux.cfg
[root@localhost pxeboot]# cp /mnt/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
#pxe启动时显示配置文件信息, 和光盘启动类似.
设置xinetd,tftp开机自启
[root@localhost ~]# systemctl start xinetd [root@localhost ~]# systemctl enable xinetd
[root@localhost ~]# systemctl start tftp
[root@localhost ~]# systemctl enable tftp
同步配置文件
[root@localhost ~]# cobbler sync
检查错误
[root@localhost ~]# systemctl restart cobblerd
[root@localhost ~]# cobbler check
安装配置dhcp
[root@localhost ~]# yum -y install dhcp
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.100;
option domain-name-servers 192.168.0.100;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.0.100 192.168.0.200;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.0.100;
filename="pxelinux.0";
}
~
导入
[root@localhost ~]# cobbler import --name="c7" --path=/mnt/cdrom/
浏览器查看
http://192.168.0.100/cobbler/
删除自带配置文件
[root@localhost ~]# cobbler profile remove --name=c7-x86_64
生成ks文件,保存到以下位置
[root@localhost ~]# ll /var/lib/cobbler/kickstarts
匹配镜像和ks文件
[root@localhost ~]# cobbler distro list c7-x86_64 [root@localhost ~]# cobbler profile add --name=centos7-basic --distro=c7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/ks.cfg
ks.cfg需要更改url
url url=http://