Installing a Fedora VM from Internet

There is a powerful tool shipped with libvirt called virt-install. This tool is inside the python-virtinst package and it allows us to install any GNU/Linux distribution directly from the command line.
For example, the following command will create a VM and install Fedora 17 (32 bits) on it.

virt-install –name f17_i686 –ram 1024 –disk path=/dev/vg_data/f17_i686,size=15 –location=”” –graphics vnc

The arguments are:

name = name of the VM
ram = amount of RAM memory on MB
disk = lthe path and size of the virtual disk
location = the media to install, in this case the F17 URL.
graphics = the graphic card to use

After running this command, we can user virt-manager to continue with the installation process graphically.

How can we automate this task?

There are 2 different ways:

1. Every time you install Fedora, you will find on the /root directory a file called anaconda-ks.cfg. This file can be used to perform an unattended installation equal to the one you have.
You can take that file and modify the parts you need.
2. You can write a kickstart file from scratch.

This kickstart file can be used for any Fedora installation fedora.ks.
You can modify this file and upload it to your own HTTP/FTP/NFS server, leave it on a disk or burn it on a CD.
You can try to install a VM directly using this command:

It will install Fedora 17 x86_64 on a VM on a completely unattended way.
The root password for this VM will be “fedora”.

Leave a Reply

Your email address will not be published. Required fields are marked *