How to add packages or update Ubuntu apt-offline

ubuntu opt-offline

This tutorial is intended for all those who have installed Ubuntu on a computer that has no Internet connection, but who would like nevertheless maintain their system up to date and install the applications they lack. Apt-offline can easily do this from another computer connected to the internet.

Prerequisite

  • Have the administrative rights.
  • Having access to a computer running Windows or Ubuntu (from a friend, or Internet café) with an Internet connection.
  • Having a USB Stick (at least 1GB recommended) or other removable media.
  • Having a functional sources.list. If this is not the case, generators are available on the page sources.list.

All the methods listed below assumes that you can have access to a computer with a broadband internet connection that you do not necessarily have the administrative rights , and you have a USB stick (1GB would do). This tutorial is for Ubuntu users of all levels including the beginners, we will be explicit enough, but if you do not understand certain command line to type in the terminal, or confused at any point, simply drop us a line in the comment box.

Installation

It is necessary to install the package apt-offline on both computers or finding a way to temporarily connect the target computer to the internet, either using one of the methods described on the portal dedicated to offline package installation. Or by downloading the package directly here.

Apt-offline can be downloaded (for bones not based on debian / apt and therefore would not have this package in their filing, Windows included) as a binary on this page.

Using the tool apt-offline

It is also possible to carry out any stains after using a GUI for apt-offine. For this Install the package apt-offline-gui. Start with the command:

gksudo apt-offline-gui

Updating the system

Generate a signature file on the computer offline

apt-offline set /tmp/apt-offline.sig

The above command will generate all the information required by apt to update its database. By default, no additional arguments, apt-offline will extract information from updating the database APT (implicit -update option), and the list of packages to be upgraded (-upgrade default option).

These options can also be used individually if desired.

Updating the system

Generate a signature file on the computer offline

apt-offline set /tmp/apt-offline.sig

The above command will generate all the information required by apt to update its database.
By default, no additional arguments, apt-offline will extract information from updating the database APT (implicit -update option), and the list of packages to be upgraded (-upgrade default option).

These options can also be used individually if desired.

Download data corresponding to the signature file generated previously

apt-get offline C: \ apt-offline.sig --threads 5

Option threads accelerates the process by downloading up to five files in parallel.

Extracting the downloaded data on the target computer

apt-install offline /media/USB/apt-offline.zip

This will update your database transparently APT.

Installing a package and its dependencies

apt-offline is very powerful, because you can also download the source if you wish.

1) On the offline computer

sudo apt-offline set-offline.sig package_name package_name --src --install-packages-build-dep --install-src-packages package-name

2) on the computer connected to the internet

Lay out the package-name-offline.sig file you generated previously, and then:

sudo apt-get package-name-offline.sig offline --no-checksum --bundle NOM_PAQUET-offline.zip

3) extraction of downloaded packages on the target computer

Extract the resulting archive to a temporary directory:

unzip -l NOM_PAQUET-offline.zip

Then install the packages in a conventional manner:

sudo apt-get -o dir :: Cache :: archives = PATH / TO / LE / FILE install package_name

To install the packages, it is also possible to use the following, unless recommended in practice.

sudo dpkg -i * .deb

Manually update your package lists

The procedure described below allows you to update your package list. Note for advanced users that there are alternatives in the form of scripts.

To test if nothing else works. However it is good to explore because it allows to see what really happens. open a terminal and type:

sudo apt-get update -qq --print-uris >> gedit && foo.txt foo.txt

in the file that opens, you will find a particular URL per line. Save the file to your key, go to the computer (linux) where you have internet, and for each URL, type

wget <url>

then bring the files downloaded to your computer. Change to the folder where you downloaded (it is assumed in the next commands are the only directory .gz files). As before in order to simplify the presentation of the page, here are the successive commands in a single block.

#We copy the packets in the correct directory
* .gz sudo cp / var / lib / apt / lists /
#We is placed in this directory
cd / var / lib / apt / lists /
#We unzip the package lists 
sudo gunzip * .gz

At this point it might work, but you will have problems launching the update utility that will tell you that it has failed to unlock the files. That is why we must add:

sudo chmod 755 * _Packages

Your lists are now up to date.

Using the terminal with apt (recommended method)

ubuntu apt-offline

Method to be used only if the computer connected to the Internet and have the target computer hardware and software architectures close

This method is used with the Ubuntu terminal but it is quite simple and effective! The package lists used are those of the computer connected to the Internet, it is not necessary to go through the above steps (ie to update the source list, and updating lists packets) provided that the computer connected to the Internet lists are sufficiently current (but if you can it’s still better).

  1. On the connected computer, create a new folder (eg tempo).
  2. Create this folder (tempo) another folder called partial (This file will be empty at the end of the download! But it is essential).
  3. Open a terminal and put you in your file by typing

    cd / path / worm / your / file / tempo

    For example :

    cd / home / raouf / Office / tempo

    followed by the ENTER key on the keyboard.

  4. Then, to download the package and its dependencies, type the command below replacing “mypackage” with the name of the package in question:

    apt-get --install-recommends -o "Dir :: Cache :: archives =` pwd` "-o" Debug :: NoLocking = true "-o" Dir :: State :: status = / dev / null "- to install mypackage

    Remains to wait depending on your connection speed. You can repeat this command again to make sure that all dependencies have been downloaded.

  5. Copy the folder to a USB key and bring it into the computer without internet.
  6. Open a terminal and move to the folder that you copied (in the same way as the previous cd / path ... / tempo + ENTER).
  7. And finally install the package and its dependencies by typing

    sudo dpkg -i * .deb
As you use the package lists from computer connected to the internet to complete the update of the non-connected computer, it must be running the same version of Ubuntu or another of its variants, that computer connected to the internet! (eg if the unconnected is “Trusty” you must download the package on a computer that runs on “Trusty” and not “Precise”). Note again that this method is not 100% reliable. It requires that both computers have close configurations, otherwise problems may occur with the downloaded dependencies or incompatibilities may occur.

 

You May Also Like

About the Author: admin

Leave a Reply

Your email address will not be published. Required fields are marked *