Installing software in Ubuntu is a piece of cake. Just launch the Ubuntu software center and type in the name of the software in the search bar; click on ‘Install’ and you have it. This all seems and sounds so easy. The part we miss is : there is an Internet connection involved. If you do not have an Internet connection, installing software on Linux machine does not remain easy. In most cases, you cannot simply download a .DEB (or even a .RPM) file and double click to install it! There are a lot of dependencies to be resolved. Unless dependencies are resolved, the software will not behave well. Even it’s running is under question.
However, it is important to understand how to install software on Ubuntu without an internet connection.
Compiling programs from source code
This is the way preferred by geeks because there is no other way which can give more control over software installations. However, it is also complicated because of the technical details involved. If you have never compiled anything, maybe this method is not for you. To follow this method, you must have the source code of the package you want to install. Let us take the example of compiling php on our computer.
- Download the source package. In our case we need to go tohttp://www.php.net/downloads.php and select the package we want. We assume the php-5.3.6.tar.bz2 package is being used for the installtion.
- Now open a shell and go to the directory where the file gets downloaded
- cd ~/Downloads/
- Then unpack the file using the tar command. This will create the required files in the firectory php-5.3.6 and come back to prompt.
- tar -xvf php-5.3.6.tar.bz2 <- Note:please replace the version number with the one you downloaded from the link above.
- Now change the directory to php-5.3.6 by using the cd command. Now run the command.
- ./configure -help
- This will list down the options which the software supports. You can add as many parameters as you want from the list (you should understand what they mean). Once you have done that, run the ./configure script again with the parameters you have selected beofre. Let us assume that we want to enable support for PostgreSQL. Since ./configure –help says :
- –disable-ipv6 Disable Ipv6 support
so we will run the command
- ./configure –disable-ipv6
- The command checks whether the system meets the requirements or not. In the end it throws the error:
- configure: error: xml2-config not found. Please check your libxml2 installation.
Now, we have a problem. This command is a part of the package libxml2-dev. So we have to install that first. Only then shall we be able to compile the php program. Now, this is the most annoying part. The configure script does not report all errors in one go but stops at the first one. If you resolve the first one and then find another, it becomes much difficult.
Note: At this point of time, it has been verified that PHP can be installed on any system because the package was most probably tested by the developers). The only job the configure script does is to check whether the system satisfies the requirements and create other files called ‘makefiles’. A makefile is once again a type of configurationfile. It contains instructions for the compiler.
- sudo make install
Your software should be installed after ‘sudo make install’. But wait do not delete the php-5.3.6 directory. If later on, you want to remove PHP from the machine, you can go back in to the same directory and run ‘sudo make uninstall’ and the software would get removed from your system in an easy way. Otherwise, removing files individually is a real tough challenge, and one with no benefits in almost all cases.