lost and found ( for me ? )

ESXi : install CentOS automatically with kickstart


[ prepare kickstart file ]

I made a kickstart file using system-config-kickstart.

install system-config-kickstart via yum.
# yum install –y system-config-kickstart.noarch

make a kickstart file with system-config-kickstart
# system-config-kickstart

GUI will appear like this:

configure installation settings step by step with system-config-kickstart.

Here’s an example ks file of CentOS5.6 which I created with system-config-kickstart.
# cat centos5-6.ks.cfg
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth  --useshadow  --enablemd5
# System bootloader configuration
bootloader --append="console=ttyS0,115200n8 console=tty0" --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard jp106
# System language
lang ja_JP
# Installation logging level
logging --level=info
# Use CDROM installation media
cdrom
# Network information
network --bootproto=static --device=eth0 --gateway=192.168.11.254 --ip=192.168.11.160 --nameserver=192.168.11.15 --netmask=255.255.255.0 --onboot=on
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $1$3QEuw1wV$VUKWhr1WZ1SAUXNVFv7Jk.

# SELinux configuration
selinux --disabled
# System timezone
timezone --isUtc Asia/Tokyo
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig  --defaultdesktop=GNOME --depth=8 --resolution=640x480
# Disk partitioning information
part / --bytes-per-inode=4096 --fstype="ext3" --size=5000
part swap --bytes-per-inode=4096 --fstype="swap" --size=512

%packages
@development-libs
@development-tools
@editors


[ make an ISO image including a ks file ]

mount original CentOS ISO.
# mount -t iso9660 -o loop CentOS-5.6-x86_64-bin-DVD-1of2.iso /media/cdrom/

copy ISO files to an another directory.( /root/CentOS.5.6_Custom )
# cd /media/cdrom/
# mkdir /root/CentOS5.6_Custom

# pwd
/media/cdrom
# tar cf - . | (cd /root/CentOS5.6_Custom; tar xfp -)

copy ks file ( name a ks file you made “ks.cfg” )
# cp /root/centos5-6.ks.cfg /root/CentOS5.6_Custom/ks.cfg

build a customized ISO.
# pwd
/root/CentOS5.6_Custom

# mkisofs -o /root/CentOS5.6_x86_64_custom.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V "CetnOS 5.6 Custom ISO"

# file /root/CentOS5.6_x86_64_custom.iso
/root/CentOS5.6_x86_64_custom.iso: # ISO 9660 CD-ROM filesystem data 'CDROM                          ' (bootable)

confirm you can mount customized ISO and confirm there’s ks.cfg into that ISO.
# mount -t iso9660 -o loop CentOS5.6_x86_64_custom.iso /root/aaa

# head -5 /root/aaa/ks.cfg
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth  --useshadow  --enablemd5
# System bootloader configuration
bootloader --append="console=ttyS0,115200n8 console=tty0" --location=mbr

[ install CentOS as a VM using customized ISO on ESXi ]

start a VM from CentOS5.6_x86_64_custom.iso and then specify “linux ks=cdrom:/ks.cfg” as below.

installation has been processed automatically.

With this ks file , after finishing the installation , rebooting system automatically.

I could install CentOS automatically :)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.