#!/bin/bash
#
#cobbler server Address
ip=192.168.119.133
#DHCP server NET and address Fanwei
net=192.168.119.0
begin=192.168.119.150
end=192.168.119.200
dns=202.96.209.133
#firewall setting
Sed-i-E ' s/selinux=enforcing/selinux=disabled '/etc/sysconfig/selinux
Setenforce 0
Iptables-i input-m State--state new-m tcp-p TCP--dport 80-j ACCEPT
Iptables-i input-m State--state new-m tcp-p TCP--dport 25151-j ACCEPT
Iptables-i input-m State--state new-m udp-p UDP--dport 69-j ACCEPT
Service Iptables Save
Service Iptables Restart
#hostname setting
echo "$ip www.cobbler.com" >>/etc/hosts
#install Epel and config Epel
wget http://mirrors.aliyun.com/epel/epel-release-latest-6.noarch.rpm
RPM-IVH epel-release-latest-6.noarch.rpm
Rm-rf/var/run/yum.pid
Yum Repolist
Yum-y Install cobbler cobbler-web pykickstart dhcp httpd debmirror rsync cman fence-agents python-ctypes System-config-ki Ckstart
/etc/init.d/iptables stop
/ETC/INIT.D/HTTPD start
/etc/init.d/xinetd start
/etc/init.d/cobblerd start
Service Cobblerd Restart
Cobbler Get-loaders
Sed-i-E ' s/= yes/= no/g '/etc/xinetd.d/rsync
Sed-i-E ' s/= yes/= no/g '/etc/xinetd.d/tftp
Sed-i ' [email protected]_server: [email protected]_server: ' $ip ' @g '/etc/cobbler/settings
Sed-i ' [email protected]: [email protected]: ' $ip ' @g '/etc/cobbler/settings
Sed-i ' [email protected][email protected]#[email protected] '/etc/cobbler/settings
echo "default_password_crypted:" $ (OpenSSL passwd-1-salt ' random-phrase-here "[email protected] ')" ">>/etc/ Cobbler/settings
#cp/usr/share/syslinux/pxelinux.0/var/lib/cobbler/loaders/
#cp/usr/share/syslinux/meminfo.c32/var/lib/cobbler/loaders/
Service Cobblerd Restart
Cobbler Sync
Cat >/etc/dhcp/dhcpd.conf << EOF
Option Domain-name "cobbler.com";
Option Domain-name-servers $dns;
Default-lease-time 43200;
Max-lease-time 86400;
Log-facility Local7;
Subnet $net netmask 255.255.255.0 {
Range $begin $end;
option routers $ip;
}
Next-server $ip;
Filename= "pxelinux.0";
Eof
Service Cobblerd Restart
Service xinetd Restart
Service DHCPD Start
#mount System ISO File
Mkdir/opt/cobbler
Mount/dev/cdrom/opt/cobbler
Cobbler Import--name=centos-6.7-x86_64--path=/opt/cobbler
Cobbler profile Add--name=auto_install_centos-6.7--distro=centos-6.7-x86_64--kickstart=/var/lib/cobbler/ Kickstarts/ks.cfg
Install Cobbler Automation deployment software in CentOS