感谢支持
我们一直在努力

Cobbler 无人值守安装Linux

1.Cobbler介绍


Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows。该工具使用Python开发,小巧轻便(才15k行代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP,DNS,以及yum包镜像。


Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用。


cobbler_1650) this.width=650;” border=0>


和Kickstart不同的是,使用cobbler不会因为在局域网中启动了dhcp而导致有些机器因为默认从pxe启动在重启服务器后加载tftp内容导致启动终止。


2.开始安装cobbler


注:默认的CentOS6没有cobbler包,需要到其它镜像去下载


wget http://download.Fedora.RedHat.com/pub/epel/6/i386/epel-release-xx..noarch.rpm


epel-release-xx..noarch.rpm 下载对应的系统包,centos6 对应的是 epel-release-6-5.noarch.rpm


rpm –Uvh epel-release-6-5.noarch.rpm


yum install cobbler cobbler-web tftp rsync httpd dhcp xinetd


3.开始配置


#service httpd start


#service cobblerd start


#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 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 : you need to set some SELinux content rules to ensure cobbler works correctly in your SELinux environment, run the following: /usr/sbin/semanage fcontext -a -t public_content_t “/tftpboot/.*” && \ /usr/sbin/semanage fcontext -a -t public_content_t “/var/www/cobbler/images/.*” 4 : 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. 5 : change ‘disable’ to ‘no’ in /etc/xinetd.d/tftp 6 : change ‘disable’ to ‘no’ in /etc/xinetd.d/rsync 7 : since iptables may be running, ensure 69, 80, and 25151 are unblocked 8 : debmirror package is not installed, it will be required to manage debian deployments and repositories 9 : 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 Restart cobblerd and then run ‘cobbler sync’ to apply changes.

上面这段信息大意就是:


1. 编辑/etc/cobbler/settings文件,找到 server选项,修改为适当的ip地址,本实例配置ip为:192.168.1.13(这个根据自己的可以设置);


2. 编辑/etc/cobbler/settings文件,找到 next_server选项,修改为适当的ip地址,本实例配置ip为:192.168.1.13;


3. SELinux的设置。如果上面已经关闭了SELinux就不用管了;


4. 执行 cobbler get-loaders,系统将自动下载loader程序,完成提示4的修复工作;


5. 编辑/etc/xinetd.d/tftp文件,将文件中的disable字段的配置由yes改为no;


6. 编辑/etc/xinetd.d/rsync文件,将文件中的disable字段的配置由yes改为no;


7. 在iptables中将69,80,25151端口打开。如果仅仅只是在内部环境中使用,建议直接将防火墙关掉;


8. 提示说debmirror没安装。如果不是安装 debian之类的系统,此提示可以忽略,如果需要安装,下载地址为;


http://rpmfind.net/linux/rpm2html/search.php?query=debmirror


CentOS 6使用RHEL 5的包就可以。


9. 修改cobbler用户的默认密码,可以使用如下命令生成密码,并使用生成后的密码替换/etc/cobbler/settings中的密码。生成密码命令:


openssl passwd -1 -salt ‘random-phrase-here’ ‘your-password-here’ 其中“random-phrase-here”为干扰码 (默认的用户名和密码都是cobbler);

4.cobbler的使用 导入镜像文件,首先把dvd光盘挂载到cobbler服务器上 一般都是mount /dev/cdrom /media 然后就是同步你的镜像文件了 cobbler import –path=/media/CentOS_6.0_Final –name=’CentOS_6.0_Final’ 这个时间很长,要等, 完成后 cobbler会将镜像中的拷贝到本地一份,放在/var/www/cobbler/ks_mirrors下的CentOS_6.0_Final目录下。 同时会创建一个名字为CentOS_6.0_Final的一个发布版本,以及一个名字为CentOS_6.0_Final的profile文件.


5.配置dhcp服务 编辑文件/etc/cobbler/settings把 manage_dhcp 改为 1 让cobbler来管理dhcp服务 接下来修改/etc/cobbler/dhcp.template,此文件是cobbler管理dhcp的模板,对于此文件,本例中只需要修改如下部分






ddns-update-style interim;


allow booting;
allow bootp;


ignore client-updates;
set vendorclass = option vendor-class-identifier;


subnet 192.168.1.0 netmask 255.255.255.0 {
     option routers             192.168.1.1;
     option domain-name-servers 202.102.192.68;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.1.14 192.168.1.254;
     filename                   “/pxelinux.0”;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
}


其余部分维持默认值即可


我这里有个问题是测试的时候老是找不到dhcp,我明明配置了dhcp,然后我就改成dnsmasq去管理dhcp和dns


先编辑/etc/cobbler/modules.conf


[dns]
module = manage_bind  改为 manage_dnsmasq


[dns]
module = manage_bind 改为 manage_dnsmasq


在编辑一下/etc/dnsmasq.conf,内容像这样






read-ethers
addn-hosts = /var/lib/cobbler/cobbler_hosts


dhcp-range=192.168.1.5,192.168.1.200
dhcp-option=3,192.168.1.13
dhcp-lease-max=1000
dhcp-authoritative
dhcp-boot=pxelinux.0
dhcp-boot=net:normalarch,pxelinux.0
dhcp-boot=net:ia64,/var/lib/cobbler/elilo-3.6-ia64.efi


然后启动service dnsmasq start


在同步一下cobbler


#cobbler sync; #service cobblerd restart 测试一下: 打开一个新的虚拟机 cobbler_2650) this.width=650;” border=0>


cobbler 的一些信息可以到


http://pkgs.org/centos-6-rhel-6/epel-i386/cobbler-web-2.0.11-2.el6.noarch.rpm.html


找找!

赞(0) 打赏
转载请注明出处:服务器评测 » Cobbler 无人值守安装Linux
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏