sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
setenforce 0chkconfig iptables offservice iptables stop重启机器
rpm -Uvh 'yum clean all
sleep 2
yum install -y cobbler tftp dhcp httpd cman pykickstart debmirror
yum install -y ed patch perl perl-Compress-Zlib perl-Digest-SHA1 perl-LockFile-Simple perl-libwww-perlsleep 10chkconfig httpd onchkconfig dhcpd onchkconfig xinetd onchkconfig cobblerd onsleep 2sed -i 's/#ServerName www.example.com:80/ServerName 127.0.0.1:80/g' /etc/httpd/conf/httpd.confservice httpd startnetstat -ntulp | grep :80sleep 5service cobblerd restartsleep 1cobbler checksed -i 's/server: 127.0.0.1/server: 172.16.5.200/g' /etc/cobbler/settingssleep 5
sed -i '/disable/ s/^.*$/ disable = no/g' /etc/xinetd.d/tftpsed -i '/disable/ s/^.*$/ disable = no/g' /etc/xinetd.d/rsync
service xinetd startsleep 1sed -i 's/@dists="sid";/#@dists="sid";/g' /etc/debmirror.conf
sed -i 's/@arches="i386";/#@arches="i386";/g' /etc/debmirror.confsed -i '/default_password_crypted/ s/^.*$/default_password_crypted: "$1$hahaha$vsb1I2cBmYBaA0VxRyixp1"/g' /etc/cobbler/settingssed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settingssed -i 's/pxe_just_once: 0/pxe_just_once: 1/g' /etc/cobbler/settings
/etc/init.d/cobblerd restart上传附件里的所有文件到/var/lib/cobbler/loaders/目录
cobbler check #这步会报错,说dhcp没启动,按备注dhcp部分修改即可
cobbler sync备注1、DHCP 部分[root@hscloud_cobbler ~]# vi /etc/dhcp/dhcpd.conf # ******************************************************************# Cobbler managed dhcpd.conf file# generated from cobbler dhcp.conf template (Fri Apr 3 07:54:17 2015)# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be# overwritten.# ******************************************************************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 192.168.10.0 netmask 255.255.255.0 { option routers 192.168.10.1; option subnet-mask 255.255.255.0; filename "/pxelinux.0"; default-lease-time 21600; max-lease-time 43200; next-server 192.168.10.240;}subnet 192.168.100.0 netmask 255.255.255.0 { option routers 192.168.100.254; option subnet-mask 255.255.255.0; filename "/pxelinux.0"; default-lease-time 21600; max-lease-time 43200; next-server 192.168.10.240;}# group for Cobbler DHCP tag: defaultgroup { }[root@hscloud_cobbler ~]# vi /etc/cobbler/dhcp.template # ******************************************************************# Cobbler managed dhcpd.conf file## generated from cobbler dhcp.conf template ($date)# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be# overwritten.## ******************************************************************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 192.168.10.0 netmask 255.255.255.0 { option routers 192.168.10.1; option subnet-mask 255.255.255.0; filename "/pxelinux.0"; default-lease-time 21600; max-lease-time 43200; next-server $next_server;}subnet 192.168.100.0 netmask 255.255.255.0 { option routers 192.168.100.254; option subnet-mask 255.255.255.0; filename "/pxelinux.0"; default-lease-time 21600; max-lease-time 43200; next-server $next_server;}#for dhcp_tag in $dhcp_tags.keys(): ## group could be subnet if your dhcp tags line up with your subnets ## or really any valid dhcpd.conf construct ... if you only use the ## default dhcp tag in cobbler, the group block can be deleted for a ## flat configuration# group for Cobbler DHCP tag: $dhcp_taggroup { #for mac in $dhcp_tags[$dhcp_tag].keys(): #set iface = $dhcp_tags[$dhcp_tag][$mac] host $iface.name { hardware ethernet $mac; #if $iface.ip_address: fixed-address $iface.ip_address; #end if #if $iface.hostname: option host-name "$iface.hostname"; #end if #if $iface.netmask: option subnet-mask $iface.netmask; #end if #if $iface.gateway: option routers $iface.gateway; #end if #if $iface.enable_gpxe: if exists user-class and option user-class = "gPXE" { filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner"; } else if exists user-class and option user-class = "iPXE" { filename "http://$cobbler_server/cblr/svc/op/gpxe/system/$iface.owner"; } else { filename "undionly.kpxe"; } #else filename "$iface.filename"; #end if ## Cobbler defaults to $next_server, but some users ## may like to use $iface.system.server for proxied setups next-server $next_server; ## next-server $iface.next_server; } #end for}#end for启动DHCP服务 /etc/init.d/dhcpd restart注:此方式配置的DHCP可以分配多个网段2、web界面安装部分可以配置cobbler的web管理界面
(1)、安装软件包
[root@localhost ~]# yum -y install cobbler-web
(2)、设置用户名密码
为已存在的用户cobbler重置密码
[root@localhost ~]# htdigest /etc/cobbler/users.digest "Cobbler" cobbler
添加新用户
[root@localhost ~]# htdigest /etc/cobbler/users.digest "Cobbler" admin
(3)、配置cobbler web可以登录
[root@localhost ~]# sed -i 's/authn_denyall/authn_configfile/g' /etc/cobbler/modules.conf
(4)、重启Cobbler与http
[root@localhost ~]# /etc/init.d/cobblerd restart
Stopping cobbler daemon: [ OK ]
Starting cobbler daemon: [ OK ]
[root@localhost ~]# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@localhost ~]#
(5)访问Cobbler Web页面
https://10.240.240.210/cobbler_web