Fedora Linux Installation and Configuration

This guide shows how I install Fedora Linux on my computers. This guide covers Fedora Workstation and Fedora Silverblue editions. I use Fedora Linux as the primary operating system on my computers, which use the x86_64 or AArch64 architecture and boot via UEFI, usually with Secure Boot enabled.

The information on this page was updated for Fedora version 39.

Updated
January 6, 2024
Previous versions
Fedora 38 Installation and Configuration
Fedora 35 Installation and Configuration
Fedora 32 Installation and Configuration
Fedora 28 Installation and Configuration
Fedora 24 Installation and Configuration
Fedora 22-23 Installation & Configuration

Although I originally wrote this guide for myself, anyone else may find these notes useful. Be careful with the commands presented in this document if you don't know what they mean, especially commands that begin with sudo.

You proceed at your own risk.

Recent versions of Fedora Linux are user-friendly out-of-the-box, so there is a chance that you won't need to apply any configuration mentioned in this document.

When Upgrading: Clean Install vs. Upgrade

If you run a previous version of Fedora that is still supported, you can upgrade to the latest version directly. Gnome Software or DNF can be used to upgrade. In that case, find the official documentation. The Fedora Linux download page is a good starting point to get more information.

I prefer performing a clean installation each time a new version of Fedora is released, which is roughly every six months, and this guide reflects this approach. Because I tend to store only the necessary minimum of data on my computers, it is not a problem for me to copy all my files to external storage, perform a clean installation, and copy my files back.

Back Up Files and Configuration from the Previously-Installed Operating System

If you intend to replace an existing installation of the operating system, consider backing up all important data and collecting as much information about the installed software as possible.

The instructions in this section assume the previously installed operating system was Fedora Workstation, and you can skip these steps if you don't have any data to back up.

Back Up Personal Files

Personal files of each user are located primarily in the /home/$USER directory (which is /home/david in my case).

Sometimes, I store shared files in /srv/ too.

Back Up SSH Keys

If needed, back up user's SSH keys that are in the ~/.ssh folder.

Back Up Browser History

Back up bookmarks and history from the web browser. I use Firefox, and although it can synchronize with other of my devices and restore the bookmarks and browsing history on a fresh Firefox installation, I found that it doesn't restore all of the browsing history.

Firefox stores user profile data in separate folders in ~/.mozilla/firefox/, but it's not a good idea to back up and restore all contents of the profile folder. Instead, I select only some of the files mentioned on this Mozilla support page:

When restoring the files after a clean Firefox installation, I open the Firefox profile manager, create a new profile, locate the profile folder under ~/.mozilla/firefox/, and copy over the backed-up files.

List Installed Packages and Programs

List packages that were installed manually via DNF:

sudo dnf history list
sudo dnf history userinstalled

List programs installed with Flatpak:

flatpak list --app

List Flatpak repositories:

flatpak remotes --show-details --show-disabled

Some software may have been installed outside of the package manager (from a script, etc.). This may include Mathematica or Matlab. Therefore, also check other possible locations (e.g., /opt) to identify these programs.

Back Up Virtual Machines

If you use virtual machines, consider backing up their configuration and data.

List virtual machines installed through virsh (or the virt-manager GUI):

sudo virsh list --all

Get the configuration of a virtual machine:

sudo virsh dumpxml VMNAME > VMNAME.xml

Back Up all files mentioned in the exported configuration file. These might include:

Note that the virtual disk images may be large sparse files. For example, a raw disk image that has a capacity of 80 GB and contains only 6 GB of data can occupy as little as 6 GB of the host's storage if it is a sparse file. Make sure that sparse disk images are treated as sparse during copying to save space.

It is also beneficial to re-convert or even compress qcow2 images to reduce their size:

qemu-img convert -c -O qcow2 img.qcow2 img-copy.qcow2

To restore the virtual machine later, I recommend first creating and then deleting a new virtual machine so that QEMU sets the correct permissions and BTRFS attributes on the relevant file system locations. Then, put the previously backed-up files in their correct location, and define the virtual machine from the configuration file:

sudo virsh define VMNAME.xml

Back Up Podman and Toolbox Containers

Also, make sure you don't have any important files stored in containers. These commands may be helpful:

podman container list --all
podman image list
toolbox

Back Up the EFI Partition

If you want to install Fedora as a secondary operating system (dual boot), you may want to back up the contents of the /boot/efi/EFI/Boot/ directory on your hard drive. This folder is located on the EFI system partition, and it usually contains default boot files, which may be overwritten during Fedora installation.

Download the Installation Media

After making sure all important data is backed-up, you can move on to the installation of the new Fedora. Download the installation image of Fedora Workstation from the official Fedora download page, verify the SHA checksum, and follow their instructions to successfully create an installation drive from the image. More information on how to create the installation media can be found on a Fedora Docs page.

If you want an immutable system where the operating system is read-only and all regular applications are installed via Flatpak, you can try Fedora Silverblue instead of Fedora Workstation. Fedora Silverblue has a separate download page.

For a universal netinstall medium that can install any flavor of Fedora from the online repository, download the Everything image from the Fedora Alternative Downloads page.

Lastly, if a new Fedora version is planned for release, it is possible to download composed betas and release candidates from https://dl.fedoraproject.org/pub/alt/stage/. This way, I can download the beta or the final approved build about a week before it officially shows up on the Fedora website.

I usually use the dd tool to write the downloaded image to a USB flash drive. This command will overwrite data on the target drive, so be careful! Double-check the output of the lsblk command to make sure that you are writing the image to the correct drive!

sudo dd if="Fedora-Workstation-Live-x86_64-39-1.5.iso" of=/dev/USBDRIVE bs=8M status=progress oflag=direct

It might also be helpful to see the Release Notes and the Installation Guide, both links are provided on the official Fedora download page.

(Optional) Erase All Contents of the Hard Drive Prior to Installation

First, boot from the created installation media. The live media is highly preferred for this task because it comes with the blkdiscard tool already installed.

If you want to erase the contents of the computer's hard drive, make sure that LVM or Luks don't use the drive and that no partitions on the target drive are mounted:

lsblk

If installing on an SSD, it is a good idea to TRIM all of its space. The TRIM operation tells the SSD that all of the SSD capacity is unused. After this step, the SSD drive will most likely appear as empty with no partitions. Just issue one blkdiscard command, there's no need to issue ATA Secure Erase or NVMe format on the drive under normal circumstances.

sudo blkdiscard -vf /dev/DRIVE

If the drive doesn't support TRIM, or if the partition table is still visible after the TRIM command finished executing, delete the partitions using gdisk. Enter the Expert mode (x), and zap (z) all partition tables. Note that gdisk doesn't come installed by default on Fedora Workstation 39 anymore, so you may have to instal it first.

sudo dnf install gdisk
sudo gdisk /dev/DRIVE
x
z

After the hard drive is erased, I reboot the computer in order to start the installer from a fresh state.

Installation

Boot from the installation media.

The installation is straightforward. Use the default options so that the installer formats the whole storage drive and installs the Fedora Linux operating system.

Back when Fedora Workstation used LVM instead of BTRFS, the live media, by default, configured LVM and used the current "live" hostname as the name. To change the LVM name, one could change the hostname just before proceeding with the installation:

hostnamectl hostname pc4.localgroup

When installing Fedora over a serial console without a monitor connected, the Anaconda installer can be accessed via VNC by adding this boot parameter when booting from the installation media:

inst.vnc inst.vncpassword=PASSWORD

In the parameter above, the PASSWORD can be a string of six to eight characters. Once the installer starts, it is accessible via VNC on port 5901.

After Installation

These are my recommended steps to do after the installation. Neither of them is required for Fedora to work, but they make my life easier.

Disable PackageKit

PackageKit and DNF apply only to Fedora Workstation and Fedora Server (and other Fedora Spins). Fedora Silverblue uses rpm-ostree and Flatpak instead.

My biggest annoyance with Fedora Workstation is its implementation of PackageKit, which is also used by the Gnome Software app. The situation is better today compared to the past when the DNF package manager recognized all software installed via Gnome Software as unneeded and wanted to remove it. But even in more recent Fedora versions, Gnome Software (PackageKit) left unused dependencies after a package removal and seemed to not share all of its metadata information with DNF. At the very least, PackageKit used disk space by keeping its own cache for downloaded packages, which was separate from the cache used by DNF.

Either disconnect the computer from the network before it first boots, so that PackageKit doesn't have a chance to start downloading any updates, or free the package cache of PackageKit later:

pkcon get-transactions
sudo pkcon refresh force -c -1
du -sh /var/cache/PackageKit/

Prevent PackageKit from ever starting again:

systemctl status packagekit.service
systemctl stop packagekit.service
systemctl mask packagekit.service

From now on, I use DNF instead. The following commands upgrade installed packages, install new packages, uninstall packages, check whether some system services need to be restarted after an update, and verify the integrity of installed packages.

sudo dnf --refresh upgrade
sudo dnf search PACKAGENAME
sudo dnf provides BINARYNAME
sudo dnf install PACKAGE
sudo dnf remove PACKAGE
sudo dnf needs-restarting
rpm -Va

Note that it is recommended to boot into a minimal environment, or at least log out of GNOME and switch to a non-graphical console (e.g., Ctrl+Alt+F3), before running the dnf upgrade command to avoid possible program crashes caused by modifications to the running system.

Set the Hostname

I use this command to set the hostname. In this example, the computer name will be pc4.

hostnamectl hostname pc4

Install Updates

Install all available updates and reboot.

On Fedora Workstation (WARNING: better to do it in a text console or a screen session as it modifies the running system, which may cause the graphical session to restart and kill the Terminal window):

sudo dnf --refresh upgrade

If using Fedora Workstation Beta, run this command before installing updates:

sudo dnf --refresh upgrade 'fedora-repos*'

Beta versions of Fedora have the updates-testing repository enabled by default. Shortly before the final release, fedora-repos and fedora-repos-modular packages are updated to disable the testing repositories. Running the command above minimizes the chance of installing unwanted testing updates into the stable release.

To synchronize the installed beta version of Fedora with the stable version once it is released, one can run:

sudo dnf --refresh distro-sync

On Fedora Silverblue (safe to run anytime):

rpm-ostree upgrade

Finally, reboot to reload all software components (Workstation) or to boot to the new image (Silverblue):

systemctl reboot

Install Additional Packages

This is a list of some useful packages that may be worth installing.

GUI system configuration tools. They usually provide a simple user interface to already installed command-line tools.

And finally, these are some of the console programs that I install the most often.

Useful package groups

There does not seem to be a way to install package groups on Fedora Silverblue yet. A toolbox instance can be used to list the group packages and then use rpm-ostree to install these individual packages.

To list available package groups, use the following command.

sudo dnf group list

The following command shows all possible groups.

sudo dnf group list -v hidden

I found the following package group useful for C/C++ programming and debugging.

sudo dnf group install 'C Development Tools and Libraries'

If you want to use virtualization, see Fedora docs.

sudo dnf install @virtualization
sudo usermod -a -G libvirt "$USER"

RPM Fusion Repositories

Besides some low-level firmware, Fedora doesn't ship with any other proprietary or non-free software. This includes some of the popular multimedia codecs, such as H.264 (Fedora didn't even have MP3 music format support before the relevant patents expired). The RPM Fusion repository provides some of this software instead.

The up-to-date instructions to enable the RPM Fusion repository are on the RPM Fusion website. They also have useful how-to guides.

Enable RPM Fusion free and non-free repositories:

sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

Update AppStream metadata:

sudo dnf groupupdate core

Flatpak and Flathub Repository

Flatpak is the recommended way to install software on Fedora Silverblue. It is also a good idea to use it on Fedora Workstation. By default, Fedora comes with its own Flatpak repository enabled. But the main source for Flatpak apps, including proprietary software, is Flathub. The latest official instructions can be found on the Flatpak website. Note that there are also many other Flatpak repositories in existence.

Note that the latest Fedora versions may already come with the Flathub remote installed, but not enabled by default. To see the already defined Flatpak remotes, run:

flatpak remote-list --show-disabled

I usually enable some of these Flatpak remotes:

flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --if-not-exists flathub-beta https://dl.flathub.org/beta-repo/flathub-beta.flatpakrepo
flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo
flatpak remote-add --if-not-exists kdeapps https://distribute.kde.org/kdeapps.flatpakrepo
flatpak remote-add --if-not-exists rhel https://flatpaks.redhat.io/rhel.flatpakrepo

Snap (I Don't Use It)

Snap is Ubuntu's alternative to Flatpak. The biggest difference from Flatpak is that there is a single repository that contains all Snaps (this repository is proprietary and controlled by Ubuntu's maker Canonical), and that Snap may miss some important security features when used on Linux distributions other than Ubuntu. Here are official docs on how to setup Snap on Fedora.

I don't use Snap.

Codecs

Fedora doesn't ship with non-free software, which includes many multimedia codecs. These are instructions to install the most important codecs for the usual video and audio playback. Up-to-date information can be found at RPM Fusion FAQ and RPM Fusion Howtos. RPM Fusion repositories must be enabled for this to work.

Install multimedia codecs:

sudo dnf swap ffmpeg-free ffmpeg --allowerasing
sudo dnf groupupdate multimedia
sudo dnf groupupdate sound-and-video

To install only the OpenH264 codec without RPM Fusion, follow the Fedora Wiki.

I also use some additional codecs for HEIF/HEVC, H.264, and H.265, which come in these packages:

Enable HW video acceleration on Intel GPUs:

sudo dnf install intel-media-driver

On older Intel GPUs:

sudo dnf install libva libva-utils
sudo dnf install libva-intel-driver

Better Font Rendering (Not Needed Anymore)

Default font rendering on Fedora is now much better than it used to be a few years ago. Also, some software patents regarding subpixel font rendering have expired, so there is no longer a need to download the freetype-freeworld package from RPM Fusion.

By default, Fedora uses Slight hinting and grayscale sub-pixel rendering. To further improve the rendering, RGB sub-pixel rendering can be used. It improves the font readability on low-DPI screens, but it may cause colorful edges. It also looks terrible when the screen is rotated (when the sub-pixel RGB order changes).

gsettings set org.gnome.settings-daemon.plugins.xsettings antialiasing 'rgba'
gsettings set org.gnome.settings-daemon.plugins.xsettings hinting 'slight'
gsettings set org.gnome.settings-daemon.plugins.xsettings rgba-order 'rgb'
sudo ln -s /usr/share/fontconfig/conf.avail/10-hinting-slight.conf /etc/fonts/conf.d/
sudo ln -s /usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d/
sudo ln -s /usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d/

Years ago, I verified that the result exactly matched Ubuntu 20.04 (Ubuntu was known for its nice font rendering out of the box). Patched packages like freetype-freeworld are thus no longer needed. Pop!_OS 19.10 used different settings than Ubuntu (grayscale).

I now use 4K monitors, and font rendering is not an issue for me anymore. Also, GTK 4 changed the default font rendering to look better on high-pixel-density displays.

Other Gnome Tweaks

I usually change these settings in Gnome Settings:

Enable natural mouse scroll
Settings -> Mouse & Touchpad -> Scroll Direction -> Natural
Set the clock to use the AM/PM format
Settings -> Date & Time -> Time Format -> AM / PM
Turn off automatic suspend
Settings -> Power -> Automatic Suspend -> Off
Increase screen blank timeout
Settings -> Power -> Screen Blank -> 10 minutes
Set monitor scaling on high-density monitors
Settings -> Displays -> Scale -> 200%
Turn the Night Light on
Settings -> Displays -> Night Light -> On

Disable Gnome automount

I don't want storage devices that I connect to the computer to be mounted automatically. I also don't like having all my unmounted drives automatically remounted after unlocking my screen after some time of inactivity. This may have been fixed, but it was super-annoying when I was doing a bitwise copy of a storage device, and it was automatically getting mounted mid-process.

Disable automatic mounting of storage drives in Gnome:

gsettings set org.gnome.desktop.media-handling automount false

Disable File Indexing of /mnt (Optional)

I mount external file systems to the /mnt directory. It is annoying when I am copying large amounts of data between two external hard drives, and the copying slows down because the system decides to index the files on those drives.

Disable indexing of the /mnt directory:

sudo vi /etc/updatedb.conf

Add /mnt to the PRUNEPATHS variable and save the file.

The plocate-updatedb.service and plocate-updatedb.timer services are responsible for the indexing.

Tips and Tricks

Some tips and hardware-specific problems are mentioned here.

Make Sure SSD TRIM is Enabled

Prior to Fedora 32, TRIM was not enabled by default. The user had to run one of the following commands to trim the free space on mounted SSD storage devices:

sudo fstrim -v --fstab
sudo fstrim -a -v

Fedora 32 enabled the fstrim.timer service, which performs this operation automatically every week (other distributions had been doing this for years). To verify that TRIM is being issued automatically, run:

systemctl status fstrim.service

Recent Fedora versions don't seem to enable the fstrim timer. This is fine because BTRFS now mounts with a discard=async mount option by default since Linux kernel version 6.2. This option sends trim commands shortly after files are deleted, so there is no need for a periodic invocation of fstrim anymore.

To check which storage devices support the TRIM (discard) operation, run the following command and check that the DISC-GRAN and DISC-MAX columns of the drive contain non-zero values.

lsblk -D

How to Update GRUB Parameters (If Needed)

My old Sandy Bridge laptop has a strange feature: there is a non-existent monitor connected to one of the GPUs (probably the Nvidia one). This monitor can be disabled by passing a parameter to the GRUB command line. But Fedora seems to change the way to permanently modify these parameters with each new release.

Probably in Fedora 31, I used this command to add the video=VGA-2:d parameter:

grub2-editenv - set "$(grub2-editenv - list | grep kernelopts) NEW_PARAMETER"
sudo grub2-editenv - set "$(sudo grub2-editenv - list | grep kernelopts) video=VGA-2:d"

On Fedora 32, I did a bit of research into this topic. It appears that there are at least three ways to add additional parameters to the GRUB command line.

The first option uses grubby-bls in the background (older, this may copy the cmdline arguments instead of using the kernel args variable):

sudo grubby --update-kernel=ALL --args="video=VGA-2:d"

The second option modifies the variable directly (probably preferred?):

sudo grub2-editenv - set "$(sudo grub2-editenv - list | grep '^kernelopts') video=VGA-2:d"

The third option should be equivalent to the second option, although I haven't tried it:

vi /etc/defaults/grub
grub2-mkconfig

The situation is very simple on Silverblue:

rpm-ostree kargs video=VGA-2:d

Enable TRIM on Silverblue when using LUKS

Fedora Workstation is configured to pass TRIM commands to the underlying device if full-disk encryption (LUKS) is used. This does not seem to be the case in Silverblue. I don't know whether this is a feature or a bug, but it can be enabled anyway.

rpm-ostree initramfs --enable --arg=-I --arg=/etc/crypttab

Verify:

lsinitrd /boot/ostree/fedora-885446f122734a39e9b9e600ce8fb0532d93d874c17db48c6676c55f3c447bd3/initramfs-5.3.7-301.fc31.x86_64.img | fgrep crypttab

An alternative, without having to re-generate initramfs on every rpm-ostree transaction:

rpm-ostree kargs --append rd.luks.options=c28fdfe4-ba7d-49bf-896f-5ffca011c39a=discard