From bc54861f8b2f4c14c340f9bf25c17ff7c8ecea36 Mon Sep 17 00:00:00 2001 From: Brett Weir Date: Sun, 21 Jun 2026 14:31:11 -0700 Subject: [PATCH] Align console prompts to style guide (virtualization) --- .../pages/virtualization/installation.adoc | 102 ++++---- .../virtualization/nested-virtualization.adoc | 26 +- .../vm-install-cloudimg-centos9.adoc | 132 +++++----- .../vm-install-diskimg-fedoraserver.adoc | 228 +++++++++--------- .../vm-install-diskimg-virtbuilder.adoc | 52 ++-- .../vm-install-fedoraserver-cockpit.adoc | 108 ++++----- .../virtualization/vm-management-cockpit.adoc | 16 +- 7 files changed, 332 insertions(+), 332 deletions(-) diff --git a/modules/ROOT/pages/virtualization/installation.adoc b/modules/ROOT/pages/virtualization/installation.adoc index 837192b..df9e1c9 100644 --- a/modules/ROOT/pages/virtualization/installation.adoc +++ b/modules/ROOT/pages/virtualization/installation.adoc @@ -30,7 +30,7 @@ Qemu-kvm in combination with Libvirt management toolkit is the standard virtuali QEMU / KVM require hardware virtualization support. The first thing to do is to make sure that it is available. [source,bash] ---- -[…]# grep -E --color 'vmx|svm' /proc/cpuinfo +# grep -E --color 'vmx|svm' /proc/cpuinfo ---- The command will return one line per cpu core if virtualization is enabled. If not, you should first check in the BIOS whether virtualization is disabled. @@ -58,21 +58,21 @@ After completion, the file system is immediately available and is also permanent ==== Command line Some administrators may prefer the command line for easy scripting. Create a Logical Volume of appropriate size, 50 GiB in this esample, either in the system Volume Group (named fedora by default) or in the user data VG if created during installation. Adjust size and VG name as required. -[source,] +[source,console] ---- -[…]# lvcreate -L 50G -n libvirt fedora -[…]# mkfs.xfs /dev/fedora/libvirt -[…]# mkdir -p /var/lib/libvirt -[…]# echo "UUID=$(blkid -s UUID -o value /dev/mapper/fedora-libvirt) /var/lib/libvirt xfs defaults 0 0" >> /etc/fstab +# lvcreate -L 50G -n libvirt fedora +# mkfs.xfs /dev/fedora/libvirt +# mkdir -p /var/lib/libvirt +# echo "UUID=$(blkid -s UUID -o value /dev/mapper/fedora-libvirt) /var/lib/libvirt xfs defaults 0 0" >> /etc/fstab ---- == Installing libvirt virtualization software Installing the software is quite simple. -[source,] +[source,console] ---- -[…]# dnf install qemu-kvm-core libvirt virt-install cockpit-machines guestfs-tools +# dnf install qemu-kvm-core libvirt virt-install cockpit-machines guestfs-tools ---- Be sure to install `guestfs-tools`, not `libguestfs-tools` (unless you need additional windows guest related software). The package `guestfs-tools` provides a basic set of various useful tools to maintain virtual disks. Additional packages provide support for specific use cases, e.g. various file systems or forensic support. Use `dnf search guestfs` to get a list of available packages. @@ -81,13 +81,13 @@ Do not install the group `@virtualization` onto a Fedora Server. It includes var Next check the SELinux labels [source,bash] ---- -[…]# ls -alZ /var/lib/libvirt +# ls -alZ /var/lib/libvirt ---- Usually, installation sets the SELinux labels properly. Otherwise, set them manually. [source,bash] ---- -[…]# restorecon -R -vF /var/lib/libvirt +# restorecon -R -vF /var/lib/libvirt ---- If everything is correct, the next step is to activate autostart after re-boot and start KVM and libvirtd. @@ -98,14 +98,14 @@ With Fedora 35 libvirt switched to a _modular archtecture_ (since version 7.6.0- Enable automatic startup at boot and start libvirt. [source,bash] ---- -[…]# systemctl enable libvirtd --now +# systemctl enable libvirtd --now ---- By default, libvirt creates a (virtual) bridge with an interface virbr0, the IP 192.168.122.1 and the libvirt-internal name as default. In addition, a separate firewall zone libvirt is set up and assigned to the internal interface. Check if everything is running as expected. [source,bash] ---- -[…]# ip a -[…]# firewall-cmd --get-active-zones +# ip a +# firewall-cmd --get-active-zones ---- === Activation and startup with Fedora 35 and up @@ -120,21 +120,21 @@ if you are planning to use the virtual network independently from starting virtu + [source,bash] ---- -[…]# systemctl enable virtnetworkd.service --now +# systemctl enable virtnetworkd.service --now ---- + Alternatively, you may want to completely discard libvirt's internal network. You'll take this path if you set up an internal network with NetworkManager tools. + [source,bash] ---- -[…]# systemctl disable virtnetworkd.socket --now +# systemctl disable virtnetworkd.socket --now ---- 2. **Activate (start) the required libvirt modular drivers** + -[source,] +[source,console] ---- -[…]# for drv in qemu interface network nodedev nwfilter secret storage ; \ +# for drv in qemu interface network nodedev nwfilter secret storage ; \ do systemctl start virt${drv}d{,-ro,-admin}.socket ; done ---- + @@ -146,9 +146,9 @@ The boot process now starts virtualization automatically without administrative 3. *Check successful start via a status query* + -[source,] +[source,console] ---- -[…]# for drv in qemu interface network nodedev nwfilter secret storage ; \ +# for drv in qemu interface network nodedev nwfilter secret storage ; \ do systemctl status virt${drv}d{,-ro,-admin}.socket ; done ● virtqemud.socket - libvirt QEMU daemon socket Loaded: loaded (/usr/lib/systemd/system/virtqemud.socket; enabled; preset: enabled) @@ -189,7 +189,7 @@ The first step is to choose a domain name. A top-level ".local" is explicitly no Use the libvirt tool to adjust the default network. Replace names and placeholders as required. Delete the line with "forward mode = 'nat'" if you do not want to allow access to the public network via the virtual network. [source,xml] ---- -[…]# virsh net-edit default +# virsh net-edit default default aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee @@ -216,15 +216,15 @@ Use the libvirt tool to adjust the default network. Replace names and placeholde Activate the modified configuration. [source,bash] ---- -[…]# virsh net-destroy default -[…]# virsh net-start default +# virsh net-destroy default +# virsh net-start default ---- Check if the DNS resolution works. [source,bash] ---- -[…]# nslookup host 192.168.122.1 -[…]# dig @192.168.122.1 host.example.com +# nslookup host 192.168.122.1 +# dig @192.168.122.1 host.example.com ---- == Adjusting the hosts DNS resolution configuration @@ -238,10 +238,10 @@ The following procedure doesn't work for Fedora 35-39. Don't use it with these r 1. The name resolver service _systemd-resolved_ introduced with Fedora 33 can do this automatically. But libvirt handles its interfaces on its own and must therefore inform systemd-resolved about it. A script in a hook provided by libvirt can take care of this. You have to adjust the local domain name (${example.lan} in the script below) accordingly! + -[source,] +[source,console] ---- -[…]# mkdir -p /etc/libvirt/hooks/network.d/ -[…]# vim /etc/libvirt/hooks/network.d/40-config-resolved.sh +# mkdir -p /etc/libvirt/hooks/network.d/ +# vim /etc/libvirt/hooks/network.d/40-config-resolved.sh #>--INSERT--<# #!/bin/bash # Add the internal libvirt interface virbr0 to the @@ -286,7 +286,7 @@ if [ "$network" == "default" ]; then fi #>--SAVE&QUIT--<# -[…]# chmod +x /etc/libvirt/hooks/network.d/40-config-resolved.sh +# chmod +x /etc/libvirt/hooks/network.d/40-config-resolved.sh ---- 2. Check if /etc/resolv.conf is a link and not a file. @@ -294,24 +294,24 @@ Activate modified local DNS resolving + [source,bash] ---- -[…]# ls -al /etc/resolv.conf +# ls -al /etc/resolv.conf ---- + In case it is a file, fix it: + [source,bash] ---- -[…]# cd /etc -[…]# rm -f resolv.con -[…]# systemctl restart systemd-resolved -[…]# ln -s ../run/systemd/resolve/stub-resolv.conf resolv.conf +# cd /etc +# rm -f resolv.con +# systemctl restart systemd-resolved +# ln -s ../run/systemd/resolve/stub-resolv.conf resolv.conf ---- 3. Test the hook file + [source,bash] ---- -[…]# /etc/libvirt/hooks/network.d/40-config-resolved.sh default started begin +# /etc/libvirt/hooks/network.d/40-config-resolved.sh default started begin P1: default - P2: started - P3: begin @ Mon Mar ... ---- @@ -319,17 +319,17 @@ In case it is a file, fix it: + [source,bash] ---- -[…]# /etc/libvirt/hooks/network.d/40-config-resolved.sh default started begin +# /etc/libvirt/hooks/network.d/40-config-resolved.sh default started begin P1: default - P2: started - P3: begin @ Mon Mar ... ---- 5. Check the functionality of name resolution with internal and external addresses. [source,bash] ---- -[…]# ping host -[…]# ping host.example.lan -[…]# ping host.example.com -[…]# ping guardian.co.uk +# ping host +# ping host.example.lan +# ping host.example.com +# ping guardian.co.uk ---- + Everything should work fine now. @@ -342,7 +342,7 @@ Activate dnsmasq plugin [source,bash] ---- -[…]# vim /etc/NetworkManager/conf.d/00-use-dnsmasq.conf +# vim /etc/NetworkManager/conf.d/00-use-dnsmasq.conf # /etc/NetworkManager/conf.d/00-use-dnsmasq.conf # # This enabled the dnsmasq plugin. @@ -354,7 +354,7 @@ Define the local domain and DNS service [source,bash] ---- -[…]# vim /etc/NetworkManager/dnsmasq.d/00-example-lan.conf +# vim /etc/NetworkManager/dnsmasq.d/00-example-lan.conf # /etc/NetworkManager/dnsmasq.d/00-example-lan.conf # # This file directs dnsmasq to forward any request to resolve @@ -367,12 +367,12 @@ Activate modified local DNS resolving [source,bash] ---- -[…]# systemctl stop systemd-resolved -[…]# systemctl disable systemd-resolved -[…]# rm /etc/resolv.conf -[…]# nmcli con mod enp3s0 ipv4.dns-search 'example.lan' -[…]# nmcli con mod enp3s0 ipv6.dns-search 'example.lan' -[…]# systemctl restart NetworkManager +# systemctl stop systemd-resolved +# systemctl disable systemd-resolved +# rm /etc/resolv.conf +# nmcli con mod enp3s0 ipv4.dns-search 'example.lan' +# nmcli con mod enp3s0 ipv6.dns-search 'example.lan' +# systemctl restart NetworkManager ---- @@ -380,10 +380,10 @@ Check the functionality of name resolution with internal and external addresses. [source,bash] ---- -[…]# ping host -[…]# ping host.example.lan -[…]# ping host.example.com -[…]# ping guardian.co.uk +# ping host +# ping host.example.lan +# ping host.example.com +# ping guardian.co.uk ---- diff --git a/modules/ROOT/pages/virtualization/nested-virtualization.adoc b/modules/ROOT/pages/virtualization/nested-virtualization.adoc index e61002d..eecad10 100644 --- a/modules/ROOT/pages/virtualization/nested-virtualization.adoc +++ b/modules/ROOT/pages/virtualization/nested-virtualization.adoc @@ -28,18 +28,18 @@ However, that does not mean it should be used as a standard configuration. The t 1. The (physical) host CPU must support nested virtualization. + -[source,] +[source,console] ---- -[…]$ sudo egrep --color 'vmx|svm|ept' /proc/cpuinfo +$ sudo egrep --color 'vmx|svm|ept' /proc/cpuinfo ---- + The output must include the `vmx` and `ept` flags. This is generally the case on Intel Core-i based CPUs. 2. Ensure that nested virtualization is enabled in the (physical) hosts kernel: + -[source,] +[source,console] ---- -[…]$ sudo cat /sys/module/kvm_intel/parameters/nested +$ sudo cat /sys/module/kvm_intel/parameters/nested ---- + If the command __returns 1 or Y__, the feature is enabled. Continue with xref:#_setting_up_a_vm_for_nested_virtualization[Setting up a VM for nested virtualization] @@ -48,22 +48,22 @@ If the command _returns 0 or N_ but your system supports nested virtualization, a. Execute the following commands to enable the nested virtualization feature + -[source,] +[source,console] ---- -[…]$ sudo modprobe -r kvm_intel -[…]$ sudo modprobe kvm_intel nested=1 +$ sudo modprobe -r kvm_intel +$ sudo modprobe kvm_intel nested=1 ---- b. Ensure the operation is successfull + -[source,] +[source,console] ---- -[…]$ sudo cat /sys/module/kvm_intel/parameters/nested +$ sudo cat /sys/module/kvm_intel/parameters/nested ---- c. To make the change permanent and cope with a restart, edit + -[source,] +[source,console] ---- -[…]$ sudo vim /etc/modprobe.d/kvm.conf +$ sudo vim /etc/modprobe.d/kvm.conf options kvm_intel nested=1 ---- @@ -77,9 +77,9 @@ Log in to the virtual server that is to host additional virtual machines. 3. Check the installation + -[source,] +[source,console] ---- -[…]$ sudo virt-host-validate qemu +$ sudo virt-host-validate qemu QEMU: Checking for hardware virtualization : PASS QEMU: Checking if device /dev/kvm exists : PASS QEMU: Checking if device /dev/kvm is accessible : PASS diff --git a/modules/ROOT/pages/virtualization/vm-install-cloudimg-centos9.adoc b/modules/ROOT/pages/virtualization/vm-install-cloudimg-centos9.adoc index f9bf6d6..a37c30e 100644 --- a/modules/ROOT/pages/virtualization/vm-install-cloudimg-centos9.adoc +++ b/modules/ROOT/pages/virtualization/vm-install-cloudimg-centos9.adoc @@ -68,20 +68,20 @@ https://cloud.centos.org/centos/9-stream/x86_64/images/ At the time of this writ 2. In the Cockpit terminal window, fetch a CentOS 9-stream generic image file and store it into the directory `/var/lib/libvirt/boot`. This is by convention the libvirt default location of images for installation. Check the integrity of the download. + -[source,] +[source,console] ---- -[…]$ sudo su - -[…]# cd /var/lib/libvirt/boot -[…]# wget https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-20220315.0.x86_64.qcow2 -[…]# wget https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-20220315.0.x86_64.qcow2.SHA256SUM -[…]# sha256sum --ignore-missing -c *.SHA256SUM +$ sudo su - +# cd /var/lib/libvirt/boot +# wget https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-20220315.0.x86_64.qcow2 +# wget https://cloud.centos.org/centos/9-stream/x86_64/images/CentOS-Stream-GenericCloud-9-20220315.0.x86_64.qcow2.SHA256SUM +# sha256sum --ignore-missing -c *.SHA256SUM ---- + You may want to gather some information about the image + [source,bash] ---- -[…]# qemu-img info CentOS-Stream-GenericCloud-9-20220315.0.x86_64.qcow2 +# qemu-img info CentOS-Stream-GenericCloud-9-20220315.0.x86_64.qcow2 image: CentOS-Stream-GenericCloud-9-20220315.0.x86_64.qcow2 file format: qcow2 @@ -140,18 +140,18 @@ Users of a non-US keyborad layout probably want to customize the keyboard layout 1. Check the current locale configuration + -[source,] +[source,console] ---- -[…]# localectl +# localectl System Locale: LANG=en_US.UTF-8 VC Keymap: us X11 Layout: us ---- 2. List available keyboard mappings filtered by your short county code part + -[source,] +[source,console] ---- -[…]# localectl list-keymaps | grep de- +# localectl list-keymaps | grep de- de-T3 de-deadacute de-deadgraveacute @@ -167,7 +167,7 @@ de-nodeadkeys + [source,bash] ---- -[…]# localectl set-keymap de-nodeadkeys +# localectl set-keymap de-nodeadkeys ... ---- The setting is immediately activ. @@ -185,10 +185,10 @@ The latter is now the recommended approach. It acts similar to a bridge, but wit 1. While logged in use the terminal window to set the static hostname. It ensures a correct DNS setup in a DHCP environment. + -[source,] +[source,console] ---- -[…]$ hostnamectl set-hostname vm1-el9.example.com -[…]$ hostnamectl +$ hostnamectl set-hostname vm1-el9.example.com +$ hostnamectl ---- 2. If you expanded the terminal window click on the VM name in the breadcrumb to get the default view. Select shutdown to stop the virtual machine. @@ -207,9 +207,9 @@ Replace the interface type by `__Direct attachment__` and select the external ph + From a terminal window in the host system you should be able to ping your VM using the internal virtual network. + -[source,] +[source,console] ---- -[…]$ ping vm1-el9 +$ ping vm1-el9 ---- + If the name service setup in the host is correct, the short name should work. Otherwise try the internal FQDN name (i.e. something like vm1-el9.example.lan). If name resolution doesn’t work, switch to the VM’s Cockpit terminal window. Use `ip a` to determine the internal IP and use this to ping the VM. @@ -220,7 +220,7 @@ If pinging the IP address works, fix the name resolution. Otherwise check again From a machine on your network try to ping the virtual machinge + ---- -[…]$ ping vm1-el9.example.com +$ ping vm1-el9.example.com ---- + In case of issues proceed analog to the internal connection. @@ -232,54 +232,54 @@ A Cockpit installation cannot implement the widely used security concept of lock 1. If there is already another user and this user is to be granted administrative rights, the account must be assigned to the wheel group. + -[source,] +[source,console] ---- -[…]# usermod -aG wheel +# usermod -aG wheel ---- + Test if login and sudo work! 2. If you decide to lock the root account, login as your administrative user and execute + -[source,] +[source,console] ---- -[…]# sudo passwd -l root +# sudo passwd -l root ---- + Log off and try to login as root (e.g. using the host's Cockpit instance). The system should respong with 'Login incorrect'. 3. If you decide to use the root account and you chose a simple password during installation, you should set a long and secure password. Log in as root and execute + -[source,] +[source,console] ---- -[…]# passwd +# passwd ---- + If root also needs access via ssh, a key-based login must be set up. Follow step 5 of the xref:installation/postinstallation-tasks.adoc[post-installation guide]. 4. Install and activate the firewall + -[source,] +[source,console] ---- -[…]# dnf install firewalld -[…]# systemctl enable firewalld --now -[…]# firewall-cmd --list-all +# dnf install firewalld +# systemctl enable firewalld --now +# firewall-cmd --list-all ---- 5. If you want to use Cockpit you have to enable it + -[source,] +[source,console] ---- -[…]# systemctl enable cockpit.socket --now +# systemctl enable cockpit.socket --now ---- + Cockpit should start up as soon as you connect with your browser. 6. Finally, if you want the virtual machine to start automatically at system startup, check the corresponding box in the Cockpit VM overview. Alternatively execute + -[source,] +[source,console] ---- -[…]# virsh autostart vm1-el9 +# virsh autostart vm1-el9 ---- == Using virt-install for a CLI interactive minimal effort installation @@ -293,18 +293,18 @@ Essentially, you need to copy the downloaded image file to the libvirt disk imag 1. Copy the disk image from the installation media pool to the disk images pool and choose the intended VM name as target. + -[source,] +[source,console] ---- -[…]$ sudo su - -[…]# cd /var/lib/libvirt/boot -[…]# cp CentOS-Stream-GenericCloud-9-20220315.0.x86_64.qcow2 ../images/vm2-el9.qcow2 +$ sudo su - +# cd /var/lib/libvirt/boot +# cp CentOS-Stream-GenericCloud-9-20220315.0.x86_64.qcow2 ../images/vm2-el9.qcow2 ---- 2. Inspect the disk size and optionally adjust it. The default is about 10 GiB. + -[source,] +[source,console] ---- -[…]# qemu-img info /var/lib/libvirt/images/vm2-el9.qcow2 -[…]# qemu-img resize /var/lib/libvirt/images/vm2-el9.qcow2 +10G +# qemu-img info /var/lib/libvirt/images/vm2-el9.qcow2 +# qemu-img resize /var/lib/libvirt/images/vm2-el9.qcow2 +10G ---- + The example above adds 10 GiB to a total size of about 20 GiB. @@ -313,9 +313,9 @@ You can resize the virtual disk later, too. Therefore, there is no reason to pla === Installation Use a terminal window to execute -[source,] +[source,console] ---- -[…]# virt-install --name vm2-el9\ +# virt-install --name vm2-el9\ --memory 2048 --cpu host --vcpus 2 --graphics none\ --os-variant centos-stream9\ --import \ @@ -371,18 +371,18 @@ As usual, also in computer science the "law of conservation of energy" applies. 1. Non-US system administrators should adjust the layout first. a. Check the current locale configuration + -[source,] +[source,console] ---- -[…]# localectl +# localectl System Locale: LANG=en_US.UTF-8 VC Keymap: us X11 Layout: us ---- b. List available keyboard mappings filtered by your short county code part. Replaye "de-" by your country, i.e. "-" + -[source,] +[source,console] ---- -[…]# localectl list-keymaps | grep de- +# localectl list-keymaps | grep de- de-T3 de-deadacute de-deadgraveacute @@ -396,16 +396,16 @@ de-nodeadkeys + c. Determine applicable key mapping and apply it + -[source,] +[source,console] ---- -[…]# localectl set-keymap de-nodeadkeys +# localectl set-keymap de-nodeadkeys ... ---- The setting is immediately activ. 2. Check network connection + -[source,] +[source,console] ---- # ip a 1: lo: mtu 65536 .... @@ -426,20 +426,20 @@ If DHCP was available for all interfaces, a complete interface configuration is + Check for connectivity: + -[source,] +[source,console] ---- -[…]# ping guardian.co.uk -[…]# ping -[…]# ping 192.168.122.1 # your host system internal virtual network address +# ping guardian.co.uk +# ping +# ping 192.168.122.1 # your host system internal virtual network address ---- + The VM can connect to internal and external destinations. The name resolution for the vm itself can’t work because the static hostname is not set yet. The external host address is not responding due to Mac vlan technology and the internal name resolution is not working yet. + Check the interface devices. + -[source,] +[source,console] ---- -[…]# nmcli dev +# nmcli dev DEVICE TYPE STATE CONNECTION eth0 ethernet connected System eth0 eth1 ethernet connected Wired connection 1 @@ -451,9 +451,9 @@ The file `/etc/NetworkManager/system-connections/ens3.nmconnection` is a leftove + Probably you want to have a persistent configuration file, so can assign a firewall zone to the connection. Just rename the connection. + -[source,] +[source,console] ---- -[…]# nmcli con mod 'Wired connection 1' connection.id eth1 +# nmcli con mod 'Wired connection 1' connection.id eth1 ---- + The renaming triggers NetworkManager to create a file `/etc/sysconfig/network-scripts/ifcfg-eth1` with the current configuration. @@ -462,26 +462,26 @@ If DHCP is not available for the external interface, the configuration file is j 3. In case the virtual disk size has been changed, the partition sizes must be adjusted. + -[source,] +[source,console] ---- -[…]# cfdisk /dev/vda +# cfdisk /dev/vda ---- The only partition should already have the adjusted size. Otherwise select resize and then write. + Next resize the file system, if not already done. First check the size of the file system, e.g. using df. + -[source,] +[source,console] ---- -[…]# df -h -[…]# resize2fs -p /dev/vda1 +# df -h +# resize2fs -p /dev/vda1 ---- 4. Finally, let’s set the hostname + [source,bash] ---- -[…]# ##hostnamectl set-hostname VM_NAME.example.com -[…]# hostnamectl set-hostname vm2-el9.example.com +# ##hostnamectl set-hostname VM_NAME.example.com +# hostnamectl set-hostname vm2-el9.example.com ---- Exit and close the console typing +]. @@ -491,13 +491,13 @@ You may reboot the VM and than check /var/lib/libvirt/dnsmasq/virbr0.status agai If your external DHCP server provides dynamic DNS as well, you should be able to connect to your VM from the public network: [source,batch] ---- -[…]# ping VM_NAME.example.com +# ping VM_NAME.example.com ---- Last action is to enable autostart of the VM. -[source,] +[source,console] ---- -[…]# virsh autostart VM_NAME +# virsh autostart VM_NAME ---- Everything is working fine now, nearly out of the box. You would now start configuring the VM in detail according to its intended use. Just as it would be required after a standard installation. diff --git a/modules/ROOT/pages/virtualization/vm-install-diskimg-fedoraserver.adoc b/modules/ROOT/pages/virtualization/vm-install-diskimg-fedoraserver.adoc index 00a1d74..6413876 100644 --- a/modules/ROOT/pages/virtualization/vm-install-diskimg-fedoraserver.adoc +++ b/modules/ROOT/pages/virtualization/vm-install-diskimg-fedoraserver.adoc @@ -56,15 +56,15 @@ We assume a complete installation of virtualization support according to the xre 1. If not already done, *download the Fedora Server Edition* virtual disk image into the _Installation media_ storage pool and verify the image. This involves the following steps on x86_64 hardware. For ARM machines replace 'x86_64' by 'aarcb64' in the following example. + -[source,] +[source,console] ---- -[…]$ sudo -i -[…]# cd /var/lib/libvirt/boot -[…]# wget https://download.fedoraproject.org/pub/fedora/linux/releases/43/Server/x86_64/images/Fedora-Server-Guest-Generic-43-1.6.x86_64.qcow2 -[…]# wget https://download.fedoraproject.org/pub/fedora/linux/releases/43/Server/x86_64/iso/Fedora-Server-43-1.6-x86_64-CHECKSUM -[…]# curl -O https://fedoraproject.org/fedora.gpg -[…]# gpgv --keyring ./fedora.gpg Fedora-Server-43-1.6-x86_64-CHECKSUM -[…]# sh -c ' cd /var/lib/libvirt/boot/ && sha256sum --ignore-missing -c *-CHECKSUM ' +$ sudo -i +# cd /var/lib/libvirt/boot +# wget https://download.fedoraproject.org/pub/fedora/linux/releases/43/Server/x86_64/images/Fedora-Server-Guest-Generic-43-1.6.x86_64.qcow2 +# wget https://download.fedoraproject.org/pub/fedora/linux/releases/43/Server/x86_64/iso/Fedora-Server-43-1.6-x86_64-CHECKSUM +# curl -O https://fedoraproject.org/fedora.gpg +# gpgv --keyring ./fedora.gpg Fedora-Server-43-1.6-x86_64-CHECKSUM +# sh -c ' cd /var/lib/libvirt/boot/ && sha256sum --ignore-missing -c *-CHECKSUM ' Fedora-Server-Guest-Generic-43-1.6.x86_64.qcow2: OK sha256sum: WARNING: 17 lines are improperly formatted ---- @@ -73,21 +73,21 @@ You can savely ignore the warning. Important is just the OK status of the image. + If you copy or move files directly from elsewhere, you should check the correct SELinux label and correct it if necessary. + -[source,] +[source,console] ---- -[…]# ls -alZ /var/lib/libvirt/boot/* -[…]# restorecon -R -vF /var/lib/libvirt/boot/* +# ls -alZ /var/lib/libvirt/boot/* +# restorecon -R -vF /var/lib/libvirt/boot/* ---- 2. *Adjust the image file* to your needs. The maximum disk size of the server VM image file is 10 GiB, of which about 6GB in the root file system is free. This is not intended for productive operation, but as a starting point for customization. The minimal recommended size is about 20G. To save these adjustment steps for further instantiations, create a customized base image. Copy the disk image to an intermediate file and adjust the maximum disk size. + -[source,] +[source,console] ---- -[…]# cd /var/lib/libvirt/boot -[…]# cp Fedora-Server-Guest-Generic-43-1.6.x86_64.qcow2 Fedora-Server-43-custom.qcow2 -[…]# qemu-img info /var/lib/libvirt/boot/Fedora-Server-43-custom.qcow2 -[…]# qemu-img resize /var/lib/libvirt/boot/Fedora-Server-43-custom.qcow2 40G -[…]# qemu-img info /var/lib/libvirt/boot/Fedora-Server-43-custom.qcow2 +# cd /var/lib/libvirt/boot +# cp Fedora-Server-Guest-Generic-43-1.6.x86_64.qcow2 Fedora-Server-43-custom.qcow2 +# qemu-img info /var/lib/libvirt/boot/Fedora-Server-43-custom.qcow2 +# qemu-img resize /var/lib/libvirt/boot/Fedora-Server-43-custom.qcow2 40G +# qemu-img info /var/lib/libvirt/boot/Fedora-Server-43-custom.qcow2 ---- + The example above expands the maximal capacity to 40 GiB. You can resize the virtual disk later, too. Therefore, there is no reason to plan too generously in terms of size now. Due to the qcow2 format resizing does not affect the current image file size. It is dynamically adjusted as needed up to the maximum specified. @@ -101,10 +101,10 @@ The example above expands the maximal capacity to 40 GiB. You can resize the vir Copy the customized distribution file into the disk image pool and use virt-install to instantiate the new virtual machine. In the example, we assume that the VM has 2 interfaces, one for connecting to the public network and another for connecting to the internal protected network. Adjust this to your needs. You could even install the VM without any interface. In this case, you must use the virsh console ('virsh console ) to log in and obtain a terminal window. -[source,] +[source,console] ---- -[…]# cp /var/lib/libvirt/boot/Fedora-Server-43-custom.qcow2 /var/lib/libvirt/images/{VM_NAME}.qcow2 -[…]# virt-install --name \ +# cp /var/lib/libvirt/boot/Fedora-Server-43-custom.qcow2 /var/lib/libvirt/images/{VM_NAME}.qcow2 +# virt-install --name \ --memory 4096 --cpu host --vcpus 2 --graphics none \ --os-variant fedora-unknown \ --import \ @@ -120,7 +120,7 @@ The parameters are quite descriptive and are to be adjusted accordingly. You wil A lot of messages then scroll across the screen. If the network interface doesn't provide DHCP, in includes a NetworkManager error message. You can safely ignore it for now. It finally ends with a simple, text-based input mask for the first boot configuration. -[source,] +[source,console] ---- Starting install... Running text console command: virsh --connect qemu:///system console rbox03 @@ -215,7 +215,7 @@ You have to use the terminal for this step, whether you performed the instantiat 1. *Complete the first boot configuration* + -[source,] +[source,console] ---- ================================================================================ ================================================================================ @@ -235,7 +235,7 @@ The clear majority of the input options are already preset with values that corr + The selection of a menu item to be edited is made via the digit in front of it. Somewhat unusual in these days and age. The process is unfortunately a bit cumbersome. A "5" navigates to the item "User creation" and a "1" then to the creation of a new user. + -[source,] +[source,console] ---- ================================================================================ ================================================================================ @@ -257,7 +257,7 @@ quit, 'r' to refresh]: + The "[x]" in front of Create user indicates that the user creation process is activ. Accordingly, password authentication is enabled for the new user as well as administrator privileges. Fill in the required information and in any case ensure to activate the adminstrator privileges! It automatically adds "wheel" to Groups. + -[source,] +[source,console] ---- ================================================================================ ================================================================================ @@ -286,7 +286,7 @@ All non-British users may grab the opportunity to adjust the time zone using opt + Another "c" continues with the execution of the entire configuration process. The operation takes some time and then ends in a login prompt. + -[source,] +[source,console] ---- ... ... @@ -315,10 +315,10 @@ The virtual server is up and running now, and ready for log in. The initial conf + Users of a non-US keyboard layout probably want to customize the keyboard layout first of all. This facilitates any subsequent operation. First, check the current locale configuration + -[source,] +[source,console] ---- -[…]# sudo -i -[…]# localectl +# sudo -i +# localectl System Locale: LANG=en_US.UTF-8 VC Keymap: us X11 Layout: us @@ -327,9 +327,9 @@ System Locale: LANG=en_US.UTF-8 + List available keyboard mappings filtered by your short county code part + -[source,] +[source,console] ---- -[…]# localectl list-keymaps | grep de- +# localectl list-keymaps | grep de- de-T3 de-deadacute de-deadgraveacute @@ -345,7 +345,7 @@ Determine applicable key mapping and apply it + [source,bash] ---- -[…]# localectl set-keymap de-nodeadkeys +# localectl set-keymap de-nodeadkeys ---- + The setting is immediately active. @@ -356,42 +356,42 @@ A correct hostname is specifically important for DHCP of the internal network to + a. __Check hostname__. You need a correct static hostname. + -[source,] +[source,console] ---- -[…]# hostnamectl +# hostnamectl ---- b. _Set hostname_ if required: + -[source,] +[source,console] ---- -[…]# hostnamectl set-hostname +# hostnamectl set-hostname ---- 4. *Check time zone and time synchronisation* if you missed that previously a. _Check time settings_ + -[source,] +[source,console] ---- -[…]# timedatectl +# timedatectl ---- b. Correct time zone if necessary: + -[source,] +[source,console] ---- -[…]# timedatectl set-timezone +# timedatectl set-timezone ---- c. If necessary, activate time synchronisation: + -[source,] +[source,console] ---- -[…]# timedatectl set-ntp true +# timedatectl set-ntp true ---- d. Correct time if necessary: + -[source,] +[source,console] ---- -[…]# timedatectl set-time