Home / Software / How to compile and install software from source in Linux

How to compile and install software from source in Linux

Building a linux program from source
Ideally everything you ever need for your Linux server will be nicely packaged and easily installed through your distribution’s repositories. At worst you might need to add a third-party repository to download the .rpm or .deb packages that you need. But when you realize the world is not as perfect as that scenario, it might be helpful to know how to compile software from source. Don’t worry, it is easier than it sounds.

To begin you need to make sure your Linux distribution has the necessary libraries (usually -dev or -devel endings) to build software from source. In Redhat-based distros, you need the development tools:

# yum groupinstall "Development Tools"

Next, download the program you want to install. It will typically be compressed in a tar.gz or tar.bz2 archive. You will need to uncompress them:

$ tar xvzf package.tar.gz
or
$ tar xvjf package.tar.bz2

Now, change to the package directory.

$ cd package

You should see a “configure” script in the directory. You will use this to setup the build. If you receive errors that prevent it from completing, you will need to install any of the development packages that it requires. Sometimes, this can take time.

$ ./configure

Now run “make” which actually performs the build process:

$ make

Finally, run “make install” as root to install the newly created binary files in their proper locations. All of this will happen automatically.

# make install

If all goes well, you are done. It is that easy to build and install software, assuming you receive no major errors.

Check Also

Server collocation

Server colocation

Server colocation is an incredible good choice for people as well as small businesses who …