Installing the course packages
Video 012 of 140 in Virtualization Foundations, in the unit “Setting up your lab machine”. 3:41, with English and Hindi audio.
A lab needs many programs before it can run virtual machines. On Ubuntu, you do not install each one by hand. You install a package, which is a bundle of programs and settings that Linux installs in one step. Ubuntu uses a tool called apt to do this. This article explains what apt does when you ask for a package, and then installs the lab's virtualization packages with four commands.
What you will learn
- A package is a bundle of programs and settings that apt installs in one step.
- A repository is the library on the internet that apt downloads packages from.
- Update the package list first, then install, using sudo for administrator rights.
- The -y flag answers yes to the install questions, so the command does not stop to ask.
- Check which machine you are on before any install, because an install changes that machine.
What apt does when you ask for a package
A repository is a library of packages, kept on a server on the internet. Each repository has a list of the packages it holds and what each one contains. Your machine asks it for packages by name. Ubuntu has its own repositories, and apt knows where they are.
- Update the list: apt fetches what each repository offers.
- Resolve dependencies: apt finds every other package that a package needs before it can run.
- Download: apt fetches every package file.
- Install: apt unpacks the files into their places and runs their setup steps.
All of this happens for you, as long as the machine can reach the repositories on the internet.
How to install the virtualization packages
Start by refreshing the package lists. This reads each repository and updates apt's copy of the list. The word sudo runs the command as the administrator, and the command asks for your password before it goes ahead.
sudo apt updateNext, install the virtualization group. QEMU runs virtual machines, libvirt manages them, and virtinst creates new ones.
sudo apt install -y qemu-system-x86 qemu-utils libvirt-daemon-system virtinstThe next line adds boot firmware, cloud image tools, and the kvm-ok checker that you will use later.
sudo apt install -y ovmf seabios cloud-image-utils guestfs-tools cpu-checkerThe last line adds tools for making a setup disk, and software that provides a security chip for virtual machines.
sudo apt install -y genisoimage swtpm swtpm-toolsWhat to check when apt fails
- A lock message means another install is still running. Wait for it to finish, then run the command again.
- Package not found means the list is out of date. Run apt update first, so the list is fresh.
- Wrong machine: check which machine you are on before any install.
Note: Installing on a production host can change what that host does. Run these installs only on the lab machine.
Install the lab packages
You need sudo rights on the lab machine and a working internet connection. Run the four commands in this order. Each one adds a set of packages to the machine.
Refresh the package lists, so apt works from the latest information in each repository.
sudo apt updateWhat you should see: apt reads each repository and finishes without an error about a package list.
Install the virtualization packages: QEMU runs virtual machines, libvirt manages them, and virtinst creates them.
sudo apt install -y qemu-system-x86 qemu-utils libvirt-daemon-system virtinstWhat you should see: apt downloads and unpacks the packages, and the command returns to the prompt.
Install boot firmware, cloud image tools and the kvm-ok checker.
sudo apt install -y ovmf seabios cloud-image-utils guestfs-tools cpu-checkerWhat you should see: The kvm-ok checker is now installed and ready to test KVM.
Install the setup disk tools and the security chip software.
sudo apt install -y genisoimage swtpm swtpm-toolsWhat you should see: All four install commands are done, and the machine has the lab's core packages.
Terms
- Package
- A bundle of programs and settings that Linux installs in one step.
- Repository
- A server on the internet that stores packages, with a list of what each one contains.
- Dependency
- Another package that a package needs before it can run.
- apt
- The tool on Ubuntu that finds, downloads and installs packages from the repositories.
Check yourself
What is the difference between apt update and apt install?
apt update refreshes the list of what each repository offers. apt install downloads and installs the packages you name.
What does the -y flag do in an apt install command?
It answers yes to the install questions, so the command runs without stopping to ask.
What should you check before running an install?
Which machine you are on, because an install changes that machine, and a production host can behave differently afterwards.
Previous: Installing Ubuntu 24.04 LTS. Next: Is the virtualization stack working?.