Managing KVM Virtual Machines with Cockpit Web Console in Linux

Cockpit is a free and open-source front-end tool that provides administrative access to Linux systems. It allows system administrators to monitor, manage, and troubleshoot Linux servers. It provides an intuitive web interface that easy to navigate and keep track of the salient system features and resources.

There’s a whole lot of things you can do with the Cockpit. You can monitor system metrics such as CPU and memory utilization, view system logs, configure networking, check the status of running service, manage user accounts and so much more.

In this guide, we will focus on how you can manage KVM virtual machines with the Cockpit web console in Linux.

Requirements

Before we proceed further, ensure that you have installed the KVM virtualization platform on your Linux system. We have a detailed guide on how to install KVM on CentOS 8 and how to install KVM on Ubuntu 20.04.

Step 1: Install the Cockpit Web Console in Linux

The first task will be to install Cockpit on a Linux server. We will demonstrate how to do so on Debian and Ubuntu systems. We already have an article on how to install Cockpit on CentOS 8 and RHEL 8.

To get started, update your system package lists.

$ sudo apt update

Afterward, install the cockpit console by invoking the command:

$ sudo apt install cockpit

Along with the cockpit, you need to install the cockpit-machines package to help you manage virtual machines.

$ sudo apt install cockpit-machines

Once successfully installed, start Cockpit using the command:

$ sudo systemctl start cockpit

To verify its status, run:

$ sudo systemctl status cockpit

The output below confirms that the cockpit GUI frontend is running as expected.

Check Cockpit Web Status in Ubuntu
Check Cockpit Web Status in Ubuntu

Step 2: Accessing Cockpit Web Console

By default, cockpit listens on TCP port 9090, You can confirm this using the netstat command as shown.

$ sudo netstat -pnltu | grep 9090
Check Cockpit Web Port in Ubuntu
Check Cockpit Web Port in Ubuntu

If you accessing Cockpit remotely and your server is behind the UFW firewall, you need to allow port 9090 on the firewall. To achieve this, run the command:

$ sudo ufw allow 9090/tcp
$ sudo ufw reload

To access the Cockpit interface, open your browser and browse the following address:

https://server-ip:9090

At the login page, provide your user credentials and click the ‘Log In‘ button.

Cockpit Web Console Login
Cockpit Web Console Login

Step 3: Create and Manage KVM Virtual Machines in Cockpit Web Console

To start creating and managing a virtual machine, locate and click the ‘Virtual Machines’ option as shown.

Select Virtual Machines
Select Virtual Machines

On the ‘Virtual Machines’ page, click on the ‘Create New VM’ button.

Create New KVM VM in Cockpit
Create New KVM VM in Cockpit

Be sure to fill out all the details required as shown.

Add New KVM VM Details
Add New KVM VM Details

A detailed explanation of the above options used:

  • Name: This refers to an arbitrary name given to the virtual machine, for example, Fedora-VM.
  • Installation Source type: This can either be a Filesystem or a URL.
  • Installation Source: This is the path of the ISO image to be used during the installation of the Virtual machines.
  • OS vendor – The company/entity that develops and maintains the OS.
  • Operating System – The OS to be installed. Select your OS from the dropdown menu.
  • Memory – The RAM size is either Megabytes or Gigabytes.
  • Storage size – This is the hard disk capacity for the guest OS.
  • Immediately Start VM – If you want to immediately launch the VM upon creation, then simply check the checkbox option. For now, we will leave it unchecked and simply create the VM by clicking the ‘Create’ button.

Once done, your VM will be listed as shown.

New Fedora KVM VM
New Fedora KVM VM

Click on the newly created VM to get an overview of it as shown. To launch the virtual machine, simply click on the ‘Install’ button. This takes you to a black console that shows you the VM booting and will provide the first installation step with various options as shown.

New Fedora VM Booting
New Fedora VM Booting

As the virtual machine boots, let’s briefly have a look at other tabs options. The ‘Overview‘ tab provides basic information about the VM such as Memory size, and no. of vCPUs.

Virtual Machine Overview
Virtual Machine Overview

The ‘Usage’ section offers information about Memory and vCPU usage.

Virtual Machine Usage
Virtual Machine Usage

To view information about the virtual hard disk and the path of the ISO image used to create it, click on the ‘Disks’ tab.

Virtual Machines Disks
Virtual Machines Disks

The ‘Networks’ tab gives insights into the virtual network interfaces attached to the virtual machine.

Virtual Machine Networks
Virtual Machine Networks

Lastly, the console section gives you access to a VM using the Graphics console – thanks to the virt-viewer – or the serial console.

Virtual Machine Web Console
Virtual Machine Web Console

Additionally, you can Restart, Shutdown, or even Delete the virtual machine once done. You can find these options in the far right corner as shown.

Manage Virtual Machines
Manage Virtual Machines
Closing Thoughts

That basically sums up the management of KVM virtual machines using the Cockpit web interface. The cockpit console provides a seamless experience in the management of virtual machines by offering an intuitive and easy-to-use web interface.

Source: redhat.com

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

6 thoughts on “Managing KVM Virtual Machines with Cockpit Web Console in Linux”

    • Hey Christian, sadly, by the time of writing this, Cockpit-machines does not have an option to switch VM’s console to fullscreen mode. We hope that the developers will provide that feature in the not so far future.

      Reply
    • I’m not sure about Apple M!, however, you can install Cockpit on ARM-based Linux platforms such as Ubuntu and Arch Linux.

      Reply

Leave a Reply to Jalal Cancel reply

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.