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=”http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Fedora/i386/os/” –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:
virt-install --name f17_x86_64 --ram 1024 --disk path=/dev/vg_data/f17_x86_64,size=15 --location="http://dl.fedoraproject.org/pub/fedora/linux/releases/17/Fedora/x86_64/os/" --extra-args "ks=http://mkreder.com/vms/ks/fedora.ks console=ttyS0,9600"
#you should modify the ram and disk arguments as needed
It will install Fedora 17 x86_64 on a VM on a completely unattended way.
The root password for this VM will be “fedora”.
I remember like if it was today the first time I installed Linux in my computer. I was 12 years ago and I bought a magazine, from Spain, that came with the CD of Red Hat 6.1.
I completely destroyed my partition table with Disk Druid, that I don’t know how could recover later. Once the installation was complete, several days after the issue, I started to fight with my monitor to use 1024 x 768, the only way was using a very low horizontal frequency between 50-60 Hz, but I had to fight with Vertical frequency as well to get it working. Once working as the frequency was low it wasn’t really good for my eyes but it looked nice for screenshots. I used to take lots of screenshots that I have to find some day to post them.
These were recently taken from my VM:
I’m sharing this VM with the world, I’m planning to start uploading VM’s of old Linux distributions, so everyone can see how GNU/Linux was 10 years ago or maybe when it started.
How to install it?
# wget http://mkreder.com/vms/redhat/6.2/redhat62.xml -O /etc/libvirt/qemu/redhat62.xml
# wget http://mkreder.com/vms/redhat/6.2/redhat62.img.gz -O /var/lib/libvirt/images/redhat62.img.gz
# gzip -d /var/lib/libvirt/images/redhat62.img.gz
# restorecon -R /etc/libvirt/qemu/
# restorecon -R /var/lib/libvirt/images
Some days ago I felt some nostalgic feelings and I tried to install a red hat 6.2 version into a fedora 14 host.
The installation was painfully slow, but it was completed successfully anyway. The problem is that after booting the new (not really) redhat 6..2, I got a kernel panic with the following message:
“Kernel panic: Kernel compiled for Pentium+, requires TSC”
after googling that, I found that one of the solutions would be recompile the old linux kernel with the option “Unsynced TSC support”, I’m to lazy to do that just for fun, I would do it if I have no choice, but I have some doubts, why the kernel in the installation cd is not failing? and, is it because my computer has an AMD processor?