An easy way to upgrade or install new software on an offline Linux PC

This is a procedure I sometime use to update several offline desktop computers with Linux Ubuntu (and derivatives).

OVERVIEW:

  1. With the offline PC, you must have the possibility to periodically connect to the internet with a low-speed connection, using for example an EDGE/UMTS cell phone, 56k modem or other. This is needed just to download a small amount of data like the list of packages to update/install.
  2. You must also have the possibility to periodically use an online PC with a high-speed internet connection (DSL, wi-fi or other) to download all packages needed to update the offline PC.
  3. A mobile storage unit like a USB pen drive or a USB hard disk drive, used to move packages between online/offline PCs.
  4. Availability of the Firefox web browser with DownThemAll addon on the online PC. It’s easy to install Firefox from its web page then the addon can be easily installed after launching Firefox and searching for DownThemAll in “Add-ons” menu item.

1-firefox add-on menu2-ricerca downthemall

GUIDE:

  1. Connect offline PC to the internet with the low-speed connection.
  2. Open a shell (bash terminal), go to your home folder and give these two commands to update the system and generate a text file containing the list of packages to update / install:
    sudo apt-get update
    sudo apt-get -qq --print-uris dist-upgrade > uris
  3. Next, give this command to create a list of packages to download (wget-script.txt):
    sudo awk '{print "wget -O " $2 " " $1}' < uris > wget-script.txt
  4. Now, save wget-script.txt on your USB pen drive and let’s go on the online PC where you can download the packages.
  5. On online PC insert your pen drive containing wget-script.txt
  6. Open Firefox and DownThemAll! plugin (dTA! manager), right-click with mouse in dTA! manager window and choose the menu “Advanced”->”Import from file…”. Here select the wget-script.txt previously created.DTA Manager context menu
  7. The download links will be imported in DownThemAll!… Now, filter *.deb files and give a target folder where the packages will be downloaded. Start the download.4-bis_donloading_path_n_filter5-aggiornamento
  8. At the end of download, you can copy this folder of new packages on your USB pen drive and put them on the offline PC.
  9. On offline PC insert the USB pen drive and copy the new packages folder to your home.
  10. Now give the following command to install these updates on your offline PC:
    sudo apt-get -o dir::cache::archives="/home-folder-path/package-folder" dist-upgrade
    

That’s all folks!

Don’t hesitate to send me feedbacks, I can improve the guide with your suggestions.
Thanks a lot. /Saverio