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
Usage
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
That’s it.
Note: apt-offline is a debian package and will work in all debian-based distro, including Ubuntu.
Image credit: Unplugged
hi,
i am point out somethig…
please use sudo apt-get install apt-offline instead off sudo apt-get apt-offline
thank u for ur valuble post…
sravan
Oops…thanks for pointing out the mistake. I have fixed it.
Hi! Thanks for the tutorial. I’m planning to install ubuntu. I have a question on the Windows part of the tutorial. I have no idea what you mean by “simply download the Python module, extract it and point the configuration path to the Python module).” could you please explain that bit?
If you are on Windows, you can download Python and place it in a USB thumb
drive. In Windows, add “E:bin” to PATH (where E: is the
thumb drive directory). After that, you will be able to proceed as normal.
Alternatively, if you have administrator right, you can install Python in
Windows. Then proceed as normal.
Also: it should be “sudo apt-offline set –update –upgrade –install-packages vlc — ~/apt.sig”. You’re missing the “set” and an “s” and the end of “packages”. Other than that, good post!
E: Couldn’t find package apt-offline