Wednesday, 20 January 2016

KickStarting and Linux WSUS Techinque

Make a Webserver:

# yum -y install httpd

Create a folder 

# mkdir  -p /var/www/html/install

Then mount the cd

# mount /dev/cdrom /media

Copy the data

# cp -R /media/* /var/www/html/install

Verify it 

# diff -q -r /media /var/www/html/install

There are may ways to create a kickstart file for example use a gui tool :

# yum install system-config-kickstart

Or use one like this:

#Kickstart file automatically generated by anaconda.

#version=DEVEL
install                                 # instead of "upgrade"
text            # you're not going to be standing there watching it, are you?
url --url http://10.10.10.1/pub/        # use this instead of CD-ROM Option
bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet"
zerombr yes
clearpart --all --initlabel
part / --fstype ext4 --size 4096 --grow
part swap --recommended
selinux --disabled
lang en_US.UTF-8
keyboard us
network --onboot yes --device eth0 --bootproto dhcp --noipv6
rootpw  --iscrypted $6$Y3aFxc5JNbESX3hb$
firewall --service=ssh
authconfig --enableshadow --passalgo=sha512
timezone --utc Pacific/Auckland
repo --name="CentOS"  --baseurl=http://10.10.10.1/pub/ --cost=100    #replace the base url from #cdrom or any other to suit yours
reboot
%packages --nobase
@core
%post 
cd /tmp 
wget http://10.10.10.1/post-install/myrepo.sh 
chmod +x local-repo.sh 
./repo.sh
%end

Save this file as ks.cfg into /var/www/html/install

Now we create our own repo:

# mkdir -p /var/www/html/reposit

# yum install createrepo

# createrepo   /var/www/html/reposit

# rsync -avz rsync://centos.ar.host-engine.com/6.6/os/x86_64/ /var/www/html/reposit

# createrepo --update /var/www/html/reposit

Once this is all done, we make a script 

# mkdir -p /var/www/html/post-install

# cd /var/www/html/post-install

# nano myrepo.sh

cd /etc/yum.repos.d
rm *.repo  
wget http://10.10.10.1/post-install/myrepo.repo
yum clean all
yum -y update

Save it and create a local repo, also in the same folder like this:

# nano myrepo.repo

[myrepo]
name=myrepo
baseurl=http://10.10.10.1/reposit/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

Save it.

Now boot up a client and when the installer screen comes in press tab and enter this all in one line:

vmlinuz initrd=initrd.img ks=http://10.10.10.1/install/ks.cfg append ip=10.10.10.100 netmask=255.255.255.0 ksdevice=eth0

Job Done!

No comments:

Post a Comment