Before Linux From Scratch
Before Linux From Scratch
I want to attempt to build Linux From Scratch, but I need something to build it on. Whilst I could use an old laptop, it isn’t going to be compiling from source very quickly.
Instead am going to be building in a virtual machine with plenty of allocated resources. So, I need to setup a virtual machine.
Setting up a virtual machine
I am setting up a virtual machine on my desktop PC running Fedora 35 using Virtual Machine Manager.
It is assumed at this point that virtualisation is supported by the hardware, all the necessary packages are installed and the following steps will just work without any issues.
Installing Virtualisation Software on Fedora
Install the virtualisation package group:
$ sudo dnf group install --with-optional virtualisation
Start the libvirtd service:
$ sudo systemctl start libvirtd
Start the libvirtd service at boot:
$ sudo systemctl enable libvirtd
Verify KVM kernel modules are correctly loaded:
$ lsmod | grep kvm kvm_amd 114688 0 kvm 831488 1 kvm_amd
Using Virt-Manager to Create VM Storage
Open up Virtual Machine Manager:
Start the process of creating a new Virtual Machine:
Configure the Hardware for the VM:
Enable and create storage:
When prompted for storage….
Choose to create a new storage pool:
Here a new directory “LFS2” is used as a the target location for the pool.
The new storage pool location now appears in the list.
Selecting the new “LFS2” storage pool we can see that it is currently empty. Before it can be used we need to add some storage to it.
Create a virtual disk (of an appropriate size) on which the host OS will be installed.
Virtual disk for host OS now appears in storage pool.
Create a second virtual disk for the virtual machine to use. It is on this second disk that Linux From Scratch will be installed. Later once LFS is completed, a virtual machine will be able to boot from this disk into a LFS instance. This disk has been made a little larger (30GB) to allow a little room for growth.
The LFS storage volume appears in the storage pool.
Select the volume from the storage pool on which the host virtual machine will be installed. This is fedora35-2.qcow2 in this example.
Begin the creation of the Virtual Machine. In this case the Fedora 35 Live ISO is booted. There is then the option to install Fedora 35. Manually run the installer to install our host os on to our first storage volume. I’ve skipped over the actual installation process as it doesn’t add anything this to this guide. Shut the VM down post install and it will be ready to use for whatever you want.
New Virtual Machine appears in list of VMs:
Installing Virtual Machine on Fedora via command line
Above the VM was setup using the graphical method. It is possible to do this from the command line and achieve the same result.
TODO: Add this later.