Cobbler自动化安装操作系统手册
一、基础环境
服务器及网络环境:
Cobbler服务器系统:CentOS release 6.664位
需要安装部署的Linux系统:
Centos or Ubuntu
eth0(第一块网卡,用于外网)IP地址段:192.168.76.***-192.168.76*.***
子网掩码:255.255.255.0
网关:192.168.75.***
二、Cobbler部署
通过配置Cobbler服务器,全自动批量安装部署Linux系统,以下均在Cobbler服务器上操作
1、关闭SELINUX
vim /etc/selinux/config
#注释掉 #SELINUX=enforcing #注释掉 #SELINUXTYPE=targeted #增加 SELINUX=disabled |
使配置立即生效:setenforce 0
验证:/usr/sbin/sestatus -v 或getenforce
2、配置防火墙
开放TCP:80、TCP:25151、UDP:69等或关闭防火墙
vim /etc/sysconfig/iptables
#http服务需要此端口 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #tftp服务需要此端口 -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 69 -j ACCEPT #cobbler需要此端口 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp-p tcp --dport 25151 -j ACCEPT |
重启防火墙使配置生效:/etc/init.d/iptables restart
关闭防火墙: serviceiptables stop
开机off:chkconfigiptables off
验证:serviceiptables status
3、安装Cobbler
安装centos6.x 64位 cobbler依赖源和cobbler
#安装centos6.xcobbler依赖源
cd /usr/local/src
wget/pub/epel/6/x86_arch.rpm
rpm –ivharch.rpm
#安装cobbler
yuminstall cobbler tftptftp-server xinetddhcphttpdrsync
#安装运行cobbler依赖软件包
yc++进程间通信um installpykickstartdebmirrorpython-ctypescman
备注: wget /pub/epel/5/arch.rpm #CentOS 5.x 32位 wget /pub/epel/5/arch.rpm #CentOS 5.x 32位 wget /pub/epel/6/arch.rpm #CentOS6.x 32位 |
4、配置Cobbler
(1)设置http服务
vim /etc/httpd/conf.f
#取消前面的注释 LoadModulewsgi_module modules/mod_wsgi.so 器件standoff |
开机启动:chkconfighttpd on
启动:servicehttpd start
(2)设置tftp服务开机启动
vim /etc/plate
service tftp { disable = no socket_type = dgram protocol = udp wait = yes user = $user server = $binary server_args = -B 1380 -v -s $args per_source = 11 cps = 100 2 flags = IPv4 } |
(3)设置rsync服务开机启动
CentOS中是以xinetd来管理Rsync和tftp服务
vim /etc/xinetd.d/rsync
service rsync { #修改为no disable = no socket_type = stream wait = no user = root server = /usr/bin/rsync server_args = --daemon log_on_failure += USERID } |
启动:/etc/init.d/xinetd start
(4)配置cobbler相关参数
注释掉f文件中 @dists和 @arches 两行
vim /f
#@dists="sid"; #@arches="i386"; |
生成默认模板下系统安装完成之后root账号登录密码,并记录下输出行
opensslpasswd -1 -salt 'osyunwei' '123456'
#记录下这行,下面会用到 $1$osyunwei$sEV8iwXXuR4CqzLXyLnzm0 |
vim/etc/cobbler/settings
default_password_crypted: "$1$osyunwei$sEV8iwXXuR4CqzLXyLnzm0" next_server: 192.168.21.128 server: 192.168.21.128 manage_dhcp: 1 default_kickstart: /var/lib/cobbler/kickstarts/default.ks |
(5)配置dhcp服务器
vim /etc/plate
#设置网段 subnet 192.168.21.0 netmask255.255.255.0 { #设置网关 option routers 192.168.21.2; #设置dns服务器地址 option domain-name-servers8.8.8.8,8.8.4.4; #设置子网掩码 option subnet-mask 255.255.255.0; #设置dhcp服务器IP地址租用的范围 2020年php个人发卡源码 range dynamic-bootp192.168.21.160 192.168.21.200; #默认租约时间 default-lease-time 21600; #最大租约时间 max-lease-time 43200; next-server $next_server; 模板建站配云服务器哪家好 class "pxeclients" { match if substring (option vendor-class-identifier, 0, 9) = "PXEClient"; if option pxe-system-type = 00:02 { filename "ia64/elilo.efi"; } else if option pxe-system-type = 00:06 { filename "grub/grub-x86.efi"; } else if option pxe-system-type = 00:07 { filename "grub/grub-x86_64.efi"; } else { filename "pxelinux.0"; } } } |
指定DHCP服务的网络接口,eth0 必须是服务器可以用的网卡
vim /etc/sysconfig/dhcpd
plot的定义DHCPDARGS=eth0 |
测试dhcp服务器配置是否正确:dhcpd
dhcpd设置开机启动:chkconfigdhcpd on
cobblerd设置开机启动:chkconfigcobblerd on
安装cobbler相关工具包,否则检查cobbler配置会报错
cobbler get-loaders
启动cobbler:servicecobblerd start
同步配置文件到dhcp服务器:cobbler sync
启动dhcp服务:servicedhcpd start
注意:cobbler sync #安装cobbler错误集锦: xmlrpclib.Fault: <Fault 1: "ptions.CX:'login failed'"> 查看导入列表,如果报如下内容,需要重启cobbler,并执行cobbler get-loaders. service cobblerd restart cobbler get-loaders |
页面方位cobbler_web: Ip /cobbler_web
(6)设置cobbler相关服务启动脚本
将上面的cobbler脚本文件放于/etc/rc.d/init.d/目录下,并通过chmod +x /etc/rc.d/init.d/cobbler赋予执行权限
设置开机启动:chkconfig cobbler on
启动cobbler服务:service cobbler restart
检查cobbler配置,出现下面的提示,SELinux和防火墙前面已经设置,不用理会
cobbler check
====================================================================== The following are potential configuration items that you may want to fix: 1 :SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:github/cobbler/cobbler/wiki/Selinux 2 : since iptables may be running, ensure 69, 80/443, and 25151 are unblocked Restart cobblerd and then run 'cobbler sync' to apply changes ====================================================================== |
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论