安装脚本
#yum -y install wget
#wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
#rpm -ivh epel-release-6-8.noarch.rpm
#/etc/cobbler/dhcp.template
yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes python-simplejson -y
sed -i '/disable/c\\tdisable\t\t\t= no' /etc/xinetd.d/tftp
sed -i -e 's/\=\ yes/\=\ no/g' /etc/xinetd.d/rsync
sed -i -e 's/#ServerName www.example.com:80/ServerName 192.168.1.231:80/g' /etc/httpd/conf/httpd.conf
chkconfig ip6tables off
chkconfig iptables off
/etc/init.d/ip6tables stop
/etc/init.d/iptables stop
sed -i 's/next_server: 127.0.0.1/next_server: 192.168.1.231/g' /etc/cobbler/settings
sed -i 's/bind_master: 127.0.0.1/bind_server: 192.168.1.231/g' /etc/cobbler/settings
sed -i 's/manage_rsync: 0/manage_rsync: 1/g' /etc/cobbler/settings
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
setenforce 0
service httpd restart
/etc/init.d/cobblerd restart
/etc/init.d/xinetd restart
cobbler get-loaders
mount -o loop /dev/cdrom /mnt/c6.5/
cobbler import --path=/mnt/c6.5/ --name=centos-server-6.5-i386
cobbler distro list
/var/www/cobbler/ks_mirror/
cobbler profile edit --name=centos6.5 --distro=centos-server-6.5-i386 --kickstart=/var/lib/cobbler/kickstarts/c6.ks
cobbler sync
dhcp配置
subnet 192.168.1.0 netmask 255.255.255.0 {
option routers 192.168.1.1;
option domain-name-servers 202.106.0.20;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.1.10 192.168.1.50;
filename "/pxelinux.0";
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
}
service network restart
更新:centos6.6安装完成后,cobbler sync报错,主要是dhcp4.0配置的改变,要修改/etc/cobbler/dhcp.template
把原来的next-server $next-server改成
next-server 你的ip地址;
2.c6.ks
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Use text mode install
lang zh_CN.UTF-8
#langsupport zh_CN.UTF-8 en_US --default=en_US
keyboard us
#mouse generic3ps/2
timezone Asia/Shanghai
install
url --url=http://192.168.1.231/cobbler/ks_mirror/centos-server-6.5-i386
text
#zerombr yes
# Partition clearing information
#clearpart --all
clearpart --all --initlabel
#Partition clearing information
part /boot --fstype ext4 --size=100
part swap --size=2048
part pv.01 --size=1 --grow
volgroup vg_root pv.01
logvol / --fstype=ext4 --name=lv_root --vgname=vg_root --size=20480
network --bootproto static --device eth0 --ip 192.168.1.45 --netmask 255.255.255.0 --gateway=192.168.1.1 --noipv6 --hostname cobbler#network --bootproto=dhcp --device=eth0 --onboot=on
firewall --disabled
selinux --disabled
skipx
# Network information
#--- Reboot the host after installation is done
reboot
#Root password
rootpw 123456
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
%packages
@base
@core
%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')
#$SNIPPET('post_install_network_config')
echo "NETWORKING=yes" >/etc/sysconfig/network
echo "NETWORKING_IPV6=no" >>/etc/sysconfig/network
echo "HOSTNAME=cobbler" >>/etc/sysconfig/network
echo "nameserver 192.168.1.1" >/etc/resolv.conf
echo "nameserver 202.106.0.20" >>/etc/resolv.conf
for service in `chkconfig --list|awk '{print $1}'|egrep -v "^$"|awk -F ":" '{print $1}'`; do chkconfig $service off;done
for service in crond sshd syslog network; do chkconfig $service on;done
ulimit -HSn 65535
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
#wget http://192.168.1.231/lamp 可以把脚本放这里
#sh lamp
参考dl528888的博客 http://dl528888.blog.51cto.com/
3.c7.ks
vi /var/lib/cobbler/kickstarts/c7.ks
#version=RHEL7
# System authorization information
auth --enableshadow --passalgo=sha512
install
url --url=http://192.168.5.61/cobbler/ks_mirror/centos7/
firstboot --disable
ignoredisk --only-use=sda
keyboard --vckeymap=us --xlayouts='cn'
lang en_US.UTF-8
firewall --disabled
# Run the Setup Agent on first boot
network --bootproto=dhcp --device=ens0 --onboot=off --noipv6
network --hostname=ks1
# Root password
#rootpw --iscrypted $6$rHQRho3gkPJXIgy7$LTVHkf8PwxnOUc8QPvotK3myXGDsp2FKfdHWjWftjwcSAAB.V/j7Ki3lTDbu6e2Kc55imnNLc/Hno./VQh2cz.
rootpw 123456
# System timezone
timezone Asia/Shanghai --isUtc
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
selinux --disabled
reboot
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part pv.10 --fstype="lvmpv" --ondisk=sda --size=80000
part /boot --fstype="xfs" --ondisk=sda --size=1000
volgroup centos --pesize=4096 pv.10
logvol /var --fstype="xfs" --size=40000 --name=var --vgname=centos
logvol / --fstype="xfs" --size=16000 --name=root --vgname=centos
logvol swap --fstype="swap" --size=2080 --name=swap --vgname=centos
logvol /usr --fstype="xfs" --size=20000 --name=usr --vgname=centos
%packages
@core
@development
%end
最小化安装,没有ifconfig命令,yum -y install net-tools*
参考 http://54276311.blog.51cto.com/9130197/1561429/