Linux Exercise: Linux as a Virtualization Guest

Downloading a "minimal" installation ISO

On your own laptop, download a "minimal" or "network installation" installation ISO for your favourite Linux distribution. A "minimal" installation ISO is relatively small and only contains the basic packages to get a Linux system up and running. Once that system is up and running, you will use the regular Linux installation tools (such as yum or apt-get) to install additional software.

A partial list of download locations is here:

Please note that the LPI 101 classroom course, for which these exercises were written, uses CentOS by default. If you don't have a strong preference for a distribution (yet), we suggest you use CentOS for this exercise.

Downloading and installing a virtualization environment

If you do not have a virtualization environment on your PC yet, download and install it. Below are some suggestions for virtualization environments:

Performing the installation

Start your virtualization product and use the option to create a new virtual machine. Work through the wizard: Use the default settings for any questions. Make sure you use the previously downloaded ISO as your installation source. Then start the virtual machine.

The VM should boot from the ISO, and continue with the Linux installation program. Again, work your way through this installation program, and accept defaults as far as possible. You will need to set a root password through, and most likely create a user account for yourself. All this should be self-explanatory. At the end of the installation process, reboot your VM. You should now see a login prompt, and should be able to login with your newly created user account.

Virtual devices

  1. Look at the configuration of your CPU. Can you detect you're in a virtualized environment?
    • # cat /proc/cpuinfo
  2. Look at the configuration of your devices. Can you detect you're in a virtualized environment?
    • # lspci -vk

Cloning a VM

  1. Retrieve your D-Bus machine id. Write down at least the first and last four characters somewhere.
    • # cat /etc/machine-id
    • # cat /var/lib/dbus/machine-id
    • # dbus-uuidgen --get
  2. Generate a checksum of your /etc/ssh/ssh_host_*_key* files. Write at least the first and last four charachters of these checksums down somewhere.
    • # md5sum /etc/ssh/ssh_host_*_key*
  3. Retrieve the MAC addres(ses) of your network adapter(s). Write at least the first and last four charachters of these MAC addresses down somewhere.
    • # ip a
      Look for lines that start with link/ether
  4. Reboot your machine. Retrieve your D-Bus machine id and checksums of the /etc/ssh/ssh_host_*_key* files again. Take a look at your MAC addresses again. Did they change?
    • # reboot
    • # cat /etc/machine-id
    • # cat /var/lib/dbus/machine-id
    • # dbus-uuidgen --get
    • # md5sum /etc/ssh/ssh_host_*_key*
    • # ip a
  5. Shut down your machine.
    • # poweroff
  6. In your virtualization software, clone your machine. (In Virtualbox, this is done through Machine; Clone.) Make sure you do NOT check the "Keep hardware UUIDs" checkbox.
    Note that, depending on the size of your virtual hard disk(s), cloning may take several minutes.
  7. Start the clone and login. Look at the machine id, and the checksums of the /etc/ssh/ssh_host_*_key* files. Which have changed?
    • # cat /etc/machine-id
    • # cat /var/lib/dbus/machine-id
    • # dbus-uuidgen --get
    • # md5sum /etc/ssh/ssh_host_*_key*
    • # ip a
  8. Shut down your clone. In your virtualization environment, delete the clone. Make sure you also delete the virtual hard disk, to conserve hard disk space.
    • # poweroff
  9. Start the original Linux VM again.
  10. Login to your original Linux VM. Empty the /etc/machine-id file, and delete the /var/lib/dbus/machine-id and /etc/ssh/ssh_host_*_key* files. Shut down the machine.
    • # truncate -s 0 /etc/machine-id
    • # rm -f /var/lib/dbus/machine-id
    • # rm -f /etc/ssh/ssh_host_*_key*
    • # poweroff
  11. Clone your virtual machine again. Start the clone and look at your machine id and ssh checksums again. Check the MAC address. Did they change this time?
    • # cat /etc/machine-id
    • # cat /var/lib/dbus/machine-id
    • # dbus-uuidgen --get
    • # md5sum /etc/ssh/ssh_host_*_key*
    • # ip a
  12. Shut down your machine.
    • # poweroff
  13. In your virtualization environment, delete the clone again. Make sure you also delete the virtual hard disks, to conserve hard disk space.
End of exercise