How to Update and Upgrade Ubuntu Offline

Update Ubuntu Offline

Offline upgrades aren’t super common in today’s world with most devices being connected to the Internet. Even still, there are occasions where they can be useful, and Ubuntu provides a fairly simple way to turn a USB drive into an offline repository.

This method isn’t hard to set up, and works as easily as a regular online upgrade does. There is one catch, though. You will need an Internet-connected Ubuntu computer to set everything up and feed packages to the offline one.

Get the Apt-Offline Package

Start things off on the online Ubuntu machine. You’ll need to install the apt-offline package.

sudo apt install apt-offline

Next, you’re going to need another copy of the package for the offline box. Download the deb form, an Ubuntu mirror. Put the package on a USB drive to install on the offline box.

Once you have the package available on the offline Ubuntu computer, install it with dpkg.

sudo dpkg -i apt-offline

Create a Signature for Your Repository

Generate Repository Signature

All Ubuntu and Debian repositories use key signatures to verify the integrity of the packages. Your offline repository is no different. Apt-offline has a tool to create a signature for you. Run it and set up your key in a location that you’ll remember.

sudo apt-offline set ~/.offline.sig

Download the Packages

You’re ready to get all of the packages for your new repository and download them to the drive you want to use.

sudo apt-offline get -d /path/to/usb/ ~/.offline.sig

Downloading Repository

If you want to bundle it all into one big zip file, the threads flag lets you download from more than one Ubuntu repository at a time. This should take some time. It’s a lot of files that need to be downloaded. You should also make sure to have a sizable USB drive to fit an entire repository worth of packages.

sudo apt-offline get --threads 3 --bundle /path/to/usb/ ~/.offline.sig

Install the Packages on the Offline Computer

The only thing left for you to do is to enable your new repository on the offline computer. Insert the drive into your computer, then run the following command:

sudo apt-offline install /path/to/usb/

Apt will enable the the new repository on your system. When you start using Apt or install packages, your computer will pull them from the new local source. As you continue to update the offline computer, you can repeat the steps of downloading the packages and installing them on the offline Ubuntu PC.

This system can feel more awkward and cumbersome than regular online updates, but it works reasonably well. It affords you the opportunity to control your system and still manages it with the same tools you’re used to. You are also fully capable of using the same drive and the same repository across multiple offline machines, making this a surprisingly efficient method for updating offline computers. Of course, if the computers are on a local network, you can always substitute network-attached storage for the USB and really boost your efficiency.

Nick Congleton
Nick Congleton

Nick is a freelance tech. journalist, Linux enthusiast, and a long time PC gamer.

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox