I'm looking into ways of installing/deploying a VM completely automated (no user interaction). So far I have tried QEMU and virt-install along with QEMU. The issue with qemu is that injecting kickstart file has to be injected manually. On the other hand injecting kickstart file using virt-install is piece of cake, but I cannot use and ISO in that case for installation.

My requirement is to create a VM image using ISO image of the OS, completely automatic. Is there a way to accomplish this without sacrificing the simplicity of the solution.

When I issued the following command installer was downloading content from internet.

    --connect=qemu:///system \
    --network user \
    --name=PathBreaker \
    --disk path=/home/h/pathbreaker.img,format=raw \
    --ram 256 \
    --check-cpu \
    --hvm \
    --arch x86_64 \
    --accelerate \
    --graphics none \
    --extra-args='ks=file:/ks.cfg console=tty0 console=ttyS0,115200n8 serial' \
    --location=/home/h/ubuntu-14.04.1-server-amd64.iso \
    --initrd-inject=/var/tmp/ks.cfg \

And here is my ks.cfg file content

    #System language
    lang en_US
    #Language modules to install
    langsupport en_US
    #System keyboard
    keyboard us
    #System mouse
    #System timezone
    timezone Asia/Kolkata
    #Root password
    rootpw --disabled
    #Initial user
    user h --fullname "harish" --iscrypted --password $1$JmYT2jzn$fyG3gntLTLQbhPFek0SFK1
    #Reboot after installation
    #Use text mode install
    #Install OS instead of upgrade
    #Use CDROM installation media
    #System bootloader configuration
    bootloader --location=mbr 
    #Clear the Master Boot Record
    zerombr yes
    #Partition clearing information
    clearpart --all 
    #Disk partitioning information
    part / --fstype ext4 --size 3700 --grow
    part swap --size 200 
    #System authorization infomation
    auth  --useshadow  --enablemd5 
    #Firewall configuration
    firewall --enabled --ssh 
    #Do not configure the X Window System
  • You could always mount the ISO image somewhere. – Michael Hampton Dec 18 '14 at 3:54
  • Yes I tried that too, but still internet download happens. Which simply means that virt-install or something my argument/.cfg is causing not to pick packages from ISO. – Harish Dec 18 '14 at 4:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.