Saturday, December 9, 2017

Offline Package : How To Install Software Offline In Ubuntu 16.04

How To Install Software Offline In Ubuntu 16.04

Today, we will be discussing an interesting and useful topic. We are going to install softwares offline in Ubuntu systems.  Excited? It’s fairly simple and easy. What we are going to do now is download a software along with all its dependencies from any Internet-enabled system, and copy the downloaded files and install them in the offline Ubuntu systems.this method is much easier than all other methods. All we need is just a Synaptic package manager. For those who don’t know, Synaptic package manager is the graphical front-end for APT package manager. Using Synaptic we can easily install, update, and remove packages in DEB based systems.

Why?

So, why do we need to do this? To save Internet bandwidth, of course! Let us say we have 100+ Ubuntu systems, and we need to install MySQL server in all those systems. We all know this will consume lot of Internet bandwidth. So, why don’t we just download a software with all required dependencies in only one system, and copy and install them in the rest of the systems? It doesn’t matter whether the other systems have Internet connection or not. Sounds, logical? Indeed. This method will save you a lot of bandwidth, so that we can use it for other purposes.
You might have some questions.

I have downloaded the softwares for Ubuntu 14.04 version, and I want to install them in Ubuntu 16.04. Is it possible?

No, you can’t! You can only download and install the softwares for the same Ubuntu version. For example, If you download MySQL packages of Ubuntu 14.04, and try to install it on Ubuntu 16.04 LTS, It will not work.

My system doesn’t have Internet, and Synaptic manager. Can I still install softwares using this method?

No! This method is intended to save the Bandwidth. Your system must have Synaptic installed. Otherwise this method won’t help. Or else, you can download the .deb file, and try to install it. But sometimes, .deb file will also require dependencies. In such cases, there is no way to install any softwares offline. The Internet connection is mandatory.

Install Softwares Offline In Ubuntu

I tested this on Ubuntu 16.04 LTS desktop. However, It should work all DEB based systems as long as they have Synaptic package manager installed. As you all know, we can install Synaptic, using the following command:
sudo apt-get install synaptic
For the purpose of this tutorial, I will be using two Ubuntu desktops.
  1. Lubuntu 14.04 LTS desktop (Internet enabled)
  2. Ubuntu 16.04 LTS (Synaptic package manager installed, and don’t have Internet)
For the sake of simplicity, let us call the Lubuntu (Internet-enabled) system as online system, and Ubuntu 16.04 LTS  desktop as offline system.

Steps to do in offline system

First go to the Offline system, and open Synaptic package manager. Search for the packages you want to install. For example, let us install MySQL server. Enter mysql in the search box. You will see the list of suggestions. Choose MySQL server package from the list, and select Mark for installation.
Once you selected the mysql server, the synaptic package manager will automatically select the additional required dependencies. Click Mark.
As you see in the above screenshot, Synaptic has automatically selected the required dependencies for the mysql server.
Next, go to File -> Generate package download script from the Synaptic package manager. Save this script on any folder of your choice with extension .sh. Please note that you must save this file with .sh extension.
For example, I saved this file (Ex. mysql.sh) in a folder called mysql_install.
This script contains the download URLs of all softwares that you marked for installation.
Now, copy this entire folder to a USB drive or any other medium, and go to the online (Internet enabled) system.

Steps to do in online system

Cd to the mysql_install folder, and make the script as executable:
cd mysql_install
sudo chmod +x  mysql.sh
Finally, run the script using command:
./mysql.sh
The above command will download mysql server with all dependencies, and save them inside mysql_install folder.
Once you downloaded all softwares, copy this entire folder to the USB drive or any other medium of your choice. Also, keep this folder safe if you want to install MySQL server on multiple systems.

Go back to Offline system

Again, go back to the offline (Ubuntu 16.04 LTS) system, and open Synaptic manager.
Go to File -> Add download packages.
Select the location of the folder that contains the downloaded files, and click Open.
That’s it. Synaptic will ask you to install the downloaded packages. Click Apply to install them.
The softwares will start to install in offline.
Similarly, you can install any software on your offline Ubuntu desktop.
Also, you can copy the downloaded files, and paste them in /var/cache/apt/archives/ folder. Then search package that you want to install from Synaptic and install it.
Don’t forget to keep the downloaded files in a safe location to use them later in any other offline systems.

No comments: