Open Source Software Technical Articles

Want the Best of the Wazi Blogs Delivered Directly to your Inbox?

Subscribe to Wazi by Email

Your email:

Connect with Us!

Current Articles | RSS Feed RSS Feed

Automatic CentOS 6.0 Installation With Kickstart

  
  
  

Automating Linux server installation promotes better security, stability, and performance through standardized setup, saves administrators' time, and decreases the chance of human mistakes. You can use Kickstart on Red Hat-based operating systems to create a custom boot configuration with just the software and options you want. Here's how to get Kickstart working with CentOS 6 installations.



In large deployments it's important to have a standard server setup to ensure that all servers are configured in the same fashion, with the same security mechanisms, filesystem layouts, and services running. Not only is this good practice, it's also a requirement for some government agencies and financial companies.



Kickstart uses a text file to answer all of the CentOS installer's questions. The file may live locally or over a network, so long as it's available during the installation. Because it uses the standard Anaconda installer, Kickstart can configure everything in a new installation, including hard disk partitioning, networking, and usernames and passwords.



A general good practice states that if your servers differ greatly throughout a deployment, the Kickstart configuration directives should specify only a minimal installation, which can be customized later for each server's specific needs. On the other hand, if the servers you're deploying are similar (as in the case of, for instance, a web hosting company with cloned virtual machines) you can adjust Kickstart's directives to handle a complete installation.

 

19a98812-f823-48dc-841e-bf029c63c6d7

 

Even in the most homogeneous deployments not all servers have the same basic setup, down to such details as hostnames and network addresses. That's why Kickstart has powerful options for specifying custom scripts in the pre- and post-installation processes that can do things like prompt for each server's IP address and hostname.



Kickstart Installation File



There are a few ways to create a Kickstart installation file. First, such a file is created automatically after each new CentOS installation, and can be found at /root/anaconda-ks.cfg. This file contains all the information about the new installation and can be reused for new installations. It can be a good starting point if you need to clone an existing server.



Another way to create and edit the Kickstart file is by using the graphical tool found in the CentOS menu tree under Applications -> System Tools -> Kickstart. Its options are divided in sections via a menu in the left pane, as follows:




    • Basic Configuration Here you specify the root password, default language, keyboard, and time zone. You can also specify that the installation should be performed in text mode, which make it faster and more reliable.

    • Installation Method lets you choose whether to perform a new installation or an upgrade. You really shouldn't perform unattended upgrades with Kickstart, because often user input is necessary and server upgrades usually differ. Here you can also specify the installation source – CD-ROM, NFS, FTP, HTTP, or hard drive.

    • Boot Loader Options lets you specify the usual boot options. The default values are optimal for most setups.

    • Partition Information While this seems like a simple configuration menu, it can cause a disaster if it's incorrectly configured. For example, suppose you have a SAN attached to the server. It will take priority over the local disks, and with the default options Kickstart will try to wipe it out in order to perform the installation there. You need to carefully consider the partition information options.

    • Network Configuration By default Kickstart does not configure the network interfaces. Obviously it's not wise to put the same IP address on every server, so this option is a little bit tricky. We'll talk about it more in a moment.

    • Authentication By default Kickstart specifies use of standard shadow passwords. Larger deployments will probably want to use a centralized authentication system. Kickstart supports NIS, LDAP, Kerberos, Hesoid, SMB, SMB, and Name Switch Cache.

    • Firewall Configuration is where you configure not only the firewall but also SELinux. If you don't want to run SELinux, this is the place to disable it. As for the firewall, if it is a minimal install it is better to disable the firewall too and configure it later.

    • Display Configuration For a server setup on which admins will be working in text mode, all options should be unchecked and disabled.

  • Package Selection This menu provides the familiar wizard that appears during CentOS installation for a targeted software installation, which allows you to select and deselect individual optional packages. Advanced users usually prefer to start with minimum package selections and later install only the packages required for the particular server setup. However, it is faster and more convenient to select a whole group of packages for a specific purpose, such as web server installation.
  • Pre-installation Script and Post-installation Script For advanced processing, you can specify scripts for different interpreters, such as bash, Perl, and Python. More on these scripts in a moment.


A sample Kickstart file might look like this:




#Simple Kickstart Configuration for a minimal installation
#Adjusted by Anatoliy Dimitrov

# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use CDROM installation media
cdrom
repo --name="centos" --baseurl=file:///mnt/source --cost=100
# Root password – 'testpass', encrypted
rootpw --iscrypted $1$pcafN9bo$lueZDdCQMz8fc/brhDa1J1
# Network information. Later we'll adjust it.
network --bootproto=static --device=eth0 --gateway=1.1.1.1 --ip=1.1.1.111 --nameserver=1.1.1.2 --netmask=255.255.255.0 --onboot=on
# System authorization information
auth --useshadow --passalgo=sha512 --enablefingerprint
# Use text mode install
text
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Installation logging level
logging --level=info

# System timezone
timezone America/New_York
# System bootloader configuration
bootloader --append="crashkernel=auto rhgb quiet" --location=mbr --driveorder="sda"
# Clear the MBR. Helps avoid problems with MBR.
zerombr
# Partition clearing information
clearpart --all

%post
#Here we will specify add a script later for changing the static IP of each new installation by accepting input
%end

%packages
@base
@core
@server-policy

%end


This file tells Kickstart to perform a complete, automatic installation with a minimum of software packages.



Loading a Kickstart File



To invoke Kickstart, you specify a Kickstart file in the installation media boot options with the parameter ks. To change this parameter at boot time you have to press Tab in the first installation menu, where the installer asks whether it's going to be a graphical or text-mode installation. You can then edit the boot options and add a Kickstart parameter. Here are a few possible scenarios:




    • ks=http://example.org/ks.cfg – Get the Kickstart file from an http address. This is the easiest and simplest way to get started without editing the installation medium. It requires that your server have network connectivity.

    • ks=cdrom:/ks.cfg – This instructs Anaconda to search for the installation file on the cdrom installation media. While it can be handy to have the Kickstart file there, that requires that you rebuild the installation image first. When rebuilding the image you have to copy the Kickstart file inside it. For convenience, you can put the file in the top level directory so that it can be found easily.

    • Booting with BOOTP/DHCP and loading the installation files from NFS is the fastest way to perform an automated install of a large number of installations. With this approach your installation media does not have to be physically placed in each server, and the boot options are automatically acquired. However, setting up a BOOTP/DHCP and NFS server takes some time, which you may not be able to justify for a small number of installations.



Advanced Use



One of the most useful features in Kickstart is its ability to use pre- and post-installation scripts. Consider the previous simple Kickstart file. By default all of its installations will have an IP address of 1.1.1.111, which is obviously not a good practice. Instead, you can ensure that each new installation has a unique IP address by running a post-installation script that takes user input:




#!/bin/sh

#Switch to virtual terminal 3 so that user's input is accepted
chvt 3
exec < /dev/tty3 > /dev/tty3

#Get the input
echo "Please specify IP address:"
read ip

#Substitute with sed the hardcoded IP address with the one we've specified
sed -i "s/1\.1\.1\.111/$ip/" /etc/sysconfig/network-scripts/ifcfg-eth0

#Switch back to virtual terminal 1 for the installation to finish
chvt 1
exec < /dev/tty1 > /dev/tty1



Alternative Methods for Automatic Installations



Kickstart performs an installation in a similar way to a manual one, installing and configuring everything for the server's specific environment. Because of this, its installation process is slower than just copying the files of a Linux system would be.



As an alternative to Kickstart, you can use the files and filesytem image of an operating system in a few possible ways. The simplest option is to use the common Linux program dd:



dd if=/dev/sda of=/media/backup_device/sda_image.img


This command creates an exact image of the sda hard disk to a backup device. Because the dd command works on the byte level, it copies all partition information, along with the master boot record, thus ensuring that you can restore this image (again with dd) on a similar server and have the same server installation there.



You can simplify installations even further in virtual environments. In VMware, for instance, the datastores hold the guest operating system disks as simple files, which means the fastest way to clone a machine is to just copy its datastore directory. You can then create a new virtual machine, specifying for a hard disk the copied vmdk file. For a more sophisticated way of doing this, use the VMware Export / Import template. This feature ensures better compatibility in case you'd like to install the same template on a different VMware server.




This work is licensed under a Creative Commons Attribution 3.0 Unported License
Creative Commons License.


This work is licensed under a Creative Commons Attribution 3.0 Unported License
Creative Commons License.

Comments

Hi, pls let me know is it possible to login as root user automatically by the system once the installation is finished? I dont need to type the password manually.. thnx in advance
Posted @ Friday, October 19, 2012 4:07 AM by vimal
Hi, 
I am making a kickstart file for automatic installation of drivers/packages...for installing, I put the packages in my ftp server and using driverdisk command to retrieve it. It shows a prompt installing from the server but after installing RHEL, I checked for that package but didn't get that packages...my packages are rpm files...plz suggest me some solutions. 
Thank u 
Posted @ Monday, May 20, 2013 7:21 AM by debasish
Hey Anatoliy, 
Appreciative article.Thanks for sharing such an in-depth info.Great!!
Posted @ Tuesday, March 25, 2014 4:31 AM by Jesse Boehm
Great Article ..Really Helped me a lot.......Keep Posting..Thanx
Posted @ Wednesday, September 03, 2014 5:27 AM by Saurabh
true religion jeans men 
ralph lauren 
fitflop outlet 
coach factory outlet 
fitflop footwear 
ralph lauren outlet 
louis vuitton bags 
prada shoes 
louis vuitton handbags 
michael kors bags 
fitflops clearance 
louis vuitton speedy 
cheap jerseys from china 
cheap louis vuitton 
air jordan shoes 
christian louboutin sale 
tory burch flats 
hollister outlet 
red bottom shoes 
louis vuitton outlet store 
fendi purses 
joe abercrombie 
cheap jerseys 
louis vuitton purses 
michael kors outlet 
oakley sunglasses wholesale 
louis vuitton purses 
celine bag price 
louis vuitton belt 
louboutin shoes 
jordan for women 
louis vuitton 
gucci outlet store 
mont blanc pens 
abercrombie 
coach outlet store online 
crossfit workouts 
ab workouts 
ray ban sunglasses wholesale 
louis vuitton shoes 
jordan 13 
coach factory online 
louis vuitton outlet 
coach factory outlet online 
jordans for sale 
burberry scarf 
true religion sale 
kate spade outlet 
oakley sunglasses wholesale 
kate spade handbags 
ray ban sunglasses outlet 
toms outlet 
fitflop footwear 
louis vuitton outlet 
jordan shoes 
tory burch outlet 
michael kors outlet stores 
jordan retro 
toms shoes 
jordan shoes 
louis vuitton 
mont blanc legend 
hollister clothing 
toms sale 
prda outlet 
fitflop outlet 
toms shoes outlet 
celine handbags 
coach factory outlet 
chi flat iron 
juicy couture outlet 
fendi 
toms wedges 
michael kors outlet online 
coach factory online 
coach outlet stores 
louis vuitton belts 
louis vuitton outlet 
ray ban glasses 
louis vuitton sunglasses 
nfl jerseys 
prada bags 
juicy couture perfume 
gucci shoes 
kate spade 
toms shoes 
abercrombie and fitch 
coach factory outlet 
ray ban sunglasses 
bottega veneta bags 
michael kors outlet online 
trye religion outlet 
cheap ray bans 
juicy couture 
michael kors handbags 
louis vuitton wallet 
burberry handbags 
louis vuitton usa 
louis vuitton speedy 
tory burch outlet online 
michael kors handbasg 
p90x workout schedule 
tory burch shoes 
fitflops online 
coach outlet store online 
toms shoes sale 
michael kors backpack 
coach factory online 
hair dryer 
true religion outlet 
chanel online shop 
hermes birkin 
mont blanc fountain pen 
true religion 
fitflop shoes 
gucci handbags 
jordan shoes 
nfl jerseys wholesale 
marc jacobs 
red heels 
chanel handbags 
michaelkors outlet store 
hermes belt 
christian louboutin  
workout plans 
coach outlet 
coach factory outlet 
louis vuitton handbags 
coach factory outlet 
oakley suglasses cheap 
polo ralph lauren 
ray ban outlet 
workout routines 
louis vuitton purses 
louis vuitton handbags 
ray ban aviators 
michael kors handbags 
hollister co 
coach outlet store online 
true religion 
fitflops clearance 
mont blanc pens 
kate spade purses 
christian louboutin outlet 
christian louboutin outlet 
ray bans 
michael kors outlet store 
kate spade factory outlet 
gucci outlet 
oakley sunglasses 
fitflops 
oakley outlet 
kate spade outlet online 
cheap jordans 
red shoes 
red bottoms 
bottega veneta handbags 
chanel bags 
true religion jeans outlet 
jordan sneakers 
official coach factory outlet 
celine paris 
christian louboutin shoes 
louis vuitton purses 
coach outlet 
nfl jerseys 
louis vuitton outlet 
christian louboutin 
celine outlet 
fendi bags 
cheap toms 
hermes bracelet 
coach factory 
michael kors outlet 
burberry bags 
true religion jeans 
louis vuitton officail website 
cheap nfl jerseys 
gucci bags 
michael kors outlet online 
burberry outlet 
true religion outlet 
cheap jordan for sale 
bottega veneta 
true religion jeans 
cheap jordans 
tory burch outlet 
mont blanc legend 
true religion jeans outlet 
michael kors outlet 
viva la juicy 
ray ban wayfarer 
mont blanc mountain 
toms promo code 
nfl football jerseys 
insanity workout 
abercrombie fitch 
louis vuitton outlet 
louis vuitton handbags 
louisvuitton 
tory burch handbags 
hollister promo code 
tory burch outlet online 
fitflop shoes 
true religion jeans 
celine luggage tote 
louis vuitton 
michael kors purses 
hermes outlet 
oakley sunglasses 
ray ban outlet stores 
fitflop sale 
louis vuitton outlet 
louis vuitton handbags 
louis vuitton bags 
michael kors factory outlet 
chanel outlet 
cheap jerseys 
hermes delivery 
michael kors outlet stores 
louis vuitton backpack 
coach factory online 
ray bans 
louis vuitton outlet 
louis vuitton outlet 
tory burch shoes 
louboutin 
ray ban sunglasses 
chi straightener 
coach factory outlet online 
kate spade handbags 
louis vuitton neverfull 
coach outlet 
coach outlet store online 
hair straightener 
coach factory outlet 
kate spade 
marc jacobs handbags 
louis vuitton purses 
coach outlet 
ray ban sunglasses 
cheap ray ban sunglasses 
used louis vuitton 
louis vuitton handbags 
trye religion outlet 
louis vuitton bags 
louis vuitton outlet stores 
louis vuitton uk 
coach outlet 
official coach factory outlet online  
fendi outlet 
louis vuitton outlet 
ray ban outlet 
oakley outlet 
prada handbags 
cheap oakley sunglasses 
toms outlet 
marc jacobs outlet 
louis vuitton wallet 
louis vuitton 
oakley glasses 
kate spade outlet 
louis vuitton  
tory burch flats 
fitflop sandals 
jordan 11 
coach outlet 
hollister kids 
true religion outlet store 
cheap nfljerseys 
ralph lauren home 
coach factory online 
bottega veneta outlet online 
cheap oakleys 
www.louisvuitton.com 
mont blanc fountain pens 
football jersey 
michael kors outlet 
mont blanc pen 
trye religion outlet store 
christian louboutin shoes 
true religion jeans outlet 
christian louboutin sneakers 
michael kors handbags 
mont blanc pen 
louis vuitton outlet stores 
michael kors handbags 
jordan retro 
designer handbags 
louis vuitton outlet store 
coach factory  
coach factory 
fitflop sandals outlet 
bottega veneta outlet 
cheap true religion jeans 
fendi handbags 
kate spade outlet store 
abercrombie and kent 
michael kors outlet 
louis vuitton handbags 
marc by marc jacobs 
chi hair straightener 
true religion jeans 
cheap jordans 
louis vuitton purses 
fitflop outlet 
michael kors outlet online 
polo outlet 
louis vuitton bags 
Posted @ Thursday, September 11, 2014 9:54 PM by dongdong25
<p>Barbour Jackets Outlet, http://www.barbour-factory.com/
 
Coach Factory, http://www.bestcustomsonline.com/
 
Burberry Outlet, http://www.burberry-factory.com/
 
Burberry Factory Outlet, http://www.burberryoutlet2014.com/
 
Prada Outlet Online, http://www.shopbestgoods.com/
 
Gucci Bags Outlet, http://www.gucci-shoesuk2014.com/
 
Kate Spade Outlet Online, http://www.kate-spades.com/
 
Louis Vuitton Outlet Online, http://www.louisvuittonas.com/
 
Marc Jacobs Outlet, http://www.marcjacobsonsale.com/
 
MCM Bags Outlet, http://www.mcmworldwides.com/
 
Cheap Oakley Sunglaases, http://www.oakley-sunglassoutlet.com/
 
Coach Outlet Online, http://www.official-coachoutlet.com/
 
Michael Kors Outlet Online, http://www.official-mkoutlet.com/
 
Prada Outlet Online, http://www.official-pradaoutlet.com/
 
Polo Outlet Store Online, http://www.polo-outlets.com/
 
Nike Air Jordan, http://www.nike-jordanshoes.com/
 
Coach Outlet, http://www.coachlosangeles.com/
 
Polo Outlet Online, http://www.ralph-laurensale.com/
 
Michael Kors Outlet Online, http://www.michaelkors.so/
 
Michael Kors Bags Outlet, http://www.michaelkorsus.com/
 
Michael Kors Black Friday, http://www.michael-korsusa.com/
 
Moncler Jackets Outlet Online, http://www.moncler-clearance.com/
 
Moncler Jackets Black Friday, http://www.moncler-jacketsoutletonline.com/
 
Monster Beats Outlet Online, http://www.monsterbeatsbydres.net/
 
North Face Outlet, http://www.north-faceoutlets.net/
 
North Face Outlet Online, http://www.northsclearance.com/
 
Polo Ralph Lauren, http://www.polo-tshirts.com/
 
Ralph Lauren Polo, http://www.ralphlaurenepolo.com/
 
Polo Outlet, http://www.ralphslauren.co.uk/
 
Hermes Bags Outlet, http://www.hermes-outletonline.com/
 
Louis Vuitton Shoes Outlet, http://www.lv-guccishoesfactory.com/
 
Sacs Longchamp Pas Cher, http://www.salongchamppairs.com/
 
Canada Goose Black Friday, http://www.canada-gooser.com/
 
Cheap Clothes Sale, http://www.cheapdiscountoutlet.com/
 
Coach Black Friday 2014, http://www.coach-blackfriday2014.com/
 
Shop Coach Factory, http://www.coachccoachoutlet.com/
 
Coach Factory Outlet, http://www.coach-factories.net/
 
Coach Outlet Online, http://www.coach-factorysoutletonline.com/
 
Coach Outlet Online, http://www.coach-outletsusa.com/
 
Cheap Coach Purses, http://www.coach-pursesoutletonline.com/
 
Coach Factory Store, http://www.coachsfactoryoutlet.com/
 
Coach Cyber Monday, http://www.coach-storeoutletonline.com/
 
Woolrich Jackets Black Friday, http://www.woolrich-clearance.com/
 
Barbour Jackets Black Friday, http://www.barbour-jacketsoutlet.com/
 
Monster Beats Outlet, http://www.beatsbydreoutlet.net/
 
Coach Purses Store Online, http://www.newoutletonlinemall.com/
 
Black Friday, http://www.misblackfriday.com/
 
Coach Factory Outlet Online, http://www.mischristmas.com/
 
Coach Outlet Online, http://www.zxcoachoutlet.com/
 
Ralph Lauren Black Friday
 
Coach Outlet Black Friday</p>Coach Outlet Black Friday, http://www.shopbestgoods.com/
 
Louis Vuitton Black Friday,http://www.shopbestgoods.com/louis-vuitton-bags-c-1.html
 
Hermes Outlet Black Friday,http://www.shopbestgoods.com/hermes-bags-c-2.html
 
Prada Outlet Black Friday,http://www.shopbestgoods.com/prada-bags-c-3.html
 
Chanel Outlet Black Friday,http://www.shopbestgoods.com/chanel-bags-c-4.html
 
gucci Black Friday,http://www.shopbestgoods.com/gucci-bags-c-5.html
 
Burberry Outlet Black Friday,http://www.shopbestgoods.com/burberry-bags-c-6.html
 
Celine Outlet Black Friday,http://www.shopbestgoods.com/celine-bags-c-7.html
 
Balenciaga Outlet Black Friday,http://www.shopbestgoods.com/balenciaga-bags-c-8.html
 
Christian Dior Outlet Black Friday,http://www.shopbestgoods.com/christian-dior-bags-c-9.html
 
Chloe Outlet Black Friday,http://www.shopbestgoods.com/chloe-bags-c-10.html
 
Bvlgari Outlet Black Friday,http://www.shopbestgoods.com/bvlgari-bags-c-11.html
 
Bally Outlet Black Friday,http://www.shopbestgoods.com/bally-bags-c-12.html
 
Coach Black Friday,http://www.shopbestgoods.com/coach-bags-c-13.html
 
Michael Kors Outlet Black Friday,http://www.shopbestgoods.com/michael-kors-bags-c-14.html
 
MCM Outlet Black Friday,http://www.shopbestgoods.com/mcm-bags-c-15.html
 
Fendi Outlet Black Friday,http://www.shopbestgoods.com/fendi-bags-c-16.html
 
Mulberry Outlet Black Friday,http://www.shopbestgoods.com/mulberry-bags-c-17.html
 
Marc by Marc Jacobs Black Friday,http://www.shopbestgoods.com/marc-jacobs-bags-c-18.html
 
Miu Miu Outlet Black Friday,http://www.shopbestgoods.com/miu-miu-bags-c-19.html
 
Ysl Outlet Black Friday,http://www.shopbestgoods.com/ysl-bags-c-20.html
 
Tory Burch Outlet Black Friday,http://www.shopbestgoods.com/tory-burch-bags-c-21.html
 
Givenchy Outlet Black Friday,http://www.shopbestgoods.com/givenchy-bags-c-22.html
 
Ferragamo Outlet Black Friday,http://www.shopbestgoods.com/ferragamo-bags-c-23.html
 
Michael Kors Factory, http://michaelkorsoutlet.mischristmas.com/
 
MCM Outlet Online, http://mcmbackpack.mischristmas.com/
 
Beats by Dre Outlet, http://monsterbeats.mischristmas.com/
 
North Jackets Outlet Online, http://northfaceoutlet.mischristmas.com/
 
Michael Kors Outlet Online, http://mk.misblackfriday.com/
 
Coach Outlet Online, http://coachoutlet.misblackfriday.com/
 
Coach Factory Outlet, http://coachfactory.misblackfriday.com/
 
Ugg Boots Sale, http://uggaustralia.misblackfriday.com/
 
Cheap Coach Purses, http://coachpurses.misblackfriday.com/
 
Coach Outlet Online USA, http://coachusa.misblackfriday.com/
 
Coach Outlete, http://coach.misblackfriday.com/
 
Michael Kors Black Friday, http://michaelkorss.misblackfriday.com/
 
Michael Kors Outlet, http://michaelkors.misblackfriday.com/
 
Nike Air Max, http://airmax.misblackfriday.com/
 
Michael Kors Sale, http://michael-kors.misblackfriday.com/
Posted @ Friday, October 24, 2014 3:39 AM by polo
Post Comment
Name
 *
Email
 *
Website (optional)
Comment
 *

Allowed tags: <a> link, <b> bold, <i> italics