With a good and reliable internet connection, installing, updating or upgrading your Debian System is a walk in the park. All that is required of you is to run ‘apt-get update’ or apt-get upgrade’ commands and voila! Your system is up to date. For those using a GUI system, it’s much easier as the update manager will allow you to easily update packages at the click of a button.
But let’s imagine you are in a remote place without internet connection or maybe your ISP is experiencing some technical challenges and your office PC running Debian or Windows systems is connected to a super-fast internet connection. How do you go about updating or upgrading your offline Debian system?
With apt-offline tool, you can leverage on your online PC at work or at a friend’s place, to download the required packages and later take and install them in your offline Debian system at home. Apt-offline is a free and open source tool built in python.
1. Install your Debian System at home with apt-offline
This requires an internet connection. You’ll have to install apt-offline on your home Debian PC. Open your terminal and run
apt-get install apt-offline
[email protected]:/home/jamie/Downloads# apt-get install apt-offline Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: apt-offline 0 upgraded, 1 newly installed, 0 to remove and 280 not upgraded. Need to get 0 B/61.0 kB of archives. After this operation, 318 kB of additional disk space will be used. Selecting previously unselected package apt-offline. (Reading database ... 169004 files and directories currently installed.) Preparing to unpack .../apt-offline_1.7.2_all.deb ... Unpacking apt-offline (1.7.2) ... Setting up apt-offline (1.7.2) ... Processing triggers for doc-base (0.10.7) ... Processing 1 added doc-base file... Processing triggers for man-db (184.108.40.206-2) ...
2. Generate apt signature
The apt-signature file contains information about installed and downloaded packages in your Debian system and helps in verifying which files need to be downloaded. To generate the sig file, On your terminal type
apt-offline set ~/geek.sig
[email protected]:/home/jamie# apt-offline set ~/geek.sig Generating database of files that are needed for an update. Generating database of file that are needed for operation upgrade
This generates the sig file in the home folder of root. Feel free to change the path of the sig file. Save the sig file in your USB drive and connect it to the PC with internet access.
For the PC connected to the internet
Head to your office Debian PC connected to the internet and run
apt-offline get -d /path/to download/directory /path/to/geek.sig
Alternatively, you can use the get -- bundle option
apt-offline get --bundle /path/to download/directory/bundle.zip /path/to/geek.sig
The -- bundle option enables you to generate an archive containing all data or bundle all packages into one zip file. Once downloaded, copy all downloaded files in the USB. This process takes about 10 minutes if you have a good internet connection.
[email protected]:/home/jamie# apt-offline get --bundle /home/jamie/Downloads/bundle.zip ~/geek.sig Fetching APT Data Downloading http://security.ubuntu.com/ubuntu/dists/zesty-security/Release.gpg http://security.ubuntu.com/ubuntu/dists/zesty-security/Release.gpg done Downloading http://security.ubuntu.com/ubuntu/dists/zesty-security/Release http://security.ubuntu.com/ubuntu/dists/zesty-security/Release done Downloading http://security.ubuntu.com/ubuntu/dists/zesty-security/InRelease http://security.ubuntu.com/ubuntu/dists/zesty-security/InRelease done Downloading http://security.ubuntu.com/ubuntu/dists/zesty-security/main/binary-amd64/Packages.xz http://security.ubuntu.com/ubuntu/dists/zesty-security/main/binary-amd64/Packages.xz done Downloading http://security.ubuntu.com/ubuntu/dists/zesty-security/main/binary-i386/Packages.xz http://security.ubuntu.com/ubuntu/dists/zesty-security/main/binary-i386/Packages.xz done
Downloaded data to /home/jamie/Downloads/bundle.zip
[email protected]:/home/jamie# cd /home/jamie/Downloads/ [email protected]:/home/jamie/Downloads# ls bundle.zip [email protected]:/home/jamie/Downloads#
If you are running a Windows machine, it’s required that you install python and then install apt-offline package. Fire up your command prompt tool and navigate to the directory of the apt-offline and execute the command above.
On your offline Debian PC at home
Finally, get back to your remote machine and install the already downloaded packages in the USB drive.
apt-offline install /path/to/bundle.zip
This will update the apt database without any glitches. With those 4 few steps, your Debian system will be updated and running with the latest versions of software packages.
How to install packages on an offline Debian machine
Let’s suppose you want to install Debian packages on your offline PC, head out to the online PC running either Windows or Debian and download Debian packages in a pen drive or USB stick. A Debian package is suffixed with a .deb extension e.g. hello_2.1.1-4_i386.deb Head back to the offline PC, plug in your USB drive, copy the .deb file to any path of your choice and run the below command to install the .deb packages:
dpkg -i /path/to/Debian/package.deb
Updating, upgrading or installing packages online is the easiest to do and the most preferred method of package management. However, If you are not in a position to access the internet connection, the apt-offline tool does the magic and will still allow you to update and upgrade your offline PC seamlessly.