Server Setup

Linux Software Compilation Guide

by ,

We have by far the largest RPM repository with NGINX module packages and VMODs for Varnish. If you want to install NGINX, Varnish, and lots of useful performance/security software with smooth yum upgrades for production use, this is the repository for you.
Active subscription is required.

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:

  • Compiling allows you to install the latest version of a program
  • You keep your server secure, since you don’t introduce 3rd party repository into system
  • You keep your package management free of dependency issues which might appear when mixing standard repository package with dependencies from a 3rd-party repository

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
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!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: