1. Home
  2. Linux
  3. Create vms on ubuntu server with cockpit

Create VMs on Ubuntu server with Cockpit

Cockpit is an easy-to-use, web-based system for Linux distributions. It enables simple administration, allowing users to do everything from managing disks to creating and deploying KVM virtual machines from a web browser. Here’s how you can use Cockpit to create virtual machines on your Ubuntu server.

How to install Cockpit on Ubuntu

To install Cockpit on Ubuntu, you won’t need to enable any special repositories. However, you will need to get the software from the “backports” repo on Ubuntu. To start the installation on your Ubuntu server, open up a terminal (either by sitting at it physically or via SSH).

Once you’ve loaded up a terminal, use the . /etc/os-release command. Then, run the following apt install command. These commands, when run in succession, will get you going with Cockpit.

. /etc/os-release
sudo apt install -t ${VERSION_CODENAME}-backports cockpit

After entering the two commands above, Ubuntu will ask you for your password. Enter it, then press the Y key on the keyboard to confirm you wish to install Cockpit on your system. The installation should be quick. When it is complete, open the following URL in a web browser.

https://ip-address-of-server:9090

Please note, you may get an SSL warning when loading Cockpit. Access the “Advanced” settings to view the page. This error occurs because an SSL certificate isn’t configured yet on your server. To configure SSL in Cockpit, follow the official instructions.

Install the Cockpit virtual machine plugin

The Cockpit tool, while extremely impressive and feature-filled, doesn’t come pre-installed with the virtual machine plugin. Instead, you’ll need to install it on your Ubuntu server much like you did Cockpit.

To install the Cockpit virtual machine plugin, open up a terminal window on the Ubuntu server. Then, use the following apt install command to install it.

sudo apt install cockpit-machines

After this package is installed, your Cockpit instance will be able to control virtual machines installed using Libvirt. To access the VM section, load Cockpit, and select “Virtual machines” in the sidebar.

How to access Cockpit

To access Cockpit, you’ll need to use your user account on the server. You cannot log in with the root account. Instead, enter your server username and password. When you do, the Cockpit interface will appear.

Upon logging in, you’ll be asked to “authenticate”. Authentication required re-entering your password. However, when you’ve entered the password, you’ll be able to do system-level commands you couldn’t do previously.

How to create virtual machines using Cockpit

To create a virtual machine using Cockpit, start by loading up the app via the URL. Then, log into your user account using the interface. Finally, click on the “Virtual machines” button in the sidebar.

After clicking on the “Virtual machines” button on the sidebar, locate the “Create VM” button. Then, find the “Name” box, and enter the name of the new VM you wish to create with Cockpit. Be sure to label the virtual machine something memorable, so you don’t forget what it is later.

Once you’ve entered your VM’s name, make your way to the “Installation type” area. To download an OS straight from Cockpit, leave “Download an OS.” Alternatively, if you’re an expert, choose one of the other options.

Now that “Download an OS” is selected, find the “Operating system” menu, and click the dropdown menu. Look for the OS you wish to install into the VM and select it. Cockpit supplies quite a lot of operating systems to choose from, like Fedora, Ubuntu, CentOS, Alma Linux, etc.

After choosing your OS, you’ll need to create a new storage volume. Select “Create new volume” to make a new virtual hard drive for your VM. If you’re an expert, feel free to browse for an already-created volume on your Linux server.

Upon selecting the “Create new volume” button, you must specify how large you want the virtual hard drive to be. By default, the drive is 10 GB. 10 GB isn’t enough for a full desktop. Consider making the virtual hard drive 30-45 GB in size.

With the size of the new drive specified, you’ll need to specify the memory allocated to the VM. By default, 1 GB is allocated, however, if you want a responsive VM, you’ll want to supply more RAM. In the “Memory” box, enter 2 GB – 4 GB or more.

When you’ve filled out all information to create your new VM, click on the “Create and run” button. Creation should take a couple of minutes. When it is done, select it in the list of virtual machines to use it.

Once you’ve selected your VM, the Cockpit application will show you the monitor via a VNC connection in the browser. Use this browser to set up your virtual machine.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

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