How to Offline Update Fedora Workstation

Did you want to update your Fedora offline? It is possible to download the system updates on to a USB drive when having an internet connection, and then apply it offline to another Fedora system.

Are you running Fedora as your favorite Linux distribution? Do you have a slow or no internet connection? If so, read along and know how to use the Fedora Offline Package Manager. Fedora Offline Package Manager (OPM) is a solution for users who want to update their system and install new packages without the internet.

The OPM is available in two applications. The command-line version and a web application developed in Python-flask.

Offline Fedora Update

In this post, we will focus on the command-line way, which will require us to run a couple of terminal commands.

Use Cases

Let’s look at some of the situations where the Fedora Offline Package Manager would be a reliable utility for Fedora users.

  • Having a good internet connection at your college or workplace but limited internet access back at home where you have a PC running Fedora
  • Relocating to a place with unreliable or no internet connection
  • No internet access at home, but you can go to a cybercafe with good bandwidth

Fedora and other RPM-based Linux distros use the DNF package manager to install, update and remove packages. To download packages for offline use in Fedora, we use the DNF command with the “download only” parameter. Let’s see how you use Fedora Offline Package Manager.

Update all system packages

The Fedora DNF command has several functions, but one of the best is the “download” option. You can use it to download an RPM package and install it on any Fedora system without an internet connection.

To get started, we first need to get all the package names we need to download on our offline PC. You can easily do this by running the command below.

dnf repoquery --upgrade --queryformat '%{name}.%{arch}'

Update all system packages
Update all system packages

Copy all the listed packages on the Terminal and save them in a file – say “package_updates.txt.” To download the packages, run the command below.

dnf download --resolve $(cat package_updates.txt)

Download Packages
Download Packages

You can also include the “–downloaddir” argument to download RPM packages to a specific directory.

dnf download --resolve $(cat package_updates.txt) --downloaddir="/home/tuts/Desktop/programs"

Downloads Directory
Downloads Directory

Copy the downloaded packages on a USB drive to use on the offline computer. To install the packages, use the “dnf install” command.

sudo dnf install /path-to-rpm

However, there is a drawback here. You will have to execute the above command for every package. That will be tiresome when you have hundreds of packages to install. To solve this, we can automate the whole process with a simple bash script.

#! /bin/bash
for FILE in *;
do dnf install $FILE;
done

Save the file as ‘.sh’ file – say ‘installer.sh’ and put it in the directory containing your downloaded packages. Now, run the bash script with root privileges.

sudo installer.sh

Install packages
Install packages

Download single Apps

Alternatively, you can download updates for specific applications. To get started, launch the Terminal on the computer with an internet connection. You can use the keyboard combination Ctrl + Alt +T to open it. We will download Chromium and install it on our offline Fedora system. Type the command below:

sudo dnf download chromium

Download Chromium
Download Chromium

This command will download the latest release of the Chromium browser and save it in the “/var/cache/dnf” directory. You can access this directory with the change directory “cd” command, as shown below.

cd /var/cache/dnf

Once in this directory, look at the various sub-directories present and copy your files to a USB drive. If the file is not in the “/var/cache/dnf” directory, check your home folder.  Copy the file in a USB drive to install it on your offline computer using the command below.

sudo dnf install /path-to-package

Install Chromium
Install Chromium

In case you get the error “No such command” with the “dnf download” command, you will need to install “dnf-plugins-core.”

sudo dnf install dnf-plugins-core

Download Apps to a specific directory

It can be quite a hassle navigating through the “/var/cache/dnf” or home directory since there are other sub-directories present. Fortunately, we can force the DNF to download packages to a specific folder with the “–downloaddir” argument.

In the command below, we want to download the chromium package to the Programs folder on the Desktop.

sudo dnf download --downloaddir="/home/tuts/Desktop/Programs"

Downloads apps with dependencies

The above commands will download the RPM package from the Fedora repository for use in computers with limited internet access. However, if you want to download every single library and dependency required by an application, we will use the “–resolve” parameter.

For example, to download Chromium and all its dependencies, we will use the command below.

sudo dnf download chromium --resolve

Download Chromium
Download Chromium

To download to a specific directory, we will add the “–downloaddir” parameter.

sudo dnf download chromium --resolve --downloaddir="/home/tuts/Desktop/programs"

To install, run the command below.

sudo dnf install chromium

Conclusion

That’s a complete guide on how to use the Fedora Offline Package Manager (OPM). You can now install updates and applications on any offline Fedora system with much ease. Be sure to share with our readers how you go about with this powerful OPM in the comments below.

Arun Kumar
Arun did his bachelor in computer engineering and loves enjoying his spare time writing for FOSS Linux. He uses Fedora as the daily driver and loves tinkering with interesting distros on VirtualBox. He works during the day and reads anything tech at night. Apart from blogging, he loves swimming and playing tennis.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

22,975FansLike
407FollowersFollow
16SubscribersSubscribe

LATEST ARTICLES

MUST READ

Exploring the top 10 most acceptable Linux distributions for fellow gamers is our main goal in this article. These have been hand-picked because of the overall experience you will get when you are gaming with them. The progress on Linux gaming development has been impressive over time, and it is no longer a dream.
The fight for dominance in the Linux desktop environments has mostly been a tug of war between GNOME and KDE. It is difficult to portray a winner in this tug of war. The user community influence and its user preference determine which Linux desktop environment to choose as an adaptive platform. This presumed stalemate in the Linux desktop arena portrays KDE and GNOME as the main major players.