Create KVM Virtual Machine using Cockpit UI RHEL CentOS 8
Last updated on June 25, 2020 at 04:37 pm
Table of Contents
Advertisements
In this article I will share step by step instructions with screenshots to create KVM Virtual Machine using Cockpit web console in RHEL/CentOS 8 Linux
ALSO READ:
What is Cockpit?
- The RHEL/CentOS web console is an open source project called Cockpit that provides a user-friendly web interface allowing for the remote administration of servers.
- Starting with RHEL/CentOS 7, the cockpit package provides a powerful and extensible web console for system administration.
- You can learn more about cockpit from their official project page
- Cockpit is installed by default on RHEL/CentOS 8, which is why you may see a login message on screen "
Activate the web console with: systemctl enable --now cockpit.socket
" every time you connect to your RHEL/CentOS 8 box.
Pre-requisite
As a pre-requisite, you must first install KVM and enable KVM Virtualization on your Linux server host before you can create KVM Virtual Machine using Cockpit or any other method in RHEL/CentOS 8 Linux
Install Cockpit
- As told earlier, cockpit should be installed by default on your RHEL/CentOS 8 Linux server
- But if not installed, you can manually install it using
dnf
oryum
. I hope you are already aware of YUM alternative DNF tool - We will also need
cockpit-machines
to add a new plugin in cockpit which we will use to create KVM virtual machine using Cockpit
copy
[root@rhel-8 ~]# dnf install -y cockpit cockpit-machines
Below are the cockpit rpm versions used in this article
copy
[root@rhel-8 ~]# rpm -q cockpit cockpit-196.3-1.el8.x86_64 [root@rhel-8 ~]# rpm -q cockpit-machines cockpit-machines-197.3-1.el8.noarch
Enable and start Cockpit
- The cockpit service is handled by cockpit.socket
- So you don't need to worry about cockpit.service (unless it is masked)
- You just need to start and enable cockpit.socket
copy
[root@rhel-8 ~]# systemctl enable cockpit.socket --now
Check the status of the socket
copy
[root@rhel-8 ~]# systemctl status cockpit.socket
● cockpit.socket - Cockpit Web Service Socket
Loaded: loaded (/usr/lib/systemd/system/cockpit.socket; enabled; vendor preset: disabled)
Active: active (listening) since Wed 2020-04-29 01:45:39 IST; 4 days ago
Docs: man:cockpit-ws(8)
Listen: [::]:9090 (Stream)
Tasks: 0 (limit: 26213)
Memory: 2.4M
CGroup: /system.slice/cockpit.socket
- It is possible that
cockpit.service
is dead. This is because currently there are no incoming request for thecockpit.service
- As soon as
cockpit.socket
received a request, it will start the service automatically
copy
[root@rhel-8 ~]# systemctl status cockpit
● cockpit.service - Cockpit Web Service
Loaded: loaded (/usr/lib/systemd/system/cockpit.service; static; vendor preset: disabled)
Active: inactive (dead)
Docs: man:cockpit-ws(8)
Apr 29 01:45:39 rhel-8.example.com systemd[1]: Starting Cockpit Web Service Socket.
Apr 29 01:45:39 rhel-8.example.com systemd[1]: Listening on Cockpit Web Service Socket.
Enable Firewall for Cockpit
By default there should be a rule to allow
cockpit.service
copy
[root@rhel-8 ~]# firewall-cmd --list-services
cockpit dhcpv6-client ssh
But if it is not present you can create a new firewall rule to allow cockpit in
firewalld
copy
# firewall-cmd --add-service=cockpit --permanent # firewall-cmd --reload
Access Cockpit Web Console GUI
After you enable and start cockpit.socket, next you can access your cockpit web console GUI:
Advertisements
Connect using browser
Open browser and in address link put :
http://server-ip:9090
or http://localhost:9090
Connect using CLI
From command line as root or non-root user you can launch
firefox
.
copy
$ firefox server-ip:9090
or
copy
$ firefox localhost:9090
Login as any Linux system user by providing the username and password. Below is the Cockpit web console login screen,
Configure Bridged Network
- You can either configure Bridged Network or any other type of Network which will be used when we create KVM Virtual Machine using Cockpit
- You can create network using nmcli tool, or using ip tool or you can also configure bridged network using Cockpit web console GUI
- In my case I already had created bridged network, but I will share the screenshots from Cockpit web console so you can also create one for your use case
- I already have created
nm-bridge
as my Bridged Interface andvirbr0
which is system's default bridge interface.
Create KVM Virtual Machine using Cockpit
To create KVM Virtual Machine using Cockpit or any other method, it is important that all KVM related rpms and installed and modules are loaded on your Linux server host
On the Cockpit web console, click on "Virtual Machines" from the left panel. If you have not installed
cockpit-machines
then you won't get this option on Cockpit Web Console.
In my case I already have different virtual machines running on my KVM host. You can ignore them for now.
After you click on "Create VM", you will get a pop up screen where you must provide details of your new VM
I had already downloaded CentOS 8 ISO and have kept it under
/tmp
to create KVM Virtual Machine using Cockpit
copy
[root@rhel-8 ~]# ls -l /tmp/CentOS-8.1.1911-x86_64-dvd1.iso
-rw-r--r--. 1 qemu qemu 7554990080 Jan 4 03:17 /tmp/CentOS-8.1.1911-x86_64-dvd1.iso
We will provide the path to this ISO under "Installation Source"
Next provide other details for your VM such as Disk Size, Memory, OS Vendor. At the time of writing this article, CentOS 8 was not shown under list of OS Vendor so I have selected CentOS 7.
Lastly click on Create to create KVM Virtual Machine using Cockpit
In the next step, you will be again on the main section of "Virtual Machines" and a new VM will have been created if all was successful. You can check the VM's details, such as attached Disks, Network Interfaces by selecting the respective TAB menu for the respective VM.
Currently at the time of writing this article, Cockpit does not supports many important features required to manage KVM Virtual Machine. You can get the complete list of missing features between Cockpit Web Console and Virtual Manager from Red Hat's documentation
Alternatively you can also use command line tool virsh to manage and modify KVM Virtual Machine
Next click on Install to start the Installation Process which will automatically re-direct you to the Console of the VM.
You can also click on Consoles to access the console of the VM using VNC. From the drop down menu you can choose to access console using serial console or using
virt-viewer
You can next follow the steps to install your respective OS on the KVM VM
The Virtual Machine which we created using Cockpit will also be accessible using
virt-manager
and virsh
. You can use virt-manager
to manage the Virtual Machine which currently provides more list of features to modify and manage the KVM Virtual Machines
Tidak ada komentar:
Posting Komentar