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

23,241FansLike
399FollowersFollow
16SubscribersSubscribe

LATEST ARTICLES

MUST READ

The year is 2020, and Linux-based operating systems have never been more popular. All thanks to their increased security and privacy, smooth updates, and open-source nature, everyone wants to at least give a shot to its multitude of distributions. Now we have already covered some of the best Linux-based laptops that you can find in the market as of now. With that being said, we get it that they are not everyone's cup of tea, so Linux PC desktops are also something that you should be taking a look at as well.
“I am because you are,” is the themed meaning behind the famed Ubuntu operating system. Moreover, this mindful phrase is practical because it continues to lure more individuals into the Ubuntu universe. Because great power beckons great responsibility, Ubuntu is stepping up. It realizes that different users will want to use the Ubuntu operating system software differently.

5 Best Ways to Free up Hard Disk Space in Ubuntu

Hard disk space can easily get filled up with cached package files, old kernels, and other obsolete files that occupy unwanted hard disk space. Here are top five best and safer ways to clean and free up hard disk space in Ubuntu. We show you Terminal and GUI way of cleaning up system.

Top 10 Reasons to use Xfce as your Desktop Environment

There are many choices for desktop environments for Linux based operating systems. Mainly, you can install any DE of your choice on most of the Linux based distributions, even if they are not offered as a package officially. In our recent articles, we discussed the best of KDE and Cinnamon. In this article, we wish to present to you the top reasons why you should consider Xfce as your desktop environment.

Top 5 Linux Distros for Windows Users

When Microsoft initially released Windows 7 in October 2009, the software giant committed to providing ten years of support for its popular operating system.  The much-maligned Microsoft was true to their word, support for Windows 7 ended just yesterday a little over ten years after its release.

Removing the Virus from a Windows PC with a Ubuntu Live USB drive

In this tutorial, we are going to show you how to clean your Windows machine from infected viruses using an Ubuntu live USB or CD and the ClamAV antivirus. The ClamAV is a free, open-source antivirus that can be used on Ubuntu.