How to Compile and Install a Linux Software from Source Code
Most often we do install software from the terminal by the help of apt-get, rpm, yum, Ubuntu Software Center (GUI) and other forms on various Linux distributions. Sometimes it is good to download the source code of the software and compile it yourself.
Most Linux newbies find this very difficult, since most of them are likely to have moved from Microsoft Windows OS, where they only surf the web and download executable files. Today we are going to learn how to make this difficult task very easy.
Note: I can say that every geek knows this, so this tutorial is actually for newbies.
First of all, what is source code? From Wikipedia Source Code article:
In computer science, source code is any collection of computer instructions (possibly with comments) written using some human-readable computer language, usually as text.
First download a tarball (a zipped file which contains the source code). You either download directly from the website or from the command. If you don’t know about how to use the terminal to download, you can use:
$ wget URL
Or read the following tutorial Command-Line Downloading Using aria2 on how to use aria2, a command-line downloader.
Note: In this tutorial I am using filename as the name of the tarball I have downloaded.
Now let us extract the downloaded tarball using the terminal. If your tarball ends with,
*tar.gz use:
$ tar -xvpf filename.tar.gz
*tar.bz2 use:
$ tar -xvjf filename.tar.bz2
Note: Sometimes file names are very long to remember so you can use the ls command to list files for easy typing.
After ther extraction, change your directory to the extracted folder.
$ cd filename
Next run this in the filename directory to configure the package:
$ ./configure
Now you run the command below to compile the source code associated with the software package:
$ make
Finally, install the software:
$ make install
You have just compiled and install a software from source code.
Source:https://www.unixmen.com/how-to-compile-and-install-a-linux-software-from-source-code/