Using Kickstart to Automate CentOS VM Creation
I’ve done this using CentOS, but I’m pretty sure the same thing will work with RedHat the exact same way.
Virtualization is now a commodity with several free tools available from Sun, VMWare and Xen. If you’re like me, you like to create a new, clean VM for each experiment. However, this comes with a drawback – the installation process, choosing your timezone, putting in the same password every time, etc… takes a while.

Fortunately, CentOS provides the means to automate the process via a kickstart file. The best part is, after you do an install, you’ll have a kickstart file to start working with – it’ll save all your options in /root/anaconda-ks.cfg. You can edit this file later to include other packages that you’d like to install, such as the GCC c++ libraries. You can also run other commands through yum, and customize the system-wide bashrc.
I’m only going to go over how I did the install – for the full details check out the CentOS kickstart guide
I’ve created a minimal kickstart file to do a base install without gnome, printing, and any tools I don’t find useful. I’ve disabled X completely – I have no need to boot to a GUI. I’ve also uncommented the lines to configure the drive settings, so I won’t be prompted for anything along the way; my VM should be completely ready to go once I reboot after the installation. Pretty awesome.
There’s a convenient way to run a kickstart file off a http connection, so I’ve put it the web server on my dev box. My dev box’s IP address is 192.168.1.5, and I copied the modified /root/anaconda-ds.cnf (which I’ve renamed to ks.cfg) to the server. At the installation boot prompt, I’d enter:
linux ks=http://192.168.1.5/ks.cfg
Then let it run. After a bit it’ll ready to reboot and be used. Just make sure to unmount the install DVD.
Obviously this has a lot more uses than just creating VMs, but I’m not a sysadmin, so I haven’t personally used it outside the desktop environment. There’s other tools for different distros, and third party tools for CentOS/RedHat.
For what I’ve done so far, one could argue it’s easier just to create an image of the VM and to just clone that whenever I want a new one. That’s a good solution if I was interested in always creating the same exact VM. However, using the kickstart method has several advantages. I could create a simple web app that generates new configs based on what I’ve checked off in a few lists, allowing me to quickly fire up new VMs with the right software for whatever I’m working on. I can also upgrade the version of the OS and run the same kickstart, so I don’t have to maintain some up to date starting image.
If I’ve made any mistakes, please don’t hesitate to point them out. I’m by no means a guru on the subject, I’ve just wanted to look into this topic for a while.
Some Other Useful resources
Recent Comments
- Anil on MySQL Triggers Tutorial
- Ashish on MySQL Triggers Tutorial
- David on iCal Agenda
- jon on IP address geolocation SQL database
- pim on IP address geolocation SQL database
- jnns on Redis Wildcard Delete
- K.C. Murphy on iCal Agenda
- BA on Experts Exchange should be removed from Google search results
- Andrew on Executing multiple curl requests in parallel with PHP and curl_multi_exec
- Stu on Executing multiple curl requests in parallel with PHP and curl_multi_exec
Recent Posts
- New Project: Jester
- Open New Terminal Tip
- Installing MySQLdb on MacOS Lion
- Headless VM Server Using Ubuntu 11.10
- Get rid of Facebook’s Awful Ticker
- Api Tester now hosted on Github
- Trac .11 jQuery bug
- Multiple Filetypes in Vim
- Git Tip: Setting Up Your Remote Server
- Install issue pymongo on OSX (setuptools out of date)
Categories
- amazon (1)
- answerbag (6)
- apache (9)
- apple (8)
- awk (2)
- bbedit (2)
- c++ (3)
- chrome (2)
- cluster (1)
- cocoa (1)
- collective intelligence (1)
- curl (3)
- db2 (1)
- demand media (1)
- ebay (1)
- eclipse (4)
- erlang (13)
- facebook (1)
- fortran (1)
- gen_server (1)
- git (5)
- google (4)
- haddad (1)
- hdf5 (1)
- html (1)
- innodb (1)
- itunes (1)
- java (2)
- jester (1)
- kvm (1)
- launchbar (1)
- leex (1)
- letsgetnuts.com (1)
- libvirt (1)
- links (6)
- linux (27)
- lucene (1)
- mac (16)
- memcached (1)
- misconception (1)
- mobile (1)
- mono (1)
- mssql (1)
- munin (1)
- mysql (31)
- numpy (1)
- oracle (1)
- php (23)
- puppet (4)
- pyparsing (1)
- pytables (1)
- python (11)
- q&a (1)
- quicksilver (1)
- rant (6)
- readynas (1)
- redis (2)
- regex (1)
- replication (1)
- search (1)
- shitty code (1)
- solr (3)
- spaces (1)
- sshfs (1)
- stored procedure (1)
- svn (5)
- textmate (2)
- tips (22)
- trac (1)
- tutorial (4)
- ubuntu (3)
- Uncategorized (4)
- unix (1)
- vim (3)
- virtual box (6)
- vmware (1)
- weird (3)
- wikipedia (1)
- windows (1)
- xcode (1)







