Updated the cli installation part to F43.

This commit is contained in:
Peter Boy 2025-12-03 12:49:26 +01:00
commit 717ab9ec6e

View file

@ -1,8 +1,8 @@
= Creating a virtual machine using Fedora Server Edition disk image
Peter Boy
:page-authors: {author}
:revnumber: F39-F41
:revdate: 2024-11-01
:revnumber: F39-F43
:revdate: 2025-12-04
// :revremark: a new beginning
:page-aliases: pages/virtualization-vm-install-diskimg-fedoraserver.adoc
@ -17,7 +17,9 @@ There are 2 ways to create a Fedora Server in a virtual machine. System administ
xref:virtualization/vm-install-fedoraserver-cockpit.adoc[Installing a Fedora Server virtual machine using Cockpit].
In this process, a number of properties and functionalities can be adapted to local requirements. Or they can download a Fedora Server virtual disk image containing an already preinstalled, pre-configured and ready-to-run operating system and mount it in a virtual machine.
There exist a multitude of virtual disk images that claim to provide a server based on the Fedora distribution. An example of this is the xref:virtualization/vm-install-diskimg-virtbuilder.adoc[virt-builder] system. However, it is not a Fedora Server, but its own, deviating concept for the configuration of a server. And accordingly, e.g., the Fedora Server administration tools and principles may not fit. System administrators can also create their own disk images using tools such as _xref::tutorials/imagefactory.adoc[Image Factory]_ or __Image Builder__.
There exist a multitude of virtual disk images that claim to provide a server based on the Fedora distribution. An example of this is the xref:virtualization/vm-install-diskimg-virtbuilder.adoc[virt-builder] system. However, it is not a Fedora Server, but its own, deviating concept for the configuration of a server. And accordingly, e.g., the Fedora Server administration tools and principles may not fit.
// Image Factory is no longer available- ToDo: Update to Kiwi and/or imagebuilder // System administrators can also create their own disk images using tools such as _xref::tutorials/imagefactory.adoc[Image Factory]_ or __Image Builder__.
== What you get
@ -26,9 +28,11 @@ To begin with, you gain time. Instantiating a virtual disk image takes only a fe
Fedora Server KVM image resembles all features and properties of a Fedora Server as close as possible, except for directly hardware-related measures, of course. In general, the system administrator of a virtual server (guest system) can perform configuration and administration largely independently and autonomously from the system administrator of the host system. Ideally, they should not notice any difference in everyday practice. As the system administrator of the host is limited by the available hardware resources, the administrator of the guest system is just limited only by the virtual hardware resources.
=== Fedora Server Edition and Fedora Cloud Edition
Unlike a cloud image, Fedora Server VM is designed to run like any self-sustaining server, albeit optimized for a generic hypervisor (here QEMU/KVM/libvirt) rather than bare-metal hardware.
_Fedora Cloud Image_ and _Fedora Server Image_ have in common that they adhere to the build process and control of the distribution.
Both have in common that they adhere to the build process and control of the distribution. However, they follow different principles of data administration and organization, and are subject to different workflows.
== How it works
The creation of a virtual machine image involves two steps.
@ -52,20 +56,23 @@ Overall, the process is very straightforward and efficient.
We assume a complete installation of virtualization support according to the xref:virtualization/installation.adoc[Adding Virtualization Support] guide.
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.
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,]
----
[…]$ sudo -i
[…]# cd /var/lib/libvirt/boot
[…]# wget https://download.fedoraproject.org/pub/fedora/linux/releases/41/Server/x86_64/images/Fedora-Server-KVM-41-1.4.x86_64.qcow2
[…]# wget https://download.fedoraproject.org/pub/fedora/linux/releases/41/Server/x86_64/images/Fedora-Server-41-1.4-x86_64-CHECKSUM
[…]# 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-41-1.4-x86_64-CHECKSUM
[…]# 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-KVM-41-1.4.x86_64.qcow2: OK
Fedora-Server-Guest-Generic-43-1.6.x86_64.qcow2: OK
sha256sum: WARNING: 17 lines are improperly formatted
----
+
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,]
@ -74,33 +81,34 @@ If you copy or move files directly from elsewhere, you should check the correct
[…]# 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 7GB, of which about 6GB in the root file system is free. This is not intended for pro­ductive 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.
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,]
----
[…]# cd /var/lib/libvirt/boot
[…]# cp Fedora-Server-KVM-41-1.4.x86_64.qcow2 Fedora-Server-KVM-41-custom.qcow2
[…]# qemu-img info /var/lib/libvirt/boot/Fedora-Server-KVM-41-custom.qcow2
[…]# qemu-img resize /var/lib/libvirt/boot/Fedora-Server-KVM-41-custom.qcow2 40G
[…]# qemu-img info /var/lib/libvirt/boot/Fedora-Server-KVM-41-custom.qcow2
[…]# 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.
+
If you intend to create multiple VMs with similar structure, it may be useful to customize the customised file in detail. See section _Import via CLI and elaborated initial configuration_ further down.
//+ ToDo: Write a excursus on image customization
//If you intend to create multiple VMs with similar structure, it may be useful to customize the customised file in detail. See section _Import via CLI and elaborated initial configuration_ further down.
== Instantiation of a Server virtual machine
=== Alternative 1: Import efficiently via CLI
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.
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 <VM_NAME>) to log in and obtain a terminal window.
[source,]
----
[…]# cp /var/lib/libvirt/boot/Fedora-Server-KVM-41-custom.qcow2 /var/lib/libvirt/images/{VM_NAME}.qcow2
[…]# cp /var/lib/libvirt/boot/Fedora-Server-43-custom.qcow2 /var/lib/libvirt/images/{VM_NAME}.qcow2
[…]# virt-install --name <VM_NAME> \
--memory 4096 --cpu host --vcpus 2 --graphics none \
--os-variant fedora41 \
--os-variant fedora-unknown \
--import \
--disk /var/lib/libvirt/images/<VM_NAME>.qcow2,format=qcow2,bus=virtio \
--network type=direct,source=enp1s0,source_mode=bridge,model=virtio \
@ -108,7 +116,7 @@ Copy the customized distribution file into the disk image pool and use virt-inst
----
[IMPORTANT]
====
If a message "Unknown OS name 'fedora41'" appears, the list has not yet been updated in virt-install. You can then use "fedora-unknown" without any problems.
If a message "Unknown OS name 'fedora43'" appears, the list has not yet been updated in virt-install. You can then use "fedora-unknown" without any problems.
====
The parameters are quite descriptive and are to be adjusted accordingly. You will find a more detailed explanation in the appendix.
@ -292,7 +300,8 @@ Users of a non-US keyboard layout probably want to customize the keyboard layout
[…]# localectl
System Locale: LANG=en_US.UTF-8
VC Keymap: us
X11 Layout: us
X11 Layout: us
X11 Model: pc105
----
+
List available keyboard mappings filtered by your short county code part
@ -363,6 +372,8 @@ d. Correct time if necessary:
----
[…]# timedatectl set-time <TIME>
----
+
If you get a warning about RTC time set to local time, follow the instructions to fix it.
5. *Consolidate the network configuration*
+
@ -486,14 +497,24 @@ By default nano is the default system editor in Fedora. Many experienced system
[…]# dnf update
[…]# reboot
----
9. *Close the virsh console mode*
+
You were automatically in virsh's console mode until now. Exit this mode and you will be back on the host system.
+
[source,]
----
[…]# <ctrl>]
Domain creation completed.
[…]#
----
If you opted for Cockpit to instantiate the VM you may use Cockpits graphical interface for the last 4 steps.
Anyway, you should now test to connect via ssh to the system, if it provides an external interface.
Anyway, you should now test to connect via ssh to the system using the usual way, i.e. using one of the configured interfaces.
== Set up storage
Fedora Server KVM follows the same storage organization principles as the base installation. The xref:installation/index.adoc#Planning_ahead[Fedora Server Installation Guide] explains the principles and the available choices. You have to make the same choice here.
Fedora Server KVM guest follows the same storage organization principles as the base installation. The xref:installation/index.adoc#Planning_ahead[Fedora Server Installation Guide] explains the principles and the available choices. You have to make the same choice here.
The distributed disk image features a disk size of about 7 gb. This is not intended as a default value to use but as a starting value for adaptation to the specific installation requirement. You have probably already adjusted the total desired size at the xref:#instantiation_of_a_server_virtual_machine[begin of installation]. If not, shutdown the virtual machine and adjust the size now. As already noted, you need not to be too sparing in the choice. You can easiy enlarge the maximum size later. And thanks to the qcow2 format, it allocates just the space that is actually needed and doesn't waste resources. On the other hand, there is also no reason to be overly generous.