6

I am trying to keep one my Ubuntu systems up-to-date. The intended target is Not Connected to the internet. Am trying to get all the needed info from another machine with internet access.

After a bit of study, I found a way to achieve this. Can you please tell me if this is correct & safe?

Here is my understanding of the apt-get process..

  1. First, we run the command 'apt-get update' : This connects to all the repositories mentioned in the '/etc/apt/sources.list'.. And, downloads all the Packages.gz files like (in.archive.ubuntu.com/ubuntu/dists/trusty/main/binary-amd64/Packages.gz) & saves them in a similar name under '/var/lib/apt/lists' (for the above mentioned url the corresponding file is in.archive.ubuntu.com_ubuntu_dists_trusty_main_binary-amd64_Packages)
  2. Then, when we run 'apt-get upgrade' (or) 'apt-get install pkg_name', this checks the locally installed package list with the local meta-data downloaded & stored at '/var/lib/apt/lists'. And, then gets the download url from that & asks for user confirmation before downloading & installing the required packages.

This is my plan to keep the isolated machine up-to-date..

  1. Get the list of packages to download from the '/etc/apt/sources.list' conf file at the target machine..
  2. Download the meta-data files Packages.gz at another machine..
  3. Copy these files to target machine's '/var/lib/apt/lists' under appropriate filename.
  4. Run the 'apt-get --print-uris upgrade' (or) 'apt-get --print-uris --yes install pkg_name' to get the list of all the packages needed for that machine.
  5. Download these packages again at the second machine.
  6. Copy them to the target machine.
  7. Run the 'dpkg -i pkg_list' to install all the missing packages.

I am able to achieve my goal using this process.

My question is : Is this correct & reliable? Or is there an easier way to achieve this?

Rangaraj

3
  • 3
    You have already posted this question on other SE site. Stack Exchange explicitly discourages posting on multiple sites. Moreover, your question is indeed more fit to Ask Ubuntu then Linux&Unix. I would recommend you being patient and asking on one site at once. Aug 31, 2015 at 7:46
  • 1
    @MatthewRock - That said, the question has got better answers here than on AskUbuntu Aug 31, 2015 at 21:04
  • @CharlesStewart I might also be mistaken that question belongs more to Ubuntu, since apt is used on several distributions; it probably is better fit here. However, asking on few Stack Exchange sites and seeing which one provides best answer is bad practice, and against the rules. Sep 1, 2015 at 7:47

2 Answers 2

10

This sounds like it may work, but personally, I'd just use apt-offline.

From the manpage:

apt-offline brings offline package management functionality to Debian based system. It can be used to download packages and its dependencies to be installed later on (or required to update) a disconnected machine. Packages can be downloaded from a different connected machine.

Excerpt from Debian Administration:

Using apt-offline:

  • You generate a signature on your Debian box at home and carry the signature file on a removable medium
  • Now you take the USB Stick (with the apt-offline.txt signature file) to the office machine which could be running any linux version or even Windows.
  • There, you could run apt-offline giving it the signature file.
  • apt-offline would generate you an archive file or a folder with all the data. That data can be copied on a removable media. The removable media can be attached back to the disconnected Debian box at home and installed. (e.g. "apt-offline install /tmp/apt-offline.zip")
3
  • Thank you, will have a look at apt-offline. But, it does require one Ubuntu machine to be connected to the internet, right? I need my downloads to be on a Windows machine. Any idea how to run apt-offline on a windows machine? Aug 31, 2015 at 7:58
  • 2
    @RangarajKS see superuser.com/questions/771044/… for instructions on building apt-offline for Windows (but download the source from alioth.debian.org/frs/?group_id=100399 instead of the link given on superuser.com). Aug 31, 2015 at 8:23
  • Thanks, @StephenKitt.. Really useful. Will give it a try. Aug 31, 2015 at 9:49
3

I used to have a "no internet" update process on my machine. This is how I did it:

First I used apt-get --print-uris update > meta.list to create a list of all files needed for updating the system. Using wget, I could run wget -x -i meta.list on any other machine to download the meta data on a USB stick. Back to my machine, I used the USB stick (wget -x creates a directory structure) to allow my system to update its meta data (The USB stick was configured as a local software repository). To install a package I generated the list of files I needed to download (apt-get --print-uris upgrade > package.list), used wget again on another machine to download all packages to my USB stick, and put the stick into my machine where I then could install from the local repository. I don’t remember the exact details, but this is basically it.

You can also use helper tools (e.g. reprepro or AptMedium) to ease the process. Personally, I did not have any problems with this method and it was very reliable.

5
  • did you run the apt-get --print-uris without running apt-get update first? Aug 31, 2015 at 7:55
  • No, I started with apt-get --print-uris update > meta.list which prints the URIs needed for updating into a file.
    – mrub
    Aug 31, 2015 at 8:19
  • Sorry, I misinterpreted your first command as upgrade instead of update.. Yeah, I'm kinda trying to do the same thing you used to.. :-) Aug 31, 2015 at 8:22
  • Don't you need to change name of meta files downloaded from meta.list, to the special format?! you didn't mentioned how you move meta data back to target machine, so apt-get can generate list of packages.
    – 2i3r
    Oct 6, 2019 at 11:19
  • You are right; my answer was a bit unclear. I edited it in hope that it is easier to understand now.
    – mrub
    Oct 7, 2019 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.