vps header 1200x200

2.3 Use Cockpit to Create a VPS

Cockpit is intended to replace Virtual Machine Manager as the primary Linux tool for creating and managing Linux servers. However, while Cockpit is newer than VMM, it does not yet have all of the functions of VMM – which is why we still need to learn how to install and run VMM. However, Cockpit has some tools which VMM does not have. We therefore also need to learn how to use Cockpit. That is the goal of this article.

Unlike Virtual Machine Manager, you will not find Cockpit listed in the Mint Menu Applications. Instead Cockpit works inside of almost any browser. Open a web browser such as Firefox and access Cockpit with this link:

localhost:9090

01r

 

Then check on the x to hide the light blue notices.

Cockpit opens at the Overview page where you can see your CPU usage, memory usage, System Information, Hostname and a side menu with several options.

02r1

The Health box may say 1 service has failed. Click on this blue text to bring up this screen:

02r2

Click on the blue text called console-setup.

02r3

Click Start service. This fix only needs to be done once. On future logins, the console font should start automatically.

Then go back to the Overview screen.

02r4

In the Usage box, click View Details and history:

02r5

Click Install Cockpit-pcp and click Install again. This will install several packages and end with You need to log out to see metrics. Click Log out. Then click Reconnect. Then log in.

Cockpit screens
Let’s take a look at the Cockpit screens. Clicking on Logs brings you to an overview of the various system logs. This can be useful if you’re having issues with a particular program or piece of hardware on a system. Note that most of the log errors are called Britty and are from Bluetooth and can be ignored.

Then click on Storage. You can see how much space you have left on your hard drive.

Then click on Networking. You can see your existing Network Interfaces and network logs. There are also buttons to add a Bond or a Bridge.

03

Click on the eno1 network to see that IPv4 is set to Automatic (DHCP). This means that this network does not have a static IP address.

Click on virbr0 (aka Virtual Bridge 0) to see that it uses a range of IPv4 addresses:

04

Next click on Virtual Machines. Cockpit should pick up the virtual machine we made with VMM. If it does not, then it is likely you did not check the box at log in to Reuse password for privileges tasks.

05

Click on the ns01 virtual machine to see the details:

06

Click on Usage to see the amount of RAM being used and the percent of processing being used:

07

Click on Disks to see that the machine is using 14 GB of 20 GB of storage.

Click on the virtual machine Networks tab to see that network used is virtio.

Click on Consoles to see the Console type. There is also a button to launch a Remote Viewer (which is the Virt Viewer we have already installed). Click Launch Remote Viewer. Firefox will ask what to do. Default selection is Open with Remote Viewer. Click OK.

08

Log into the virtual server on the remote viewer. Then type ip addr to view the ip addresses being used. The remote viewer uses enp1s0 and the IP address 192.168.122.36 which is the same as VMM. Type sudo poweroff to shut down the virtual machine.

09

Click Run to turn the virtual machine back on from Cockpit. Note that VMM now shows ns01 running and the Launch Remote Viewer button has again appeared in Cockpit.

Click on Storage Pools. This is where ISO files are stored. Click on default.

10

The default storage pool uses /var/lib/libvirt/images which is where our virtual machines are stored for both Cockpit and Virt Machine Manager.

11

Then click Accounts.

12

If you see anyone other than you and root here, it is probably a hacker.

Then click on Services. Services show everything running on your host computer and even many things that are not running. Services are divided into five tabs. These are Targets, System Services, Sockets, Times and Paths. The default tab is System Services. Click Targets. Then click Sockets. Then Timers then Paths. If we were using a host laptop with LAMP set up, we would also see Apache server running. Because we have not set up a LAMP server on this Debian 10 laptop, Apache Server is not running and not shown.

Click on Applications. The only application shown is called Machines. Clicking on this application brings us back to Virtual Machines.

Click on Software Updates only if you want to start the software update process.

Then click on Terminal. This brings up the terminal on your host computer. It also has a nice color switcher so we can use a light background on the terminal:

13

Finally, click on the Dashboard which is the other icon in the upper left corner of Cockpit.

14

From the Dashboard you can see usage of CPU, Memory, Network I/O, and Disk I/O. You can also add other servers to this dashboard.

Create a New Virtual Machine
In Cockpit, click on Virtual Machines. Then click Create VM. This complex screen appears:

15

This is where Cockpit is not as good as Virtual Machine Manager. The Installation Source did not bring up my file manager. Instead, it brought up several options, one of which was /home. I then typed in /david. I then typed /Downloads. I then typed /deb where it thankfully found the ISO file name

The default setting for Operating System was Debian Testing. I had to manually change it to Debian 10. The default storage was 10 GB. I had to manually change it to 20 GB.

Then click Create. Then this new virtual machine appears in the Cockpit list:

16

Click Install. This brought up the Debian Install screen. But pressing Enter did not advance to the next screen. I had to change the view to the remote desktop view.

17

Then click Launch Remote Viewer. This brings up the Debian installer in the Remote Viewer window. Pressing Enter brought up select a language. Click Continue. Then Continue. Then Continue. Change the hostname from debian to ns02. For domain name, use dev.test. Skip the root password. Enter your full name and press Continue. Note your username. Click Continue. Enter an easy password twice and click Continue. Choose your Time Zone and click Continue. Choose Guided – use entire disk and click Continue. Then Continue. Then All files in one partition. Then Continue. Then Continue. Then change No to Yes and Continue. The base system will then install. Then leave scan at No and click Continue. Leave Package Manager at US and click Continue. Then Continue. Leave proxy blank and continue. After loading, click continue. For Software Selection, uncheck the desktop and print server and check SSH server. Then click Continue. For Grub, leave it at Yes and click continue. Then change to vda and click Continue. After install complete, click Continue. This closed the Remote Viewer and turned off ns02.

18

Click Run. Then click Launch Remote Viewer. Then click OK. This brings up the log in screen.

Type your username and password. Then type ip addr. The IP address for ns02 is 192.168.122.90.

Then type sudo poweroff. Then enter your password. This will close the remote viewer and turn off ns02.

Monitoring Multiple Real (Non-Virtual) Computers

In addition to monitoring virtual servers, Cockpit can monitor a network of real computers. To monitor another computer, first install Cockpit on the other computer. Then log in to Cockpit on the other computer to verify it’s working. Then log out of Cockpit on the other computer. You don’t need to have the browser interface open on the other computer to remotely monitor it. But the other computer must be turned on.

Also SSH needs to be installed on the other computer , the other computer needs to be connected to the Internet and you need to know the IP address of the other computer Internet Connection. Note that the IP connection for WIFI or a Wireless Connection will be different from the IP address for a Wired Connection.

Use SSH to remotely connect to the other computer from the one on which you’re monitoring it. Confirm you can use SSH on the other computer by opening a terminal on it and typing ssh. Then press Enter.

Also, install SSH server on the other computer.

sudo apt-get install openssh-server

Finally, on the host computer, use SSH to log into the other computer using the IP address along with the other computer username and password or SSH keys.

ssh 192.168.1.43

It worked. My host terminal is now connected to the other computer via SSH. Both say david (at) debian

Did not do this: Remember, if you’re connecting to remote hosts with the same username and password as your monitoring computer, you must select the “Reuse My Password for Remote Connections” box.

Once the ssh connection is established from the host computer terminal, leave the terminal open and log into Cockpit on the host computer, aka the monitoring computer. Then click the drop-down arrow to the right of the host name.

19

Click “Add New Host.”

20

Type the IP address or hostname of the other computer. We will use the wireless IP address. Ideally this should be a static IP address. Click Add. A second screen will appear where you need to enter the password for the other computer. You should now see the remote computer in the list of available hosts.

21

Click the new remote computer to monitor it. Type in its password on the next screen. The name of the host you’re monitoring will be displayed. The color highlight at the top of the browser window will also be the one you selected when you added that host. This is useful because I have two computers with the same username. The host computer uses the blue color and the other computer uses green. I also have one virtual server installed on the other computer and two virtual servers installed on my host computer.

This completes our introduction to Cockpit. Log out of Cockpit and close the browser.

Cockpit Summary
Cockpit has more information than Virtual Machine Manager. But the information is often hidden or displayed in complex and unpredictable screens. We will therefore generally use VMM and only use Cockpit for special functions that are hard to achieve with VMM.

The good news is that we now have two test virtual servers. ns01 was made with VMM and ns02 was made with Cockpit. So we can try experiments with ns01 and if things do not work out, we can delete ns01 and try a different approach with ns02.

One thing I did learn from Cockpit is that Cockpit and Virtual Machine Manager are using Coreboot BIOS with SeaBios to create these virtual machines. This makes the entire virtual machine completely open source. This is a very good feature.

What’s Next?
In the next article, we will review some initial steps with our servers and learn how to connect to them remotely with SSH.