Home –  How to – How to install software in linux from source file (.zip, .tar.gz, .tar.bz2) ?

How to install software in linux from source file (.zip, .tar.gz, .tar.bz2) ?

Before getting your hands on it, here is a heads up, installing package from source is not the most preferred method. Few might find in a difficult method. It is recommended for experienced Linux users or those who have a thing for exploring more. Generally mostly used software are shipped with the OS and the rest can be easily installed from their respective package managers.

Moving forward, standing by the definition of open source, some packages are in the form of source code. They are distributed this way. One can download the source file for the desired application, it is then unpacked, compiled to turn it into binary. Upon completion you would find that it is not that tough job. Most of the software you would require are still distributed in source form.

The source files all over the Internet are found (not only) in the zip file for tarball. Extensions like “tar.gz” or “tar.bz2” or “.zip” are a common view. It is recommended to follow this procedure from your home directory. From now on, it is assumed that the downloaded file resides in “src” in home directory. Lets create one:

mkdir $HOME/src

Navigate to “src” direcotry through “cd” command.
cd $HOME/src

Lets see what we have in their by using “ls” command which is used for listing directory contentss.

We can see our recently downloaded source file. We now need to unpack it. Different methods are employed to unpack different kinds of files.

For .zip :

For .tar.gz :
tar -xvzf

For .tar.bz2 :
tar -jxvf

Now you will see a new directory having all source files. Use ls to see if it exists.

Now go in that direcotry.

At this stage, few applications have an INSTALL file and some don’t.
If it is there(use ls command to check) then you can read it by “more” command.

Lets proceed with installation, it is completed in three stages:

  • Configure
  • Compile
  • Install

For pre-installation configuration:
This will check your system for essential requirements and is responsible for creation on “makefile”. “MakeFile” is needed by “make” utility and directs it for how the compilation should be carried out.

If you encounter an error, forums are always at your disposal. Be sure to search for it before posting. Also include the output you are getting in the post along with your system specifications. OR you can post in here in comments as we will be pleased to help you with that.

When you are done with configuration phase, next comes Compilation. Use “make” to compile it, compilation is carried out by following the instructions in “MakeFile”.

Final step, install binaries in the system. To do so, you need to be root. “su” command is used to switch user. Enter the password when prompted.

To finalize the installation, execute:
make install

And voila ! Now you know how to install software in linux. You might want to check the software documentation.

Leave a Reply

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