Cobbler全自动批量安装部署Linux系统.docx
《Cobbler全自动批量安装部署Linux系统.docx》由会员分享,可在线阅读,更多相关《Cobbler全自动批量安装部署Linux系统.docx(5页珍藏版)》请在冰豆网上搜索。
Cobbler全自动批量安装部署Linux系统
Cobbler全自动批量安装部署Linux系统
说明:
Cobbler服务器系统:
CentOS5.1064位IP地址:
192.168.21.128需要安装部署的Linux系统:
eth0(第一块网卡,用于外网)IP地址段:
192.168.21.160-192.168.21.200eth1(第二块网卡,用于内网)IP地址段:
10.0.0.160-10.0.0.200子网掩码:
255.255.255.0网关:
192.168.21.2DNS:
8.8.8.88.8.4.4所有服务器均支持PXE网络启动实现目的:
通过配置Cobbler服务器,全自动批量安装部署Linux系统具体操作:
第一部分:
在Cobbler服务器上操作一、关闭SELINUXvi/etc/selinux/config#SELINUX=enforcing#注释掉#SELINUXTYPE=targeted#注释掉SELINUX=disabled#增加:
wq!
#保存退出setenforce0#使配置立即生效二、配置防火墙,开启TCP:
80端口、TCP:
25151端口、UDP:
69端口vi/etc/sysconfig/iptables#编辑-ARH-Firewall-1-INPUT-mstate--stateNEW-mtcp-ptcp--dport80-jACCEPT#http服务需要此端口-ARH-Firewall-1-INPUT-mstate--stateNEW-mudp-pudp--dport69-jACCEPT#tftp服务需要此端口-ARH-Firewall-1-INPUT-mstate--stateNEW-mtcp-ptcp--dport25151-jACCEPT#cobbler需要此端口:
wq!
#保存退出/etc/init.d/iptablesrestart#最后重启防火墙使配置生效三、安装Cobblercd/usr/local/srcwgethttp:
//dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm#CentOS5.x64位rpm-ivhepel-release-5-4.noarch.rpm备注:
wgethttp:
//dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm#CentOS5.x32位wgethttp:
//dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm#CentOS6.x64位wgethttp:
//dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm#CentOS6.x32位yuminstallcobblertftptftp-serverxinetddhcphttpdrsync#安装cobbleryuminstallpykickstartdebmirrorpython-ctypescman#安装运行cobbler需要的软件包四、配置Cobbler1、设置http服务vi/etc/httpd/conf.d/wsgi.confLoadModulewsgi_modulemodules/mod_wsgi.so#取消前面的注释:
wq!
#保存退出chkconfighttpdon#设置开机启动servicehttpdstart#启动2、设置tftp服务开机启动vi/etc/cobbler/tftpd.template#编辑servicetftp{disable=no#修改为nosocket_type=dgramprotocol=udpwait=yesuser=rootserver=/usr/sbin/in.tftpdserver_args=-B1380-v-s/tftpbootper_source=11cps=1002flags=IPv4}:
wq!
#保存退出3、设置rsync服务开机启动vi/etc/xinetd.d/rsync#编辑配置文件,设置开机启动rsyncservicersync{disable=no#修改为nosocket_type=streamwait=nouser=rootserver=/usr/bin/rsyncserver_args=--daemon}:
wq!
#保存退出/etc/init.d/xinetdstart#启动(CentOS中是以xinetd来管理Rsync和tftp服务的)4、配置cobbler相关参数vi/etc/debmirror.conf#注释掉@dists和@arches两行[emailprotected]="sid";[emailprotected]="i386";:
wq!
#保存退出opensslpasswd-1-salt'osyunwei''123456'#生成默认模板下系统安装完成之后root账号登录密码$1$osyunwei$sEV8iwXXuR4CqzLXyLnzm0#记录下这行,下面会用到vi/etc/cobbler/settings#编辑,修改default_password_crypted:
"$1$osyunwei$sEV8iwXXuR4CqzLXyLnzm0"next_server:
192.168.21.128server:
192.168.21.128manage_dhcp:
1default_kickstart:
/var/lib/cobbler/kickstarts/default.ks:
wq!
#保存退出系统运维温馨提醒:
qihang01原创内容?
版权所有,转载请注明出处及原文链接5、配置dhcp服务器vi/etc/cobbler/dhcp.template#编辑,修改subnet192.168.21.0netmask255.255.255.0{#设置网段optionrouters192.168.21.2;#设置网关optiondomain-name-servers8.8.8.8,8.8.4.4;#设置dns服务器地址optionsubnet-mask255.255.255.0;#设置子网掩码rangedynamic-bootp192.168.21.160192.168.21.200;#设置dhcp服务器IP地址租用的范围default-lease-time21600;#默认租约时间max-lease-time43200;#最大租约时间next-server$next_server;class"pxeclients"{matchifsubstring(optionvendor-class-identifier,0,9)="PXEClient";ifoptionpxe-system-type=00:
02{filename"ia64/elilo.efi";}elseifoptionpxe-system-type=00:
06{filename"grub/grub-x86.efi";}elseifoptionpxe-system-type=00:
07{filename"grub/grub-x86_64.efi";}else{filename"pxelinux.0";}}}:
wq!
#保存退出vi/etc/sysconfig/dhcpd#指定DHCP服务的网络接口DHCPDARGS=eth0:
wq!
#保存退出dhcpd#测试dhcp服务器配置是否正确chkconfigdhcpdon#设置开机启动chkconfigcobblerdon#设置开机启动cobblerget-loaders#安装cobbler相关工具包,否则检查cobbler配置会报错servicecobblerdstart#启动cobblercobblersync#同步配置文件到dhcp服务器servicedhcpdstart#启动dhcp服务6、设置cobbler相关服务启动脚本vi/etc/rc.d/init.d/cobbler#编辑,添加以下代码#!
/bin/sh#chkconfig:
-8090#description:
cobblercase$1instart)/etc/init.d/httpdstart/etc/init.d/xinetdstart/etc/init.d/dhcpdstart/etc/init.d/cobblerdstart;;stop)/etc/init.d/httpdstop/etc/init.d/xinetdstop/etc/init.d/dhcpdstop;;restart)/etc/init.d/xinetdrestart/etc/init.d/cobblerdrestart;;status)/etc/init.d/httpdstatus/etc/init.d/dhcpdstatus/etc/init.d/cobblerdstatus;;sync)cobblersync;;*)echo"Inputerror,pleaseinput'start|stop|restart|status|sync'!
";exit2>&1>/dev/null&;;esac:
wq!
#保存退出chmod+x/etc/rc.d/init.d/cobbler#添加脚本执行权限chkconfigcobbleron#添加开机启动servicecobblerrestart#重启cobblercobblercheck#检查cobbler配置,出现下面的提示,SELinux和防火墙前面已经设置过了,不用理会系统运维温馨提醒:
qihang01原创内容?
版权所有,转载请注明出处及原文链接=====================================================================================Thefollowingarepotentialconfigurationitemsthatyoumaywanttofix:
1:
SELinuxisenabled.PleasereviewthefollowingwikipagefordetailsonensuringcobblerworkscorrectlyinyourSELinuxenvironment:
:
sinceiptablesmayberunning,ensure69,80/443,and25151areunblockedRestartcobblerdandthenrun'cobblersync'toapplychanges=====================================================================================五、挂载