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,312FansLike
385FollowersFollow
16SubscribersSubscribe

LATEST ARTICLES

MUST READ

Buyers who wish to go for a machine that is based on Linux often show interest in Chromebooks due to the form factor and extended battery life capabilities. Although ChromeOS power these machines, users can still miss out on a more genuine Linux experience. For those who happen to agree, the new Lemur Pro by System76 might get some heads turning.
Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.

10 Best PDF Editors for Linux

In this article, we will take a look at 10 of the best PDF editors and tools out there in 2019 that are available for Linux platforms. The editors are going to be judged on the basis of their functionalities, portability, ease of installation, price, and convenience.

Linux Mint Cinnamon Vs. MATE: which one to choose?

Linux Mint is by far one of the most popular Linux distros on the market, especially among Windows users who are jumping into the Linux bandwagon. This is mostly because Linux Mint comes with a familiar desktop environment that resembles the classic Windows desktop. It offers tons of quality of life features, making it very user-friendly for users who have never tried Linux before.

5 Best Application Launchers for Ubuntu

Ubuntu is one of the most used Linux distributions worldwide. It is also the reason why it has the maximum number of available programs for itself. Today we are going to talk about one category of those programs, the application launchers.

How to dual-boot Ubuntu and Fedora on your PC

Every Linux distribution has its capabilities and preferences as per the user requirements. That brings forth the need to run different distros on one laptop. For example, a CyberSecurity enthusiast might prefer to use Ubuntu for development and Kali Linux for penetration testing.