Published on October 15th, 2012 | by Vaibhav0
Install Packages Offline
You must have wondered how to install software packages offline in Linux, i.e. without using:
sudo apt-get install
Well it is pretty straight forward. I talked in the article about Makefile, about dependencies. They are the prerequisites for any package, and need to be satisfied before installing the package. So while downloading any program, one must also download these dependencies along with the package.
We will discuss here the means to install a debian (.deb) package.
For demonstration purposes, let us consider the example of the program Synaptic. If you do not know Synaptic, it is a graphical manager of software packages and is an alternative to the Software Center that comes as the default package manager with ubuntu 12.04. Read more about it here
So we download the .deb file for synaptic from a computer having internet access (of course an internet access is necessary to download the package files!). Also lookup for its dependencies, and download their packages too.
I will specify a bit crude(?) method (but working!) to do the same. Just download the .deb file for synaptic from here according to your system architecture (32-bit or 64-bit), and then change the directory to that directory where the package was downloaded. Now type:
sudo dpkg -i synaptic_X.XX.XX_i386.deb
The last part represents the version of synaptic you are downloading and may vary (pressing in while writing a few characters can help). This results in the unpacking of the synaptic package file (like the partial compilation of a C file, see here). It also generates the triggers for the remaining files (the dependencies). Now type:
sudo apt-get -f install
It displays all the needed packages to install synaptic i.e. the dependencies required for your system. As the system is not connected to the internet, it will display something like, “failed to fetch” as shown below. Now just copy the links for the .deb files and download them using the system having an internet access.
After collect all the .deb files in a separate folder (say synaptic) and move to that folder. In the folder also place the synaptic_X.XX.Xxxxx.deb file. Now type:
sudo dpkg -i *.deb
It now unpacks all the .deb files along with the dependencies and installs the package and Viola the package is installed.
In a similar way updates can also be installed. Now once Synaptic is installed, type:
It opens the Synaptic window. Now just click on the Mark All Upgrades icon and click Mark in the dialog box that opens. Now just generate the download script by clicking
File => Generate package download script
Select a folder to save the script. Now just run the script on a system with an internet access, and download packages required for the upgrade of yout system. Again just move the downloaded files in one folder and type
sudo dpkg -i *.deb
It will install all the updates and your system is upgraded. Alternatively if the other system is also running the same version of the check for the files to be downloaded in the directory /var/cache/apt/archives before downloading. You can surely save some internet usage by copying the relevant files in the folder where you are downloading the package files.
Try this out: Try installing “gtypist” this way on your system. Gtypist is a typing tutor with lessons for different keyboards and languages.