Thursday, April 14, 2016

[Quick Tips: Offline Pkg Install]: How to Install Softwares offline in Ubuntu 16.04

How to Install Softwares offline in Ubuntu 16.04

install software offline
Did you understand the title? Yes, We are going to install softwares offline in Ubuntu systems.  Excited? It’s damn 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. There are few software, such as Camcri Cube server, already does this job pretty well. However, this method is much easier than anyone else. All we need is just a Synaptic package manager. 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.
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 download a software with all its 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 lot of bandwidth, so that we can use it for other purposes.
In this brief tutorial, we are going to see how to 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
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.
Clear? Well, let us get into the topic.
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 as 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.
Ubuntu 16.04 LTS Desktop [Running] - Oracle VM VirtualBox_012
Once you selected the mysql server, the synaptic package manager will automatically select the additional required dependencies. Click Mark.
Ubuntu 16.04 LTS Desktop [Running] - Oracle VM VirtualBox_013
As you see in the above screenshot, Synaptic will automatically select 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.
Ubuntu 16.04 LTS Desktop [Running] - Oracle VM VirtualBox_015
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.
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
sk@sk: ~-mysql_install_017
The above command will download mysql server with all dependencies, and save them inside mysql_install folder.
mysql_install_019
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.
Again, go back to the offline (Ubuntu 16.04 LTS) system, and open Synaptic manager.
Go to File -> Add download packages.
Ubuntu 16.04 LTS Desktop [Running] - Oracle VM VirtualBox_020
Select the location of the folder that contains the downloaded files, and click Open.
Ubuntu 16.04 LTS Desktop [Running] - Oracle VM VirtualBox_021
That’s it. Synaptic will ask you to install the downloaded packages. Click Apply to install them.
Ubuntu 16.04 LTS Desktop [Running] - Oracle VM VirtualBox_022
The softwares will start to install in offline.
Ubuntu 16.04 LTS Desktop [Running] - Oracle VM VirtualBox_023
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.
That’s all for now folks.
Hope this helps! If you find this tutorial useful, please share it on your social networks and support OSTechNix.
Cheers!

 

No comments: