Differences between revisions 1 and 62 (spanning 61 versions)
Revision 1 as of 2021-07-01 04:24:29
Size: 67
Editor: ThomasChung
Comment: new howto
Revision 62 as of 2021-08-09 06:19:57
Size: 8722
Editor: ThomasChung
Comment: add categories
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:

{{{#!wiki note
'''debian''' is your physical machine running Debian 10 where you'll install Web Console with Virtual Machines

'''vm1 ''' is your virtual machine where you'll install Debian 10 but you can install any distro (even Windows)
}}}

<<TableOfContents>>

== Install Web Console with Virtual Machines ==
{{{
debian>$ echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee -a /etc/apt/sources.list.d/backports.list
debian>$ sudo apt update
debian>$ sudo apt install -t buster-backports cockpit cockpit-machines
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  augeas-lenses cockpit-bridge cockpit-networkmanager cockpit-packagekit cockpit-storaged cockpit-system cockpit-ws
  dmeventd exim4-base exim4-config exim4-daemon-light genisoimage gir1.2-libosinfo-1.0 ibverbs-providers ipxe-qemu
  libaio1 libaugeas0 libblockdev-mdraid2 libbytesize1 libcapstone4 libdaxctl1 libdevmapper-event1.02.1 libfdt1
  libgfapi0 libgfrpc0 libgfxdr0 libglusterfs0 libgnutls-dane0 libgovirt-common libgovirt2 libgsasl7 libibverbs1
  libiscsi7 libkyotocabinet16v5 liblvm2cmd2.03 liblzo2-2 libmailutils5 libndctl6 libnetcf1 libntlm0 libpmem1
  libpwquality-tools librados2 librbd1 librdmacm1 libreadline5 libslirp0 libspice-server1 libssh-4 libtirpc-common
  libtirpc3 libunbound8 liburcu6 liburing1 libvdeplug2 libvirglrenderer0 libvirt-clients libvirt-daemon
  libvirt-daemon-system libvirt-dbus libvirt-glib-1.0-0 libvirt0 libxencall1 libxendevicemodel1 libxenevtchn1
  libxenforeignmemory1 libxengnttab1 libxenmisc4.11 libxenstore3.0 libxentoolcore1 libxentoollog1 libxml2-utils lvm2
  mailutils mailutils-common mdadm netcat-openbsd ovmf python3-distutils python3-lib2to3 python3-libvirt
  python3-libxml2 qemu-block-extra qemu-system-common qemu-system-data qemu-system-gui qemu-system-x86 qemu-utils
  seabios sysuser-helper thin-provisioning-tools virt-viewer virtinst
Suggested packages:
  augeas-doc cockpit-doc cockpit-pcp sssd-dbus exim4-doc-html | exim4-doc-info eximon4 spf-tools-perl swaks wodim
  cdrkit-doc augeas-tools libvirt-daemon-driver-storage-gluster libvirt-daemon-driver-storage-rbd
  libvirt-daemon-driver-storage-zfs numad auditd nfs-common open-iscsi pm-utils radvd systemtap zfsutils mailutils-mh
  mailutils-doc dracut-core samba vde2 debootstrap
The following NEW packages will be installed:
  augeas-lenses cockpit cockpit-bridge cockpit-machines cockpit-networkmanager cockpit-packagekit cockpit-storaged
  cockpit-system cockpit-ws dmeventd exim4-base exim4-config exim4-daemon-light genisoimage gir1.2-libosinfo-1.0
  ibverbs-providers ipxe-qemu libaio1 libaugeas0 libblockdev-mdraid2 libbytesize1 libcapstone4 libdaxctl1
  libdevmapper-event1.02.1 libfdt1 libgfapi0 libgfrpc0 libgfxdr0 libglusterfs0 libgnutls-dane0 libgovirt-common
  libgovirt2 libgsasl7 libibverbs1 libiscsi7 libkyotocabinet16v5 liblvm2cmd2.03 liblzo2-2 libmailutils5 libndctl6
  libnetcf1 libntlm0 libpmem1 libpwquality-tools librados2 librbd1 librdmacm1 libreadline5 libslirp0 libspice-server1
  libssh-4 libtirpc-common libtirpc3 libunbound8 liburcu6 liburing1 libvdeplug2 libvirglrenderer0 libvirt-clients
  libvirt-daemon libvirt-daemon-system libvirt-dbus libvirt-glib-1.0-0 libvirt0 libxencall1 libxendevicemodel1
  libxenevtchn1 libxenforeignmemory1 libxengnttab1 libxenmisc4.11 libxenstore3.0 libxentoolcore1 libxentoollog1
  libxml2-utils lvm2 mailutils mailutils-common mdadm netcat-openbsd ovmf python3-distutils python3-lib2to3
  python3-libvirt python3-libxml2 qemu-block-extra qemu-system-common qemu-system-data qemu-system-gui qemu-system-x86
  qemu-utils seabios sysuser-helper thin-provisioning-tools virt-viewer virtinst
0 upgraded, 95 newly installed, 0 to remove and 146 not upgraded.
Need to get 66.2 MB of archives.
After this operation, 188 MB of additional disk space will be used.
Do you want to continue? [Y/n]
...
debian>$ sudo reboot
}}}

== Download netinstall iso to local iso directory ==
{{{
debian>$ mkdir iso
debian>$ cd ~/iso
debian>$ curl -L -O https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.10.0-amd64-netinst.iso
}}}

{{{#!wiki tip
'''curl'''
        -L If the server reports that the requested page has moved to a different location, this option will make curl redo the request on the new place. (redirect)
        -O Write output to <file> instead of stdout.
}}}


== Open TCP Port 9090 if firewall is installed ==

If you have '''ufw''' for your firewall:
{{{
debian> $ sudo ufw allow 9090/tcp
debian> $ sudo ufw reload
}}}


== Login to Web Console with browser from your workstation (PC, Mac or Linux) ==

{{{#!wiki tip
Add IP address for debian system in your /etc/hosts file so you can type following URL in the browser.
}}}

{{{
% curl -I http://debian:9090
HTTP/1.1 301 Moved Permanently
Content-Type: text/html
Location: https://debian:9090/
Content-Length: 73
X-DNS-Prefetch-Control: off
Referrer-Policy: no-referrer
X-Content-Type-Options: nosniff
Cross-Origin-Resource-Policy: same-origin
}}}

Chrome or Firefox --> https://debian:9090/ --> Advanced --> Proceed to debian


{{{#!wiki caution
 * Activate default networks in virtual machines to avoid following error
 * Also, check on [x] Run when host boots
}}}

{{{
Creation of VM vm1 failed
ERROR Requested operation is not valid:
network 'default' is not active Domain installation does not appear to have been successful.
If it was, you can restart your domain by running: virsh --connect qemu:///system start vm1
otherwise, please restart your installation.
}}}


== Create your first virtual machine (vm1) from Web Console ==
{{{
   Virtual Machines --> Create VM
   Name: vm1
   Connection: System
   Installation type: Local install media
   Installation source: /home/tchung/iso/debian-10.10.0-amd64-netinst.iso
   Operation system: Debian 10 (buster)
   Storage: Create new volume
   Size: 20 GiB
   Memory: 2 GiB
   [x] Immediately start VM
}}}

== Install Debian 10 on virtual machine as you do in physical machine ==

[[https://www.debian.org/releases/stable/amd64/]]

== Login to your first virtual machine (vm1) with ssh and confirm you can ping ==

{{{#!wiki tip
Add IP address for vm1 in your /etc/hosts file on debian system so you can ssh to vm1 instead of IP address
}}}

{{{
debian>$ ssh vm1
   vm1>$ ping www.google.com
         ... works!
}}}


== Updating osinfo-db for osinfo-query and virt-install ==
 * So I was creating vm using virt-install in command line and I had to know '''--os-variant''' value.
 * Unfortunately, existing '''osinfo-query''' would not return the distro I needed (ubuntu20 for example).
 * I discovered that it was not '''libosinfo-bin''' but '''osinfo-db''' pkg that needed to be updated.
 * I also discovered updated version of [[https://packages.debian.org/sid/osinfo-db|osinfo-db]] pkg is available from [[sid]].
 * I could add a repository for [[sid]] in /etc/apt/sources.list temporarily so I could install it using apt install command.
 * Since the pkg does not have any dependency, I've decided to install the pkg in good old fashioned way.

{{{
$ curl -O -L https://deb.debian.org/debian/pool/main/o/osinfo-db/osinfo-db_0.20210215-1_all.deb
$ sudo dpkg -i osinfo-db*.deb
}}}

 * Now, I'm able to find the '''--os-variant''' value I needed which was missing before.

{{{
$ osinfo-query os -f short-id | grep ubuntu20
 ubuntu20.04
 ubuntu20.10
}}}


== How many VMs am I running? ==

{{{#!wiki note
'''vm''' is a custom script based on virsh, virt-install, virt-clone etc.
}}}

At the moment, I'm running 12.
{{{
$ vm list
 Id Name State
----------------------
 51 c79 running
 52 c84 running
 53 d09 running
 76 d10c running
 54 d10 running
 62 d11 running
 69 f32 running
 70 f34 running
 72 lm19 running
 74 lm20 running
 58 u18 running
 75 u20 running

$ vm list | grep running | wc -l
12
}}}

[[attachment:kvm_usage.png|Usage]] shows a little over half the total memory (32G) and 1% of CPU are being used since they're running idle.


== See Also ==

 * [[https://cockpit-project.org/running.html#debian]]
 * [[attachment:debian-webconsole.png|Screen for WebConsole]]
 * [[attachment:kvm-d11-test.png|Screen for Debian 11 Test VM]]
 * [[attachment:kvm_u20_test.png|Screen for Ubuntu 20.04 Test VM]]

----

CategorySystemAdministration | CategoryVirtualization | CategorySoftware

How to install Web Console with Virtual Machines on Debian 10

debian is your physical machine running Debian 10 where you'll install Web Console with Virtual Machines

vm1 is your virtual machine where you'll install Debian 10 but you can install any distro (even Windows)

Install Web Console with Virtual Machines

debian>$ echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee -a /etc/apt/sources.list.d/backports.list
debian>$ sudo apt update
debian>$ sudo apt install -t buster-backports cockpit cockpit-machines
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  augeas-lenses cockpit-bridge cockpit-networkmanager cockpit-packagekit cockpit-storaged cockpit-system cockpit-ws
  dmeventd exim4-base exim4-config exim4-daemon-light genisoimage gir1.2-libosinfo-1.0 ibverbs-providers ipxe-qemu
  libaio1 libaugeas0 libblockdev-mdraid2 libbytesize1 libcapstone4 libdaxctl1 libdevmapper-event1.02.1 libfdt1
  libgfapi0 libgfrpc0 libgfxdr0 libglusterfs0 libgnutls-dane0 libgovirt-common libgovirt2 libgsasl7 libibverbs1
  libiscsi7 libkyotocabinet16v5 liblvm2cmd2.03 liblzo2-2 libmailutils5 libndctl6 libnetcf1 libntlm0 libpmem1
  libpwquality-tools librados2 librbd1 librdmacm1 libreadline5 libslirp0 libspice-server1 libssh-4 libtirpc-common
  libtirpc3 libunbound8 liburcu6 liburing1 libvdeplug2 libvirglrenderer0 libvirt-clients libvirt-daemon
  libvirt-daemon-system libvirt-dbus libvirt-glib-1.0-0 libvirt0 libxencall1 libxendevicemodel1 libxenevtchn1
  libxenforeignmemory1 libxengnttab1 libxenmisc4.11 libxenstore3.0 libxentoolcore1 libxentoollog1 libxml2-utils lvm2
  mailutils mailutils-common mdadm netcat-openbsd ovmf python3-distutils python3-lib2to3 python3-libvirt
  python3-libxml2 qemu-block-extra qemu-system-common qemu-system-data qemu-system-gui qemu-system-x86 qemu-utils
  seabios sysuser-helper thin-provisioning-tools virt-viewer virtinst
Suggested packages:
  augeas-doc cockpit-doc cockpit-pcp sssd-dbus exim4-doc-html | exim4-doc-info eximon4 spf-tools-perl swaks wodim
  cdrkit-doc augeas-tools libvirt-daemon-driver-storage-gluster libvirt-daemon-driver-storage-rbd
  libvirt-daemon-driver-storage-zfs numad auditd nfs-common open-iscsi pm-utils radvd systemtap zfsutils mailutils-mh
  mailutils-doc dracut-core samba vde2 debootstrap
The following NEW packages will be installed:
  augeas-lenses cockpit cockpit-bridge cockpit-machines cockpit-networkmanager cockpit-packagekit cockpit-storaged
  cockpit-system cockpit-ws dmeventd exim4-base exim4-config exim4-daemon-light genisoimage gir1.2-libosinfo-1.0
  ibverbs-providers ipxe-qemu libaio1 libaugeas0 libblockdev-mdraid2 libbytesize1 libcapstone4 libdaxctl1
  libdevmapper-event1.02.1 libfdt1 libgfapi0 libgfrpc0 libgfxdr0 libglusterfs0 libgnutls-dane0 libgovirt-common
  libgovirt2 libgsasl7 libibverbs1 libiscsi7 libkyotocabinet16v5 liblvm2cmd2.03 liblzo2-2 libmailutils5 libndctl6
  libnetcf1 libntlm0 libpmem1 libpwquality-tools librados2 librbd1 librdmacm1 libreadline5 libslirp0 libspice-server1
  libssh-4 libtirpc-common libtirpc3 libunbound8 liburcu6 liburing1 libvdeplug2 libvirglrenderer0 libvirt-clients
  libvirt-daemon libvirt-daemon-system libvirt-dbus libvirt-glib-1.0-0 libvirt0 libxencall1 libxendevicemodel1
  libxenevtchn1 libxenforeignmemory1 libxengnttab1 libxenmisc4.11 libxenstore3.0 libxentoolcore1 libxentoollog1
  libxml2-utils lvm2 mailutils mailutils-common mdadm netcat-openbsd ovmf python3-distutils python3-lib2to3
  python3-libvirt python3-libxml2 qemu-block-extra qemu-system-common qemu-system-data qemu-system-gui qemu-system-x86
  qemu-utils seabios sysuser-helper thin-provisioning-tools virt-viewer virtinst
0 upgraded, 95 newly installed, 0 to remove and 146 not upgraded.
Need to get 66.2 MB of archives.
After this operation, 188 MB of additional disk space will be used.
Do you want to continue? [Y/n]
...
debian>$ sudo reboot

Download netinstall iso to local iso directory

debian>$ mkdir iso
debian>$ cd ~/iso
debian>$ curl -L -O https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.10.0-amd64-netinst.iso

curl

  • -L If the server reports that the requested page has moved to a different location, this option will make curl redo the request on the new place. (redirect)

    -O Write output to <file> instead of stdout.

Open TCP Port 9090 if firewall is installed

If you have ufw for your firewall:

debian> $ sudo ufw allow 9090/tcp
debian> $ sudo ufw reload

Login to Web Console with browser from your workstation (PC, Mac or Linux)

Add IP address for debian system in your /etc/hosts file so you can type following URL in the browser.

% curl -I http://debian:9090
HTTP/1.1 301 Moved Permanently
Content-Type: text/html
Location: https://debian:9090/
Content-Length: 73
X-DNS-Prefetch-Control: off
Referrer-Policy: no-referrer
X-Content-Type-Options: nosniff
Cross-Origin-Resource-Policy: same-origin

Chrome or Firefox --> https://debian:9090/ --> Advanced --> Proceed to debian

  • Activate default networks in virtual machines to avoid following error
  • Also, check on [x] Run when host boots

Creation of VM vm1 failed
ERROR Requested operation is not valid: 
network 'default' is not active Domain installation does not appear to have been successful. 
If it was, you can restart your domain by running: virsh --connect qemu:///system start vm1 
otherwise, please restart your installation.

Create your first virtual machine (vm1) from Web Console

   Virtual Machines --> Create VM
   Name: vm1
   Connection: System
   Installation type: Local install media
   Installation source: /home/tchung/iso/debian-10.10.0-amd64-netinst.iso
   Operation system: Debian 10 (buster)
   Storage: Create new volume
   Size:  20 GiB
   Memory: 2 GiB
   [x] Immediately start VM

Install Debian 10 on virtual machine as you do in physical machine

https://www.debian.org/releases/stable/amd64/

Login to your first virtual machine (vm1) with ssh and confirm you can ping

Add IP address for vm1 in your /etc/hosts file on debian system so you can ssh to vm1 instead of IP address

debian>$ ssh vm1
   vm1>$ ping www.google.com
         ... works! 

Updating osinfo-db for osinfo-query and virt-install

  • So I was creating vm using virt-install in command line and I had to know --os-variant value.

  • Unfortunately, existing osinfo-query would not return the distro I needed (ubuntu20 for example).

  • I discovered that it was not libosinfo-bin but osinfo-db pkg that needed to be updated.

  • I also discovered updated version of osinfo-db pkg is available from sid.

  • I could add a repository for sid in /etc/apt/sources.list temporarily so I could install it using apt install command.

  • Since the pkg does not have any dependency, I've decided to install the pkg in good old fashioned way.

$ curl -O -L https://deb.debian.org/debian/pool/main/o/osinfo-db/osinfo-db_0.20210215-1_all.deb
$ sudo dpkg -i osinfo-db*.deb
  • Now, I'm able to find the --os-variant value I needed which was missing before.

$ osinfo-query os -f short-id | grep ubuntu20
 ubuntu20.04
 ubuntu20.10

How many VMs am I running?

vm is a custom script based on virsh, virt-install, virt-clone etc.

At the moment, I'm running 12.

$ vm list
 Id   Name   State
----------------------
 51   c79    running
 52   c84    running
 53   d09    running
 76   d10c   running
 54   d10    running
 62   d11    running
 69   f32    running
 70   f34    running
 72   lm19   running
 74   lm20   running
 58   u18    running
 75   u20    running

$ vm list | grep running | wc -l
12

Usage shows a little over half the total memory (32G) and 1% of CPU are being used since they're running idle.

See Also


CategorySystemAdministration | CategoryVirtualization | CategorySoftware