You have one computer that’s connected to the internet (online system) and another computer that’s not connected to the internet (offline system), but you want to install or update software on the offline system. Here comes the Apt-Offline utility as a solution.
What is Apt-Offline?
Apt-Offline is an amazing command-line tool in Linux, particularly designed for Debian or Debian-based distributions like Ubuntu, Linux Mint, or Pop!_OS, allowing users to perform package management tasks on a system without internet access.
This is especially handy for installing or updating packages and their dependencies on a computer without internet access. You can download the necessary packages from a different system with internet access and transfer them to the offline system for installation or updates.
Don’t worry if your online system is running a different operating system like Windows; you can still download the packages because this tool is cross-platform, written in Python, and offers both CLI and GUI options.
|Root or Sudo Privileges||Yes|
|OS Compatibility||Debian, Ubuntu, Linux Mint, etc.|
Prerequisites for the Offline Update and Upgrade Process
- A Windows or Linux system with internet connectivity for downloading packages, which can be your workplace, school, cyber cafe, etc.
- An “offline system” for installing the above downloaded packages, which should be compatible with Debian or Debian-based distributions.
- Transfer downloaded packages from an online system to an offline system using either a USB or a hard disk.
How to Install Apt-Offline on Online and Offline Systems
Let’s begin the installation of this tool on your online system and then offline system using the following steps:
Installing Apt-Offline on Linux or Windows (🟢 Online System)
Assuming you have a Debian-based distribution like Ubuntu, Linux Mint, or any other, you can easily install it on this system using the APT package manager.
$ sudo apt install apt-offline
If you’re using Ubuntu 22.04 LTS (Jammy Jellyfish) or Ubuntu 20.04 LTS (Focal Fossa), then running the above command will install an older version (1.8.4) of Apt-Offline, which has Python-related deprecation issues.
To avoid this, consider downloading and installing version 1.8.5 from Ubuntu 23.04 (Lunar Lobster) from [pkgs.org](https://pkgs.org/download/apt-offline) and using the “
sudo apt --fix-broken install” command if any broken package error occurs.
For instance, if your online system is running on Windows, you can easily download the Python package for this tool from the project release page.
Installing Apt-Offline on Debian or Ubuntu (🔴 Offline System)
If your offline system has even low-speed internet access, you can still use the previously mentioned steps to install Apt-Offline via the APT package manager.
However, if there is no internet access, you can download an Apt-Offline deb package from [pkgs.org](https://pkgs.org/download/apt-offline) on an internet-connected system and then transfer it to your offline system and install it by running:
$ sudo dpkg -i apt-offline_*_all.deb
Now that we have installed Apt-Offline in both our online and offline systems, let us look into the steps required to download packages from the online system and then install them on the offline system.
Update and Upgrade Offline Debian-based Distribution via Apt-Offline
To begin the update or upgrade process for your offline Debian-based distribution using Apt-Offline, you need to perform the below steps.
- Access your offline system, create a directory with any preferred name within your home directory, such as “
LocalPackage“, and generate a database file that lists all the packages requiring updates.
- Transfer the “
LocalPackage” directory containing the database file to your online system using a USB or any other suitable method, and proceed to download all the package updates mentioned in the database file.
- Finally, transfer the downloaded package update to your offline system via USB or any other suitable method, and proceed to install all of the package updates using Apt-Offline.
Let’s perform these steps practically and update our offline system, waiting for updates.
1. Generating an Apt-Offline Signature File on the Offline System
Create a directory with any preferred name in your home directory, such as “
LocalPackage“, and navigate into it via the cd command.
$ mkdir ~/LocalPackage $ cd ~/LocalPackage
Then run the following command to generate the signature file name “
apt-offline.sig“, which contains information about the packages that need to be downloaded.
$ sudo apt-offline set --update --upgrade apt-offline.sig
The above result indicates the successful creation of a signature file for updating the APT database and upgrading necessary packages.
If you want to create a signature file for specific packages (e.g., package1 and package2), then you can use the following command:
$ sudo apt-offline set --install-packages package1,package2 apt-offline.sig
Now, copy the “
LocalPackage” directory containing the signature file from your offline to your online system via USB or any other suitable method.
2. Downloading Package Updates Using Apt-Offline from the Online System
If you’ve placed the “
LocalPackage” directory in your home directory on your online system, start by entering that directory.
$ cd ~/LocalPackage
Then, run the following command:
$ sudo apt-offline get apt-offline.sig --threads 2 --bundle apt-offline-bundle.zip
It will begin the process of downloading the package requiring an update based on the signature file and bundle all the downloaded packages in a single archive file named “
apt-offline-bundle.zip” in the current working directory.
Also, feel free to tweak the “
--threads 2” option to perform more parallel downloads, but with caution as it might create issues like network congestion and timeouts.
Now, you have to wait a few minutes based on your list of packages wanting updates and internet speed on your online system. Once the process is finished, you will get the following output and a file named “
apt-offline-bundle.zip” in your “
Now, copy the “
LocalPackage” directory containing the “
apt-offline-bundle.zip” archive file from your online to offline system via USB or any other suitable method.
3. Applying the Package Updates Using Apt-Offline on the Offline System
Assuming you’ve placed the “
LocalPackage” directory in your home directory on your offline system, start by entering that directory.
$ cd ~/LocalPackage
Then, begin the update process from the downloaded packages in the archive file by running:
$ sudo apt-offline install apt-offline-bundle.zip
It will begin updating the APT database and upgrading the necessary packages with their dependencies from the downloaded packages in the archive file.
That’s it! You’ve successfully updated or installed software on your offline system without needing an internet connection on that computer.
This is helpful when you have one computer with internet access that can assist in keeping another computer up to date.
Now, if you have any questions or have encountered any errors while following the steps mentioned in this article, feel free to reach out to us in the comment section.
Till then, peace!