About a week ago I wrote about using QEMU/KVM to help install Fedora 37 pre-release on my little Linux Mint 21 system. Everything went well, except for the weird blip in sharing a part of the host file system with the virtual machine instance. This time, I decided to install an official Fedora 37 release, a spin using the Cinnamon DE, and do it in a streamline fashion complete with screen captures.
As you’ll note, the Virtual Machine Manager, or VMM, already has one entry, Fedora 37 with the Gnome 43 DE. From here I’m going to add a second VM by first clicking the ‘+’ symbol at the top left directly underneath ‘File’.
We’re going to take the default, ‘Local install media.’ That’s because I downloaded the Fedora Cinnamon ISO.
VMM is now asking where the local media is located. In this example VMM already knew about Downloads because I’d clicked the Browse Local button to find it for the first installation.
Now click ‘Forward.’
The memory default is 2048 MB. I’ve doubled it to 4096 to keep from hitting the VM swap so hard, especially when doing a major update (which will come after the initial installation). Click ‘Forward.’
We’re going to take all the defaults. Clock ‘Forward.’
Here’s where we’re going to take a different path. Make sure to click the ‘Customize configuration before install’ checkbox. I also changed the name of the VM to ‘cfedora37.’ Now click ‘Finish.’
The VMM will now show virtual machine details panel. Select ‘Memory,’ and on the Memory page make sure to click the ‘Enable shared memory’ checkbox. Now click the ‘Add Hardware’ button at the bottom.
On the ‘Add New Virtual Hardware’ dialog select ‘Filesystem’. On the ‘Source path’ field click ‘Browse…’
You’ll get a standard file browse dialog, from which you can select any host folder to share. As before I’m using ‘Shared.’ Note that you’ll use the full file path. In the ‘Target path’ I put label that I’ve used before. The target path really isn’t a path, at least not for the virtual driver being used in this version of QEMU/KVM. Click ‘Finish’, then ‘Apply’ on the details dialog, and then begin installation.
Once fully installed and with all the updates, and a bit of installation configuration and setup after first boot, I finally started Fedora Cinnamon.
I’ve configured this VM to look like my host Linux Mint desktop. In order to mount the shared drive inside the VM, I actually wrote a simple bash script to mount it when its called.
#!/usr/bin/env bashif mountpoint -q ~/Shared; thenecho "~/Shared already mounted."elsesudo mount -t virtiofs mount_tag ~/Sharedfi
The script is very simple. It checks to see if the host filesystem is mounted locally (remember, ~/Shared
), and mounts it if it’s not. If it is it just tells you that. The Fedora home directory come default with a folder named ~/.bashrd.d
. The top level login script, ~/.bashrc
, contains a section that scans that hidden folder and executes every script it finds. One of them is mount-shared.sh
. That means every time you open a console that file is executed within that folder along with every other script. And frankly, I’d rather mount it from within the account, rather than muck with fstab, which can be royally screwed up if you fat-finger that critical file.
I’m lazy, and I don’t like typing in my password every tine I use sudo
to perform an action, such as mounting the shared volume. To avoid that I’ve added the following file:
/etc/sudoers.d/010_fedora-nopassword
Within that file I have the line:
fedora ALL=(ALL) NOPASSWD: ALL
The first element of that line is the account, and in my VMs I simple create an account called ‘fedora’. If it were ‘bob’, then ‘bob’ would be in the place of ‘fedora’. But this one line allows me to run sudo without having to enter my password. And it allows me to do that without having to edit the file /etc/sudoers
, which I’ve screwed up royally in the past.
There are other features about QEMU/KVM virtual machines I need to investigate, but right now I’ve done enough.
You must be logged in to post a comment.