本篇博文是使用cobbler的小工具来实现我们的系统的自动安装,说这个工具小吧,其实它其中包含了很多的工具,当然了我们需要使用epel源来实现我们的安装,epel的源的修改地址在/etc/yum.repos.d/下,我们可以把自己想配置的epel源或者本地仓库的修改文件放在这下面,通过yum clean all,yum makecache,yum repolist,来进行一系列操作。

    当我们通过epel源安装之后,我们可以打开我们的这几个工具(dhcpd cobblerd httpd tftp)的开机启动,部分工具立即启动,因为dhcp需要配置,所以在配置好之前还不能使其启动,我使用的是centos7的系统,所以

systemctl enable dhcpd cobblerd httpd tftp //开机启动
systemctl start cobblerd httpd tftp        //立即启动

    检查cobbler换将,cobbler check

1 : The ‘server’ field in /etc/cobbler/settings must be set to something other than
localhost, or kickstarting features will not work. This should be a resolvable hostname or
IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the ‘next_server’ field in /etc/cobbler/settings must be set
to something other than 127.0.0.1, and should match the IP of the boot server on the
PXE network.
3 : 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.
4 : change ‘disable’ to ‘no’ in /etc/xinetd.d/rsync
5 : comment ‘dists’ on /etc/debmirror.conf for proper debian support
6 : comment ‘arches’ on /etc/debmirror.conf for proper debian support
7 : The default password used by the sample templates for newly installed machines
(default_password_crypted in /etc/cobbler/settings) is still set to ‘cobbler’ and should be
changed, try: “openssl passwd -1 -salt ‘random-phrase-here’ ‘your-password-here’” to
generate new one
8 : fencing tools were not found, and are required to use the (optional) power
management features. install cman or fence-agents to use them

    解决方法:在文件/etc/cobbler/settings下修改这些内容,其中的密码我生成的是123

1、2解决方法:
vim /etc/cobbler/settings
default_password_crypted: "$1$9/k4QnLN$RpMDw8oILNAfkpOA2Qkth."  #openssl passwd -1生成口令
next_server: 192.168.91.127
server: 192.168.91.127
manage_dhcp: 1
保存退出
3.解决方法:
联网:
cobbler get-loaders #联网情况下会自动获取这两个文件到指定目录
不联网:
cp /usr/share/syslinux/{pxelinux.0,menu.c32} /var/lib/tftpboot/
4.第四个的解决就很容易了,很明显是到/etc/xinetd.d/rsync中的disable改为no
systemctl restart cobblerd

    修改dhcp的配置文件

vim /etc/cobbler/dhcp.template 
subnet 192.168.91.0 netmask 255.255.255.0 {
range dynamic-bootp        192.168.91.100 192.168.91.254;
cobbler sync
systemctl start dhcpd #启动dhcp

    管理distro

cobbler import --path=/misc/cd/ --name=centos7.3
cobbler distro list

    设置cobbler的各个属性

cp /root/ks7.cfg  /var/lib/cobbler/kickstarts/
cobbler profile add --name=centos7.3-x86_64-desktop  --distro=centos7.3-x86_64 --kickstar
t=/var/lib/cobbler/kickstarts/ks7.cfg
cobbler profile list
cobbler profile remove --name=centos7.3-x86_64

    然后我们新建虚拟机,并在其网络上选择和试验机一个网段的仅主机模式,然后开机选择network boot from Inter E1000。