Site icon GetPageSpeed

Linux Software Compilation Guide

On a Linux based system, you can easily install latest version of required software by means of compiling its source.

The first thing you need to do is, of course, check whether the software of interest is available in standard OS repository. If not, you can rely on custom 3rd party repository for installing. However, you may want to compile software yourself due to following reasons:

Create directory for source files

It is advised to create /usr/local/src and use that directory for custom compiled software. This is recommended since it conforms to Filesystem Hierarchy Standard. When you upgrade operating system, everything under /usr/local remains intact, which means that all your customizations are safe.

mkdir -p /usr/local/src

Install basic Linux software development tools

To be able to compile software you, obviously, need the core tools for compiling and linking.

On CentOS 7 (RedHat EL 7), run:

yum -y group install "Development Tools"

On CentOS 6 (RedHat EL 6), run:

yum -y groupinstall "development tools"

Compiling Software

Nearly every single Linux software is available in source code form. Common file format for source code downloads is .tar.gz archive. Also nearly every program can be automatically configured for compilation in local system.

Suppose that you know the link to program named abc.

The following command will change current directory to our source directory:

cd /usr/local/src

Now fetch source files archive:

wget http://some.domain.com/abc.tar.gz

Extract our source files:

tar zxvf abc.tar.gz

Navigate inside source subdirectory, compile and install (Hit Enter after each line):

cd abc
./configure
make
make install

By default, binaries are installed into /usr/local/bin or /usr/local/sbin. These directories are already present in PATH environment variable. So you can simply run our installed software with just: abc.

We hope you have enjoyed our intro into compiling software under Linux. Happy compiling!

Exit mobile version