A quick and dirty recipe to perform an unattended (and possibly miminal) CentOS 6.x installation,
you will need:
- a CentOS netinstall iso (eg: CentOS-6.5-x86_64-netinstall.iso).
- a kickstart file.
- a webserver.
First create a valid kickstart file for a minimal install that suits your needs, for example:
(WARNING: This kickstart will erase your first drive without prompt, you have been warned!)
text
skipx
install
url --url http://centos.fastbull.org/centos/6/os/x86_64/
repo --name=epel --baseurl=http://download.fedoraproject.org/pub/epel/6/x86_64/
repo --name=updates --baseurl=http://centos.fastbull.org/centos/6/updates/x86_64/
lang en_US.UTF-8
keyboard it
rootpw centos
firewall --disabled
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone Europe/Rome
bootloader --location=mbr
zerombr
clearpart --all --initlabel
part /boot --fstype ext4 --fsoptions="noatime" --size=200
part pv.01 --size 1 --grow
volgroup vg0 pv.01
logvol swap --fstype swap --name=swap --vgname=vg0 --size 512
logvol / --fstype ext4 --fsoptions="noatime" --name=root --vgname=vg0 --size 4096 --grow
services --enabled=postfix,network,ntpd,ntpdate
reboot
%packages --nobase
epel-release
openssh-clients
openssh-server
yum
at
acpid
vixie-cron
cronie-noanacron
crontabs
logrotate
ntp
ntpdate
rsync
which
wget
-prelink
-selinux-policy-targeted
Name this file "centos6_64min.ks" and place it somewhere on your webserver, now create a new, empty virtual machine, attach the previously downloaded CentOS netinstall iso and fire it up, boot from CD-ROM and once reached to the grub prompt press the Tab key to pass some extra params (notice the "asknetwork" and "ks=/path/to/ks" parameters):
Configure your network (statically or via dhcp) and you are done: should be able to perform an unattended installation. (AGAIN, WARNING: This kickstart will erase your first drive without prompt, you have been warned!)
If you feel lazy there is another option: remaster the original netinstall iso and customize some arguments in order to speedup the process, for example create a set of different kickstart files and customize the grub prompt:
Create another kickstart, let's say with the puppet agent already included/installed "centos6_64minpuppet.ks":
text
skipx
install
url --url http://centos.fastbull.org/centos/6/os/x86_64/
repo --name=updates --baseurl=http://centos.fastbull.org/centos/6/updates/x86_64/
repo --name=epel --baseurl=http://download.fedoraproject.org/pub/epel/6/x86_64/
repo --name=puppetlabs --baseurl=http://yum.puppetlabs.com/el/6/products/x86_64/
repo --name=puppetlabs_dependencies --baseurl=http://yum.puppetlabs.com/el/6/dependencies/x86_64/
lang en_US.UTF-8
keyboard it
rootpw centos
firewall --disabled
authconfig --enableshadow --passalgo=sha512
selinux --disabled
timezone Europe/Rome
bootloader --location=mbr
zerombr
clearpart --all --initlabel
part /boot --fstype ext4 --fsoptions="noatime" --size=200
part pv.01 --size 1 --grow
volgroup vg0 pv.01
logvol swap --fstype swap --name=swap --vgname=vg0 --size 512
logvol / --fstype ext4 --fsoptions="noatime" --name=root --vgname=vg0 --size 4096 --grow
services --enabled=postfix,network,ntpd,ntpdate
reboot
%packages --nobase
epel-release
puppetlabs-release
puppet
openssh-clients
openssh-server
yum
at
acpid
vixie-cron
cronie-noanacron
crontabs
logrotate
ntp
ntpdate
rsync
which
wget
-prelink
-selinux-policy-targeted
Mount the iso, extract contents, customize isolinux configuration and re-create the iso file:
- mkdir /tmp/{loop,remaster}
- mount -o loop /path/to/CentOS-6.5-x86_64-netinstall.iso /tmp/loop
- rsync -av /tmp/loop/ /tmp/remaster/; umount /tmp/loop
- vi /tmp/remaster/isolinux/isolinux.cfg
As an example add two new entries custom1 and custom2 before the linux one:
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
label custom1
menu label Unattended installation (mimimal)
kernel vmlinuz
append initrd=initrd.img asknetwork ks=http://zerodev.it/files/centos6_64min.kick
label custom2
menu label Unattended installation (mimimal+puppet)
kernel vmlinuz
append initrd=initrd.img asknetwork ks=http://zerodev.it/files/centos6_64minpuppet.kick
label linux
menu label Install or upgrade an existing system
menu default
Now rebuild the iso (you will need the "mkisofs" utility from the cdrkit or cdrtools package for this):
genisoimage -l -r -J -V "CentOS-6.5-x86_64-netinstall-CUSTOM" -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -c isolinux/boot.cat -o /tmp/CentOS-6.5-x86_64-netinstall-CUSTOM.iso .
You are done, attach the iso to your virtual machine and enjoy the new customized menu
Comments