3

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.

virt-install 
    --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 \
    --os-type=linux
    --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
    mouse
    #System timezone
    timezone Asia/Kolkata
    #Root password
    rootpw --disabled
    #Initial user
    user h --fullname "harish" --iscrypted --password $1$JmYT2jzn$fyG3gntLTLQbhPFek0SFK1
    #Reboot after installation
    reboot
    #Use text mode install
    text
    #Install OS instead of upgrade
    install
    #Use CDROM installation media
    cdrom
    #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
    skipx
2
  • You could always mount the ISO image somewhere. Dec 18, 2014 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, 2014 at 4:09

0

You must log in to answer this question.

Browse other questions tagged .