Brief: This article guide walks Debian-based users through the download, installation, and usage of the apt-offline tool to effortlessly upgrade Debian-based Linux distribution with limited, slow, or zero internet connection.
apt-offline is an offline package management utility that is used to install/upgrade software packages with their dependencies on Debian-based Linux distributions with no direct internet connection.
- It retrieves full bug reports of installed and upgraded packages.
- Downloads source deb package with associated build dependencies (particularly important for developers).
- Leverages the power of APT on a disconnected Debian or Debian distro machine.
Installing apt-offline in Debian Systems
The apt-offline tool is available to install from the default repositories of Debian and Debian-based Linux distributions such as Ubuntu and Linux Mint.
$ sudo apt install apt-offline
Once the .deb file has been transferred to your offline Debian-based system, install it with the command:
$ sudo dpkg -i apt-offline_1.8.4-1_all.deb
Upgrade Debian Systems Offline Using apt-offline
With apt-offline installed on both online and offline Debian-based systems, we can move on and demonstrate its usage.
Installing a Package on Offline Debian System
On the offline Debian-based system, we will create a directory called SystemUpdate.
$ mkdir SystemUpdate
Inside this directory, we should be able to generate a database of files (signature file) that will help the online Debian-based system download updates for us. For instance, let us assume we want to download the Vim editor for the offline machine.
We will first create a signature file for vim.
$ cd SystemUpdate $ sudo apt-offline set apt-offline.sig --install-packages vim
The generated signal file (apt-offline.sig) will be responsible for installing vim on your offline Debian-based system.
The next step is to copy the SystemUpdate directory from the offline Debian-based system to the online Debian-based system.
$ scp -r SystemUpdate/ [email protected]:/home/ubuntu/Downloads
On the online Debian-based system, navigate inside the copied directory and execute the following command to collect system update data for the offline Debian-based system.
$ cd SystemUpdate $ sudo apt-offline get apt-offline.sig --bundle apt-offline-bundle.zip
The downloaded vim data for the offline Debian-based system will be saved in the specified apt-offline-bundle.zip file. Copy the SystemUpdate directory back to the offline system.
$ scp -r SystemUpdate/ [email protected]:/home/dnyce/Downloads
On the offline system, navigate to the newly copied directory content:
$ cd SystemUpdate
Implement the downloaded updates on the apt-offline-bundle.zip file with the command:
$ sudo apt-offline install apt-offline-bundle.zip
If you check the Vim version, you might think it’s not installed.
$ vim -V
However, its binary files exist:
$ whereis vim vim: /etc/vim usr/share/vim usr/share/man/man1/vim.1.gz
Updating or Upgrading the Offline Debian Systems
Here, we will only need to regenerate the steps covered above:
1. Create a signature file on the offline system for updating or upgrading.
$ sudo apt-offline set update-offline.sig --update $ sudo apt-offline set upgrade-offline.sig --upgrade
2. Copy the directory with the signature file to the online system and collect system update/upgrade data for the offline method.
$ sudo apt-offline get update-offline.sig --bundle update-offline-bundle.zip $ sudo apt-offline get upgrade-offline.sig --bundle upgrade-offline-bundle.zip
3. Copy the generated .zip file back to the offline machine and install your updates/upgrades.
$ sudo apt-offline install update-offline-bundle.zip $ sudo apt-offline install upgrade-offline-bundle.zip
apt-offline makes it easier for disconnected or offline Debian-based systems to install the latest updates/packages and perform system/package upgrades since the update and upgrade files can be downloaded and installed later.