#!/bin/bash
yum -y install cobbler httpd cobbler-web debmirror pykickstart
service cobblerd start
service httpd start
cd /etc/cobbler
sed -i ‘[email protected]_server: [email protected]_server: [email protected]‘ settings
sed -i ‘[email protected]: [email protected]: [email protected]‘ settings
cobbler get-loaders
sed -i ‘s/@dists="sid";/#@dists="sid";/g‘ /etc/debmirror.conf
sed -i ‘s/@arches="i386";/#@arches="i386";/g‘ /etc/debmirror.conf
openssl passwd -1 -salt ‘openssl rand -hex 4‘ redhat
sed -i ‘[email protected]_password_crypted: "$1$mF86/UHC$WvcIcX2t6crBz2onWxyac."@default_password_crypted: $1$openssl $GZKb7LW2hcSWj8/oiA.v9/@g‘ settings
yum -y install cman fence-agents
service cobbler restart
yum -y install dhcp
cd /etc/dhcp
cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample ./dhcpd.conf
cat > dhcpd.conf << EOF
option domain-name "qiufengsong.com";
option domain-name-servers 192.168.3.17,192.168.3.3;
default-lease-time 33600;
max-lease-time 37200;
log-facility local7;
subnet 192.168.3.0 netmask 255.255.255.0 {
range 192.168.3.120 192.168.3.200;
option routers 192.168.3.17;
}
next-server 192.168.3.17;
filename "pxelinux.0";
EOF
service dhcpd restart
mount /dev/cdrom /mnt
service cobblerd restart
cobbler import --name=‘centos-6.4-x86-64‘ --path=/mnt
cat > /root/ks.cfg << EOF
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use network installation
url --url="http://192.168.3.17/cobbler/ks_mirror/centos-6.4-x86-64/"
# Root password
rootpw --iscrypted $1$iRHppr42$VMesh73wBqhUTjKp6OYOD.
# System authorization information
auth --useshadow --passalgo=sha512
# Use text mode install
text
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info --host=192.168.3.17
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai
# System bootloader configuration
bootloader --append="rhgb crashkernel=auto quiet" --location=mbr --driveorder="sda"
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all
# Disk partitioning information
part /boot --fstype=ext4 --size=200
part pv.008002 --size=122679
volgroup vg_root --pesize=4096 pv.008002
logvol / --fstype=ext4 --name=LogVg --vgname=vg_root --size=122676
%post
sed -i ‘1,[email protected]:[0-9]:initdefault:@id:3:initdefault:@g‘ /etc/inittab
%end
%packages
@base
@core
@server-policy
%end
cobbler profile add --name="centos.x86_64" --distro=centos-6.4-64-x86_64 --kickstart=/root/ks.cfg
cobbler sync
service xinetd start