上次搞了个PXE+kickstart批量安装系统。听说cobbler更简单点,于是今天试了一下。
实验机器:centos6.5-x86_64
IP:192.168.213.81
网管:192.168.213.2
1.关闭防火墙
setenforce 0
service iptables stop
chkconfig iptables off
2.安装cobbler包
rpm -Uvh http://mirrors.hustunique.com/ep ... ease-6-8.noarch.rpm
yum install -y cobbler cobbler-web dhcp httpd xinetd tftp pykickstart debmirror cman
//上述所需安装包一次性装完,免得后面报错再安装
vim /etc/cobbler/settings
找到如下配置选项并修改:
next_server: 192.168.213.81 //改为主机IP
server: 192.168.213.81
manage_dhcp: 1
manage_rsync: 1
openssl passwd -1 -salt 'cobbler' '123456' //生成密钥密码
$1$cobber$yV9XfOuaaiVDvImopK7o.1 //复制然后粘贴到以下文件下替换
vim /etc/cobbler/settings
找到以下选项并将上面生成的密钥密码进行替换
default_password_crypted:"$1$cobber$yV9XfOuaaiVDvImopK7o.1"
开启各个服务
/etc/init.d/cobblerd start
/etc/init.d/httpd start
/etc/init/d/xinetd start
/etc/init.d/dhcpd start
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 : since iptables may be running, ensure 69, 80, and 25151 are unblocked
6 : debmirror package is not installed, it will be required to manage debian deployments and repositories
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
Restart cobblerd and then run 'cobbler sync' to apply changes.
//继续修改部分选项出现的错误提示,记得修改完要重启cobbler服务,然后再运行check!
vim /etc/xinetd.d/tftp
将 disabled 的值由 yes 改为==>no
vim /etc/xinetd.d/rsync
同上将 disabled 的值由 yes 改为==>no
vim /etc/cobbler/dhcp.template //修改dhcp设置
找到如下段落:
ddns-update-style interim;
allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
subnet 10.0.0.0 netmask 255.255.255.0 {
option routers 192.168.213.81; //本机IP
option domain-name-servers 192.168.213.81; //应该也可设为网关
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.213.50 192.168.213.100; //dhcp分配的地址段,自行设置
<span style="color: #ff0000;">filename "/pxelinux.0" </span> //添加此行信息
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
} //其他保持默认,无需改动
vim /etc/debmirror.conf //编辑此文件,注释掉以下两处配置
@dists="sid";
@arches="i386";
cobbler get-loaders //下载loaders
vi /etc/cobbler/modules.conf
module = authn_configfile //修改认证方式为密码文件类型
htdigest /etc/cobbler/users.digest "Cobbler"cobbler //添加cobbler用户,提示输入2遍密码确认
/etc/init.d/cobblerd restart
cobbler check
No configuration problems found. All systems go. //此提示表示配置成功
cobbler sync
TASK COMPLETE //最后一行输出为此则表示配置无错误,进行后面的登录配置操作
/etc/init.d/httpd restart
/etc/init.d/cobblerd restart
3.web界面配置及导入
3.1在浏览器中输入: http://192.168.213.81/cobbler_web
出现界面,输入前面设置的用户名及密码,我这边是cobbler,123456
3.2添加系统镜像源
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
cobbler import --path=/mnt/cdrom --name=centos6.5 //导入文件
最后会提示:
TASK COMPLETE
3.3导入配置,点击run后,等待片刻,点击左侧的profiles
cobbler批量安装centos6.5
3.4修改配置文件profiles
cobbler批量安装centos6.5
修改完后,记得点击上面的“save”保存配置。至此所有配置全部结束,接下来就是实际装机过程。
4.装机
将新的服务器接电源后,设置bios以网络方式启动。然后交由cobbler程序自行部署安装!
<div>参考:http://blog.chinaunix.net/uid-16728139-id-4174109.html</div>
<div>http://blog.xymvp.com/?thread-index-fid-1-tid-129.htm</div>
本文由 Mr Gu 创作,采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为: Oct 12, 2016 at 02:46 pm