Linux Foundations / Start Here

Prepare a disposable Ubuntu practice VM

Lesson 2 of 37. Open to read. No account needed.

Give Practice Its Own Computer

An installer offers to use an entire disk. That choice is appropriate only after you know which disk it means. In this lesson, it must mean the new virtual disk belonging to your practice VM, not a physical disk in your computer.

Your host is the Ubuntu Desktop computer you already use. Your guest is the Ubuntu Server system you will install inside a virtual machine. QEMU/KVM runs that guest; libvirt manages its configuration; virt-manager provides the graphical controls and local guest console.

The guest's disk is a file on the host. You will create one new, standalone qcow2 disk image, a virtual-disk file format. “Standalone” means it does not depend on another disk image as a backing file. The guest can change the contents of its own disk during practice. A host directory shared into the guest would cross that boundary, so this setup includes no shared folders or attached physical host disks.

The Ubuntu Desktop host runs libvirt and QEMU/KVM, with a local virt-manager console controlling the Ubuntu Server guest vecta-lab-linux. The guest uses one new standalone qcow2 virtual disk. Default NAT provides outbound access; host-shared folders, physical host disks, added port forwards and externally exposed display access are absent.

Read the host and guest boundaries before the arrows. The virtual disk file belongs to the host's course VM resources, while the guest sees a virtual device. The outbound network path is separate from a shared folder or an inbound forwarding rule; this course does not add either of those paths.

Exercise: Install the Course Guest

Goal: create and identify one disposable Ubuntu guest, reach its local login console, and keep a clear record of its image and virtual disk.

Starting state: an Ubuntu Desktop 24.04 LTS amd64/x86_64 host, a normal host account, permission to administer that computer for this setup, and permitted Intel/AMD hardware virtualization. You need a browser, internet access to the official image/key/repository services, and enough host capacity for its own work, the guest and a later separate disk backup. This is the selected host route; do not run these host commands on Windows, macOS, inside an unrelated guest, or at a root-account shell.

The guest allocation is 2 virtual CPUs, 4 GiB memory and a 25 GiB virtual disk. It is a course planning choice, not a vendor minimum or a measured fit guarantee. A virtual CPU is CPU capacity assigned to the guest, and GiB is the capacity unit used here. The host still needs resources for itself. A qcow2 file can grow as the guest writes data; reserve capacity rather than assuming its initially small host-file size is its final requirement.

Inputs: the official Ubuntu Server 24.04 amd64 ISO image, its SHA256SUMS and SHA256SUMS.gpg files from the same release directory, the official signing-key fingerprint, and the fixed course VM name vecta-lab-linux. An ISO is the installation image used as a virtual installation disc. A checksum is a value calculated from a file; a signature lets you verify who signed the checksum list.

Effects: this lesson installs the named host virtualization tools and their dependencies, may add your host account to the libvirt group, starts the selected default virtual network if needed, imports an Ubuntu public signing key into your host account's keyring, and creates the named downloads, VM and virtual disk. These are explicit host setup changes. Later ordinary file exercises use the guest and do not need these host privileges.

Run each command line separately. Stop at an unexpected error and read its whole message before continuing. Installation and downloads can take time; they are not a timed task.

1. Host: Identify the Computer and Account

Open Terminal from the Ubuntu Desktop application menu. The shell's prompt indicates that it is ready for a command. Type or paste the command only, press Enter, and wait for the next prompt. Output is the response, not another command to enter.

cat displays a file. The leading slash in /etc/os-release identifies a path starting at the system's filesystem root; that file describes this host OS. uname -m reports the architecture. id -u reports the numeric user ID, and id -un reports the account name.

The following commands only read information:

cat /etc/os-release
uname -m
id -u
id -un

Confirm Ubuntu 24.04 and x86_64. Your numeric ID must be nonzero; 0 means the root administrator account. Use your normal permitted host account instead. Record the actual account name privately for the possible group membership step. Do not assume an illustrative username is your own.

2. Host: Install the Virtualization Tools

sudo runs the following command with administrator authority when your account is permitted to do so. It may ask for your host account's password; the terminal normally does not display characters as you enter it. Type it privately, not into a lesson note or chat. A denied request is a permission condition to resolve with the computer's administrator.

apt manages Ubuntu packages. update refreshes information about available packages; it does not upgrade the whole computer. install requests the named tools and their dependencies. Read its proposed changes and confirmation prompt before accepting.

sudo apt update
sudo apt install cpu-checker qemu-kvm qemu-utils libvirt-daemon-system virt-manager gnupg

cpu-checker supplies the virtualization check below. QEMU/KVM and the libvirt system service run and manage the VM; virt-manager supplies its graphical interface. qemu-utils supplies the qemu-img disk-information tool used below. GnuPG supplies the gpg signature-verification tool. Already-installed packages may need no change. Do not remove other packages or alter repositories to work around an unexplained error.

kvm-ok checks KVM hardware-acceleration availability.

kvm-ok

Continue only when the host reports that KVM acceleration can be used. If virtualization is unavailable or disabled, stop and use the documented host/firmware guidance with the administrator's permission. A slower or nested substitute is not silently the same selected setup.

Check the host account's groups. id -nG prints their names:

id -nG

On Ubuntu, an administrator account may already belong to libvirt. If that group is present, do not add it again. If absent and the administrator permits this access, the Ubuntu libvirt setup uses the following pattern. Replace ACTUAL_HOST_USER with the account name printed by id -un; do not type the placeholder literally.

In this two-name form, adduser adds an existing account to the named group; it is not an instruction to create another learner account.

sudo adduser ACTUAL_HOST_USER libvirt

Libvirt membership permits management of system VMs, so it is a meaningful host permission. Sign out of the desktop session and sign back in for new group membership to take effect. Reopen Terminal and check id -nG again.

3. Host: Download the Image and Its Verification Files

Use a dedicated new download directory. ~ means the current account's home directory. mkdir creates a directory; cd enters it; pwd prints your current full path; ls -a lists its entries, including hidden names. The usual . and .. entries mean this directory and its parent.

mkdir ~/vecta-linux-vm-downloads

If that name already exists, stop and inspect it. Resume a recognized earlier attempt; do not mix fresh downloads into an unknown directory.

cd ~/vecta-linux-vm-downloads
pwd
ls -a

Open the official Ubuntu 24.04 release directory in your browser. Save the live-server amd64 ISO, SHA256SUMS and SHA256SUMS.gpg from that same directory into this folder. Do not select the desktop image, a different architecture or a torrent/ISO-link metadata file in place of the ISO.

The directory's point-release filename can change. For example, the published server image at the time this walkthrough was prepared was ubuntu-24.04.5-live-server-amd64.iso. Use the exact server amd64 filename currently provided in the official directory and keep all three downloaded files together. Record that exact name.

4. Host: Verify the Signature, Then the ISO

Obtain the signing fingerprint from the official Ubuntu verification instructions, not from an error message or an arbitrary download page. The Ubuntu CD image signing key used here has this full fingerprint:

8439 38DF 228D 22F7 B374 2BC0 D94A A3F0 EFE2 1092

If the official instructions change the key, reconcile that change before continuing; do not accept a different fingerprint just because a server returned it.

gpg handles public-key signatures. The first command obtains the specified public key over the named encrypted keyserver connection. The second prints its full fingerprint for comparison. These commands use your normal host account's GnuPG keyring and may create its .gnupg directory; they do not create a personal signing identity for you.

gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 843938DF228D22F7B3742BC0D94AA3F0EFE21092
gpg --fingerprint 843938DF228D22F7B3742BC0D94AA3F0EFE21092

Compare all fingerprint characters, ignoring only the displayed grouping spaces. Then, still in the download directory, verify the detached signature:

gpg --verify SHA256SUMS.gpg SHA256SUMS

The first file is the signature and the second is the checksum list it signs. Require a good signature from the expected signing key. A warning that you have not personally certified the key's owner is different from a bad signature; the independently checked official fingerprint is essential. Do not proceed after a bad signature, a missing public key, a fingerprint mismatch or an unresolved verification error, including an additional signature that cannot be checked. Do not select one reassuring line while ignoring an error elsewhere in the result.

Only after that signature check, display the authenticated checksum list:

cat SHA256SUMS

Find the entry naming your exact downloaded server ISO. Calculate that ISO's checksum. The following uses the example filename above; replace only the filename if the official directory supplied a different point release.

sha256sum reads the ISO and prints its SHA-256 value followed by its name.

sha256sum ubuntu-24.04.5-live-server-amd64.iso

Compare the complete value with the entry for that same filename in the verified list. It must match exactly. A matching checksum from an unauthenticated list would not establish the image's source.

Record the ISO filename, full matching checksum, signing fingerprint and actual signature result. If anything differs, stop: check names, download completion and whether all files came from the same release directory. Never change the expected checksum to match a suspect image.

Host: Place the Verified ISO in the System Image Pool

The system VM service may not be allowed to read a file inside your private home directory. Do not solve this by making your home directory accessible to other accounts. Instead, give the service its own copy of this public, verified installation image.

Open Virtual Machine Manager and the local QEMU/KVM connection's details. In Storage, inspect the default local directory pool. The following commands use its usual target, /var/lib/libvirt/images; confirm that directory in the pool details before using it. If the pool is missing or points somewhere unexpected, resolve the libvirt storage setup first.

In the host Terminal, remain in your owned download directory. cp copies the first path to the second and preserves the source. -iT combines interactive overwrite checking (-i) with an exact file destination (-T): an existing directory is rejected rather than used as a place to put the copy. -- ends options so the following arguments are paths. The destination is a new, specifically named course ISO copy:

pwd
sudo cp -iT -- ubuntu-24.04.5-live-server-amd64.iso /var/lib/libvirt/images/vecta-lab-linux-install.iso

Replace the example source filename with your exact verified ISO name if it differs. If the destination already exists and cp asks to overwrite it, answer n and stop to inspect ownership; do not overwrite an unfamiliar file. Continue below only after this command created the new owned ISO copy without an error or an overwrite.

chmod sets access permissions. Here, 0644 means the owner can read and write, and other accounts can read but cannot write or execute the file. It is appropriate for this public installation image, not a rule for private files. Apply it only to the newly created course ISO, then calculate that copy's checksum:

sudo chmod 0644 /var/lib/libvirt/images/vecta-lab-linux-install.iso
sudo sha256sum /var/lib/libvirt/images/vecta-lab-linux-install.iso

The complete checksum must match the authenticated value you recorded for the downloaded image. Use this verified system-pool copy as the VM's installation media. Record its path as well as the original release filename. This changes one public ISO's permissions, not those of your home directory.

5. Host: Check the Local Libvirt Connection

virsh is libvirt's command-line inspection/control tool. -c selects a connection; qemu:///system names this host's local system VM service, not a remote internet address. list --all includes stopped VMs.

virsh -c qemu:///system list --all

If vecta-lab-linux already exists, do not create another over it. Inspect a recognized earlier attempt in virt-manager or resolve ownership first. An access error means the host service/account setup needs attention; do not switch the exercise into a root shell.

Inspect virtual networks:

virsh -c qemu:///system net-list --all

The expected network name is default, but its name does not prove its mode. Inspect its actual configuration before using or starting it:

net-dumpxml displays the named network's structured configuration without changing it.

virsh -c qemu:///system net-dumpxml default

Find the forward element and confirm that its mode is nat. Do not run or edit the displayed configuration. NAT gives the guest a private virtual network with outbound access through the host. This setup does not add an inbound forwarding rule. If the mode differs, stop and resolve the selected default-network setup.

If the named default network exists but is inactive, start only that network:

net-start activates the named virtual network.

virsh -c qemu:///system net-start default
virsh -c qemu:///system net-list --all

Confirm its active state. If the network is missing or has an unfamiliar definition, stop and use the Ubuntu libvirt setup guidance rather than inventing a network, disabling a firewall or changing host routes/DNS.

6. Host: Create the VM and Review Hardware Before Installation

Open Virtual Machine Manager from the application menu. Select the local QEMU/KVM system connection corresponding to qemu:///system. Use the new-VM wizard and select local installation media / ISO. Browse to /var/lib/libvirt/images/vecta-lab-linux-install.iso, the verified system-pool copy, rather than the private-home download. Automatic OS detection should identify the Ubuntu family. Confirm Ubuntu 24.04 when selecting the OS manually.

Set memory to 4096 MiB and CPUs to 2. For storage, use the custom-storage chooser to create a new volume in the local default image pool. Choose the name vecta-lab-linux.qcow2, format qcow2, and capacity 25 GiB. Do not select an existing image or a physical block device. If the name already exists, cancel and inspect it rather than reusing it.

The usual default-pool path is /var/lib/libvirt/images/vecta-lab-linux.qcow2. Record the actual new volume's full source path from the chooser. Do not assume that a matching filename in another location is the same disk.

Name the VM vecta-lab-linux, select the default NAT network, and select Customize configuration before install. Finish the wizard into the hardware-review window; do not begin installation until these checks agree:

Hardware itemRequired setting
Name and connectionvecta-lab-linux on local qemu:///system
FirmwareBIOS; this course setup does not use UEFI/NVRAM
CPUs / memory2 virtual CPUs / 4096 MiB
Writable diskExactly the newly created 25 GiB standalone qcow2 volume
Installation CD-ROMThe verified Ubuntu Server amd64 ISO
NetworkThe host's default NAT virtual network; no course-created port forwards
DisplayLocal virt-manager console; do not expose VNC or another display listener to other computers
Filesystem / host devicesNo shared host folder and no attached physical host disk

Use the Overview and device-detail panels to inspect these items. If the required BIOS choice or other setting is unavailable, stop and resolve the selected-host configuration; do not silently change the baseline.

Check the new disk image while the VM is still stopped. qemu-img info reads image metadata; host sudo may be needed to read the system image pool. The example below uses the usual pool path. Substitute the exact recorded new disk path if different, keeping it quoted.

sudo qemu-img info '/var/lib/libvirt/images/vecta-lab-linux.qcow2'

Confirm qcow2, a virtual size of 25 GiB, and no backing-file entry. A backing file would mean this image depends on another image; this lesson requires a new standalone disk. Host-file allocation can be smaller than its virtual size. Do not run image-editing commands or inspect an in-use image as a substitute for these pre-install checks.

7. Guest: Install Only onto That Virtual Disk

In the reviewed VM window, choose Begin Installation. From this point the installer and its terminal belong to the guest, not the host terminal. Keep the VM name visible so you can identify the window.

Before accepting any installer storage choice, return to the host Terminal and inspect the now-defined VM's disk mapping:

domblklist lists this VM's storage devices; --inactive reads its defined configuration and --details includes device type.

virsh -c qemu:///system domblklist vecta-lab-linux --inactive --details

There should be one writable disk image plus the installation CD-ROM. The disk's Source must be the new volume you recorded. A guest target name such as vda is not the host source path. If the VM cannot be found or the mapping differs, stop before the storage confirmation and inspect the local connection and named VM; do not guess a disk. Return to the identified guest console after this check.

Follow the Ubuntu Server installer, reading each confirmation:

  1. Select your language and keyboard. Use Ubuntu Server, the standard non-minimized installation, rather than the minimized choice.
  2. Use the guest interface supplied by default NAT and its automatic network configuration. Keep the official Ubuntu mirror. Leave an optional proxy blank unless your permitted network requires a known proxy supplied by its administrator; do not guess a replacement service.
  3. At storage, choose guided use of the entire disk only after its size and identity match the newly created 25 GiB virtual disk. Use the simple unencrypted layout; leave the optional LVM-group setup unselected. You are not configuring physical disks, encryption or an advanced layout.
  4. Review the storage summary and destructive confirmation. The installer will write the selected guest disk. Cancel if it shows an unexpected disk, unexpected capacity, physical-device attachment or unclear target.
  5. Create your normal guest account and choose its password privately. The installer-created initial account can use sudo for explicitly privileged guest tasks later; use it normally for ordinary file work. Use vecta-lab-linux as the guest's machine name. Keep the account/password available to yourself; do not copy the password into your evidence notes.
  6. Skip optional Ubuntu Pro attachment, OpenSSH-server installation and optional featured snaps for this course setup. No external account or remotely accessible service is required for the lesson.
  7. Allow installation to finish and choose the installer's reboot action. If asked to remove installation media, disconnect/eject this VM's ISO from its virtual CD-ROM in virt-manager, then follow the prompt. Do not delete the disk or detach a host device.

Screen labels can vary with installer updates. Use the official Ubuntu installer screen reference when a screen needs explanation, while preserving the choices and boundaries above. An unfamiliar storage choice is a reason to pause before confirming.

8. Guest: Log In and Record the Result

After reboot, use the local VM console to log in with the guest account you created. A password prompt normally displays no characters while you type. You should reach the guest shell prompt.

These familiar read-only commands now run inside the guest:

cat /etc/os-release
uname -m
id -u
id -un

Confirm Ubuntu 24.04, x86_64, a nonzero numeric user ID and the intended guest account. Host and guest may report the same OS family, so these lines do not replace checking the named VM window and its hardware mapping.

Success: keep a small record of the VM name and connection, verified ISO filename/checksum/signing fingerprint, disk source path and format, virtual capacity, BIOS, CPUs/memory, network choice and actual guest login result. Your local guest account works and you can identify its one owned disk. This record establishes installation and identity; the following lesson teaches fuller guest readiness and a stopped-state recovery procedure.

If Something Differs

What you observeSafe next step
Host identity, architecture or account differsStop and return to the selected host route; do not adapt commands blindly
Package installation or sudo is deniedResolve the host's permitted setup with its administrator; do not change unrelated permissions
kvm-ok cannot use accelerationCheck the approved host's virtualization readiness; do not claim a different route is equivalent
Signature/key/checksum errorPreserve the message, recheck the official fingerprint and matching release files; do not boot the ISO
Libvirt connection denied after adding the groupSign out/in, inspect actual groups and the system connection; do not start a root-account course session
Missing/inactive or unfamiliar networkInspect the default network; start only a recognized inactive default; do not disable the host firewall
Existing VM or disk nameInspect a recognized owned attempt; preserve an unknown resource rather than reuse it
Installer shows unexpected storageCancel the storage action and inspect the VM's actual disk source and capacity
Installer starts again after rebootCheck the VM's virtual CD-ROM/boot choice; do not reinstall over a completed guest just to reach its login
Guest cannot log inCheck that this is the named guest and the account you created; do not post or reset a host password

Independent Task: Review the Boundary

Before looking at the answer, decide which proposed configuration matches this course and identify the specific problems in the others.

CandidateConfiguration
AA physical host disk is attached directly; the guest also sees the host Documents folder; a host port forwards to guest SSH
Bvecta-lab-linux uses its new standalone 25 GiB qcow2 disk, BIOS, 2 CPUs, 4096 MiB, default NAT and the local console, with no host shares or added forwarding
CA disk named vecta-lab-linux.qcow2 depends on another base image; firmware is UEFI with a separate NVRAM file

Then inspect your own VM, using the already taught hardware panels and recorded mapping. Explain which observations support the boundary; a file extension or a VM name alone is not enough. Do not alter another VM to create one of the unsafe examples. Retain your actual configuration record.

Hints

  1. Separate a virtual disk image from a directly attached physical disk.
  2. Look for paths that let the guest affect host files or invite inbound access that the course does not need.
  3. Check both disk independence and firmware, not only the filename.

Check Your Understanding

  1. Why does a shared host folder weaken the intended practice boundary?
  2. Why verify the signature on SHA256SUMS before comparing the ISO checksum?
  3. What must “entire disk” mean before you accept the guest installer's storage confirmation?
  4. Are the 2-CPU, 4-GiB and 25-GiB values vendor minimum requirements?
  5. Does reaching the guest prompt demonstrate that you have tested its recovery procedure?

Answer and Reasoning

Candidate B follows the selected configuration. A directly attached physical disk and a shared Documents folder in A expose host resources to guest actions. Its forwarding also adds inbound access that this local-console lesson does not need. C has a backing-image dependency and separate firmware state, rather than the standalone BIOS disk arrangement selected for the later recovery procedure.

Your own record should connect the VM's name to its actual defined disk source, the new image's metadata, the reviewed hardware and the guest login. Identical-looking filenames in different locations do not establish that connection. If your inspection differs, preserve the observation and resolve it before proceeding to later practice.

  1. The guest could change files deliberately made visible from the host. A VM does not turn those shared files into disposable guest-only data.
  2. A checksum matches bytes to the supplied list. Verifying that list's signature against the independently checked Ubuntu key establishes which list you should trust before using its value.
  3. It must mean the identified new course virtual disk inside the named VM. Confirm its mapping and capacity; do not infer safety from the installer window's appearance or a device name alone.
  4. No. They are a course allocation proposal. The host must still support itself, the running VM and the planned working/backup storage.
  5. No. Installation/login and recovery are different observations. Retain the guest for the next lesson's readiness and explicit recovery work.

Keep, Pause or Resume the Setup

Keep the VM and its disk for the next lesson. Keep the verified ISO and its verified system-pool copy and verification record as setup inputs. Preserve shared virtualization packages, existing host VMs and your account's keyring; do not uninstall tools or delete the GnuPG directory as routine lesson cleanup.

To pause after a successful installation, use virt-manager's normal Shut Down action and wait for its state to show Shut off. This requests an orderly guest shutdown. Pause, forced power-off and managed-save are different states; do not treat them as the stopped state needed for the later disk backup. Starting the same retained VM resumes ordinary use.

If a download was interrupted, finish or repeat that download into the owned folder and repeat verification. If VM creation stopped, inspect its current definition and disk before restarting the wizard. If installation stopped before a usable system exists, restart it only in the identified owned VM against that same disposable virtual disk. Confirm that you have no intended guest work to preserve before repeating a storage-writing installer step.

Do not delete the VM to demonstrate cleanup. Eventual removal is a separate decision after preserving intended work and identifying the exact owned disk. No disk copy, snapshot or restore is performed by this lesson; the next lesson supplies that procedure.

References

Study this course with an account

Course access adds revision notes, the Quick Reference, saved progress, bookmarks and your own notes.

INR 99 plus 18% GST. 90 days of online access. No auto-renewal.

See course access

This website is operated by VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED, operating as Vectametric.

Corporate Identity Number (CIN): U85499KA2026OPC229822. GSTIN: 29AAMCV8281D1ZS. Registered office: RS NO/38/2A/1 BASTAND, ROAD MAHANTESH NAGAR, Ramdurg, Ramdurg, Belgaum- 591123, Karnataka.

Queries and grievances: Prajval Honnungar, Grievance Officer and Data Protection Contact.

Telephone: +91 94800 09310. Support: support@vectametric.com. Grievances: support@vectametric.com.

Copyright 2026 VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED. All rights reserved.

Vectametric home · Roadmaps · Vecta IT Exams · Vecta Government Exams · Vecta Banking & Finance Exams · Vecta Entrance Exams · About us · Contact · Privacy Policy · Terms and Conditions · No-Refund Policy