Manage and configure Virtual Machines

Andrew is a RHEL Sysadmin at Google who is studying to get his LFCS certification:

  • His RHEL Server: Andrew.Mallet.RHEL.Server.013
  • His username:
  • HIs professional preference: a competent RHEL Sysadmin NEVER runs Linux commands as the root user
  • His certifications: CompTIA Linux+
  • His task: Manage and configure Virtual Machines

He is studying the LFCS objective "Manage and configure Virtual Machines". Please generate and explain the commands that Andrew will need to execute to complete this task.

To manage and configure virtual machines on RHEL, Andrew can use various commands and tools. Here are some common commands and steps he may need to execute to complete the task:

  1. Install the required packages:

    • Open a terminal or SSH into the RHEL server as the non-root user (
    • Use the package manager (yum) to install the necessary packages. Depending on the virtualization technology being used, different packages may be required. For example, for KVM (Kernel-based Virtual Machine), he can use the following command:
    • $ sudo yum install qemu-kvm libvirt virt-install
  2. Start the libvirtd service:

    • The libvirtd service allows the management of virtual machines through libvirt.
    • Start the service:
    • $ sudo systemctl start libvirtd
  3. Enable the libvirtd service on system boot:

    • To ensure the libvirtd service starts automatically on system boot:
    • $ sudo systemctl enable libvirtd
  4. Create a virtual machine:

    • Use the virt-install command to create a new virtual machine. Adjust the command as per the requirements and configuration preferences. Here's an example command:
    • $ virt-install \
        --name myvm \
        --ram 2048 \
        --vcpus 2 \
        --disk size=20 \
        --cdrom /path/to/iso_file \
        --network network=default \
        --graphics none \
        --boot cdrom,hd
    • This command creates a virtual machine named "myvm" with 2GB RAM, 2 virtual CPUs, a 20GB disk, using an ISO file for installation, connected to the default network, and configured to boot from the CD-ROM and hard disk.
  5. Start, stop, and manage virtual machines:

    • To start a virtual machine:
    • $ sudo virsh start myvm
    • To stop a virtual machine:
    • $ sudo virsh shutdown myvm
    • To list all running virtual machines:
    • $ sudo virsh list --all
    • To connect to the console of a virtual machine:
    • $ sudo virsh console myvm
  6. Connect to a virtual machine remotely:

    • If Andrew needs to connect to a virtual machine remotely, he can use the virt-viewer command. This requires a graphical environment or an X server running. For example:
    • $ virt-viewer myvm
    • This command opens a graphical console to the "myvm" virtual machine.
  7. Additional management tasks:

    • For more advanced management tasks, Andrew can explore other commands and tools such as virsh, virt-manager, or virt-top depending on his requirements and preferences. These tools provide a wide range of options to manage and configure virtual machines.

It's important to note that the actual commands and steps may vary depending on the virtualization technology being used (such as KVM, VirtualBox, VMware, etc.) and the specific configuration preferences. Andrew should refer to the official documentation or study materials for the LFCS certification to get detailed information and guidance specific to the exam objectives.

You should also read: