Ubuntu – Is it safe to manually perform ‘apt-get update’ ‘s operation

aptapt-offlinepackage-managementUbuntuupgrade

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

Best Answer

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")
Related Question