In Ubuntu, if you are connected to the Internet, updating and upgrading the system is as easy as running the “apt-get update” and “apt-get upgrade” command. Better still, for those who prefer a GUI, you can also use the Update Manager to update your system with a simple click. Now, what if your Ubuntu computer is not connected to the Internet? How can you update/upgrade your Ubuntu without any Internet connection? There are several ways to go about doing it. The method we are going to use here is “apt-offline“.
Let’s imagine the scenario: You have a Ubuntu machine at home that doesn’t come with any Internet connection (probably because home networking is very expensive), and your office (or school) PC is connected to a broadband connection with blazingly fast speed. With apt-offline, you can now make use of the office or school PC (regardless it is running Linux or Windows) to download the necessary packages to your USB drive, and then bring it home to update your home computer.
The only requirement for this is that your Ubuntu need to be installed with apt-offline, which of course need an Internet connection.
sudo apt-get install apt-offline
To update your Ubuntu machine, there are 3 steps that you need to do:
1. Generate the apt signature file
This apt signature file contains all the information required to search and download the packages from their sources. To generate a sig file, open a terminal and type:
sudo apt-offline set ~/apt.sig
This will generate an “apt.sig” file in your Home folder.
If you need to install a particular application (like vlc), you need to append an extra agrument, like this:
sudo apt-offline --update --upgrade --install-package vlc -- ~/apt.sig
Once the “apt.sig” file is generated, copy it to your USB drive and bring the USB drive to your office/school PC (or any PC that is connected to the Web).
2. Fetching the required packages from their sources on the remote PC
On the PC that is connected to the web, open a terminal and type:
apt-offline get -d /path/to/download/directory /path/to/apt.sig
You can of course, use the
--bundle option to bundle the packages into a single zip file.
apt-offline get --bundle /download/path/aptbundle.zip /path/to/apt.sig
On a Windows machine, you will need to install Python (if installation is not allowed, simply download the Python module, extract it and point the configuration path to the Python module). In addition, you also need to download the apt-offline package on the Windows machine.
Next, open a command prompt and “cd” to the “apt-offline” directory and run the above command.
3. Install the downloaded packages on your Ubuntu machine
The last step is to bring the downloaded packages on your USB drive back home and run the following command in your terminal:
sudo apt-offline install /path/to/aptbundle.zip
Note: apt-offline is a debian package and will work in all debian-based distro, including Ubuntu.
Image credit: Unplugged