标签:cobbler 自动化 自动化安装linux系统 kickstart文件 安装树
基于cobbler实现自动化安装系统
环境介绍 centos6.8
为centos6.8提供两块网卡 (非必要)
一块为桥接,方便xshell连接和测试
一块为vmnet3:用来搭建dhcp,tftp,和为客户端提供cobbler服务
前提,(确保安装TFTP,dhcp,rsync)
# yum install httpd cobbler cobbler-web pykickstart debmirror
1.启动对应的服务
# service httpd start # service cobblerd start
2.检测cobbler的环境
# cobbler check ...输出省略...
//省略输出,根据提示做出相应的修改即可
注意:每次修改完成一步都多步后都需要重新启动后再做检测
//修改中涉及修改的IP我们都该为192.168.100.100 不使用桥接网卡的地址
有一个错误提示需要说明下
(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.
对于这个错误有两种解决方法
# cobbler get-loaders --> 前提需要能够连接到互联网
# yum -y install syslinux --> 如果不能连接到互联网(前提yum源要配置好)
有些不重要的问题可以忽略
3.同步数据
# cobbler sync
4.配置dhcp
# vim /etc/dhcp/dhcpd.conf subnet 192.168.100.0 netmask 255.255.255.0 { range 192.168.100.1 192.168.100.10; option routers 192.168.100.100; next-server 192.168.100.100; filename "pxelinux.0"; } # service dhcpd restart
5.启动tftp
# chkconfig xinetd on # chkconfig tftp on # service xinetd start
6.因为我们的内核和initrd文件在本地所以采用import导入安装树(如果不在本地要用distro导入)
//导入根文件系统 # cobbler import --name="centos6.8-x86.64" --path=/misc/cd --> 光盘挂载的位置
导入其他的发行版方式一样(依葫芦画瓢即可)
//该步骤需要占用和光盘大小一样的磁盘空间需要确保磁盘空间足够
# cobbler distro list centos6.8.64-x86_64 --> 导入成功
# ls /etc/httpd/conf.d/cobbler* /etc/httpd/conf.d/cobbler.conf /etc/httpd/conf.d/cobbler_web.conf # ls /var/www/cobbler* -d /var/www/cobbler /var/www/cobbler_webui_content //生成的文件
7.定义profile(导入ks.cfg)
# cp /root/ks.cfg /var/lib/cobbler/kickstarts/ # cobbler profile add --name="centos6.8-x86.64_first" > --distro="centos6.8.64-x86_64" --kickstart=/var/lib/cobbler/kickstarts/ks.cfg # cobbler profile list
8.数据同步
# cobbler sync
9.测试(另一个虚拟机的网卡要为vmnet3)
前提:修改为网络启动
10.添加另一个安装树(使用不同的ks.cfg文件即可)
# cobbler profile add --name="centos6.8-x86.64_second" > --distro="centos6.8.64-x86_64" --kickstart=/var/lib/cobbler/kickstarts/ks2.cfg # cobbler profile list centos6.8-x86.64_first centos6.8-x86.64_second --> 第二个安装树导入成功 # vim /var/lib/tftpboot/pxelinux.cfg/default
本文出自 “似水流年” 博客,请务必保留此出处http://sixijie123.blog.51cto.com/11880770/1879221
标签:cobbler 自动化 自动化安装linux系统 kickstart文件 安装树
原文地址:http://sixijie123.blog.51cto.com/11880770/1879221