[root@scholar ~]# chkconfig tftp on
[root@scholar ~]# chkconfig rsync on
[root@scholar ~]# service xinetd start
配置cobbler
#检查需要修改的配置,需启动httpd服务及cobblerd
[root@scholar ~]# service cobblerd start
[root@scholar ~]# service httpd start
[root@scholar ~]# cobbler check
The following are potential configuration items that you may want to fix:
1 : The 'server' field in /etc/cobbler/settings must be set to something other than loc
alhost, or kickstarting features will not work. This should be a resolvable hostname o
r 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 th
e PXE network.
3 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'c
obbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netboot
ing, 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 wa
nt to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and ya
boot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
4 : debmirror package is not installed, it will be required to manage debian deployment
s and repositories
5 : ksvalidator was not found, install pykickstart
6 : The default password used by the sample templates for newly installed machines (def
ault_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 g
enerate new one
7 : fencing tools were not found, and are required to use the (optional) power manageme
nt features. install cman or fence-agents to use them
Restart cobblerd and then run 'cobbler sync' to apply changes.
#解决方法
1:# vim /etc/cobbler/settings
server: 172.16.10.125
2:# vim /etc/cobbler/settings
next_server: 172.16.10.125
3:# cobbler get-loaders #需要可访问互联网,尝试此法返回404错误,只好手动复制文件
# yum install syslinux -y
# cp -r /usr/share/syslinux/\* /var/lib/cobbler/loaders/
4:忽略即可
5:# yum install pykickstart -y
6:]# openssl passwd -1 -salt `openssl rand -hex 4`
Password:
$1$ebcbf370$s8C9mNday5b.lE5nh4.7N1
# vim /etc/cobbler/settings
default\_password\_crypted: "$1$ebcbf370$s8C9mNday5b.lE5nh4.7N1"
7:安装cman或fence-agents #可忽略
[root@scholar ~]# service cobblerd restart
添加distro(distribution)
#挂载光盘镜像,每换一个系统镜像都需重新挂载
[root@scholar ~]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
1
导入CentOS6镜像文件
导入CentOS7镜像文件,请确保已重新挂载镜像
验证是否导入成功
添加profile
#kickstart文件可按实际需要制作,这里直接修改/root/anaconda-ks.cfg,添加关键配置项如下:
url --url=http://172.16.10.125/cobbler/ks_mirror/CentOS-7.0-x86_64 #指定repo位置
#注:CentOS6与CentOS7文件系统不同,千万不能用相同kickstart文件
同步数据
[root@scholar ~]# cobbler sync
#CentOS7与CentOS6安装过程略有区别,CentOS7在数据同步完成后需要再次指定安装源
[root@scholar ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
#将此项加入CentOS7的append行内
inst.repo=http://172.16.10.125/cobbler/ks_mirror/CentOS-7.0-x86_64
部署测试
设置为网卡启动
保存重启后进入引导界面,我们先安装CentOS6
引导成功,开始安装
安装CentOS7
引导成功,开始安装
至此,基于Cobbler实现多版本系统批量部署已成功实现,其实以上配置过程可以使用web界面配置,这样就可以不再刻意的去记繁琐的命令,下面我们就来简单看一下