Site icon Linux Genie

How to Compile and Install Software from Source in Linux

How-Compile-Install-Software-Source-Linux

Linux distributions have extensive repositories most of them are free and open source letting you compile your own. But sometimes you will have to compile from source when you come across a confusing application or a new program version.

And here is a guide on how to compile and install software from source in Linux.

Step 1 – Install the required tools

Firstly, you need to install other packages such as curl and gettext

Run:

$ sudo apt install libz-dev libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext cmake gcc curl

Output:

Install-Compile-Sofware-Source-Linux

Step 2 – Download the Package Source Code

Firstly, navigate to the Downloads directory:

$ cd ~/Downloads

Output:

Then run the following command, we choose Git version 2.26.2:

$ curl --output git.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.26.2.tar.gz

Output:

To extract, run the tar command:

$ tar -zxf git.tar.gz

Output:

Step 3 – Compile the Source Code

Let’s navigate to the extracted folder:

$ cd git-2.26.2

Output:

Then run the following command to configure:

$ ./configure

Output:

Step 4 – Build the Software

Run the following command:

$ make

Output:

The compilation will take some time, please wait.

Finally, install the Git software package:

$ sudo make install

Output:

Check the version:

$ git --version

Output:

Conclusion

Above is a tutorial on how to compile and install software from a source in Linux.

Thank you for reading.

Exit mobile version