Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

trying to figure out how to use the cmdline to do the following:

-create a VM/Image on a centos system -install a centos/rhel os into the VM -install additional apps into the VM -add additional files into specific dirs within the VM

I then want to use the VM to play/run it on a separate server, via the vmplayer app.

I've probably gone through 20-30 different articles on trying to set this up with no luck.

So, if you've got chops on this, let me know! Beer's on me!

Comments/Thoughts/Pointers are all appreciated.

Complete docs/scripts are really appreciated as well!!

thanks

share|improve this question
    
You want to go to all this effort to run VMs in VMWare Workstation? seems a bit long-winded, could you not try it on ESXi or using Xen/KVM? –  Chopper3 Nov 5 '10 at 19:35

2 Answers 2

Well, given that the CentOS installer is both graphical and interactive, you definitely can't do this without creating a Kickstart script for unattended install first. And frankly, if you're going that route, you really might as well just create one VM and clone it. Once you have the VM created, you can use the vmware-mount command to mount the VMDK and copy whatever files you need into it, assuming you're doing this from a Linux host system.

share|improve this answer
    
hi jeff. thanks for the reply. this sounds like an approach that might be on point. however, i'm not at all sure of the steps required to implement this. any articles/pointers/steps you can give me? my goal is to be able to have a complete script that works. –  tom smith Nov 5 '10 at 19:36
1  
This isn't a typical workflow for most people, so you're probably not going to find someone who's automated this. None of the tools are difficult to figure out, so if you just put as much energy into figuring out how the pieces work as you do into finding articles that explain everything step by step, you'll have this working in no time with a better understanding of what you're doing than if you followed a flowchart. –  jgoldschrafe Nov 5 '10 at 20:06

This can be done. Here is how I approached it:

  1. Create empty VMWare VM on a site like easyvmx You can template the VMX file at this point to change names/add versions etc. As far as I know you can't create the vmx files/structure on the command line, so you'll have to use a site like this or clone empty vm's. (This might be possible on the VMWare infrastructure paid for products or with the VIX api for VMWare.)

  2. Create a custom kickstart file. Keep it dead simple just install 1 application in the post section, create 1 user, mkdir it's directory structure and so on.

  3. Create a custom Centos DVD this one worked for me. Point this at your kickstart file or install your kickstart file on the DVD.

  4. Now you are home and dry. Just point the empty VMX created first to boot (after trying the hard disk) from the custom ISO/kickstart you made. It will boot off DVD perform the install and presto you have your ISO.

Be warned. It's a lot of work to get this going on any kind of a sizeable project (mine has 5 products to install, setting up databases etc., I've run through literally thousands of build/boot cycles) Some of the scripts for the programs are very old and only run interactive, I've made heavy use of the wonderful expect program to drive these as if they were running on a terminal with a person typing answers). The other thing I'd recommend is that you use some kind of templating language (I used python's cheetah). This lets you do if/else for/while kind of stuff in the kickstart file and handles things like changing database sizes easily. Some of our dev's want a very small footprint VM and we chop out components for that and resize the DB with a template value.

We use it to deploy new releases of a messaging app to our developers, we can deploy a tested working VM to them when we get a new release within about 4 hours. That's for a normal release of our product. If one of the other packages changes then we have to retool the scripts.

A very basic version of what I built is on code.google.com if you search for kickstart-maker.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.