Compiling and installing Linux software

One of the regularly highlighted features of Linux is its open source heritage. Linux, and most of the software available for it, is distributed as source code. This source code needs to be compiled to machine code before it can be run on your computer. In this month's Here's How column, we look at the steps involved in compiling and installing software.

BENEFITS

It is possible to get most of the software you will need in binary form. Programs in binary form usually come packaged as RPMs and are tailored for particular distributions of Linux. Compiling a program from source has several advantages:

  • The program will be built and optimised for your particular system;
  • There are often many configuration options available at compile time that are not available with software distributed as a binary;
  • More programs are available; in particular, most pre-release software is not available in binary form;
  • Many programs distributed in binary form may not be available for your distribution. Distributing software in source form ensures that the program will work on any distribution.

There are several steps involved in compiling and installing software, but it's not very hard to perform once you've done it once or twice. You will need development tools installed on your system; all distributions include them. This column is only a generic guide and these instructions may not work for all programs, but they will work without modification for most popular programs. When in doubt, consult the documentation for the program in question.

CONFIGURATION

The first step in compiling a program is to configure it. Before performing the actual configuration, you should first read the documentation for the program. In the directory containing the source code there are likely to be files called README and INSTALL. Read them to determine whether this program has any particular requirements, and for general help if you encounter problems during installation.

Next, configure the build process. In the directory that contains the source code, type:

$ ./configure --help

This will return a list of all the configuration options available for the build process. Generally, the default configuration options are suitable for most systems. Many of these options will allow you to disable features that you may not want or that may be causing problems when compiling the program. Take note of any configuration options you would like to use and then configure the build process by typing:

$./configure <configuration options>where <configuration options> are all of the options you have decided to use. The configure program will now perform a series of tests on your system to check that it will be possible to build the program. Some errors may occur; they usually mean you will need to install another piece of software to build the program. The configure program will provide some information on what is missing, and you must find and install these programs before you can continue the build process. If there are no errors, the build is properly configured and it is time to compile.

COMPILING

Now that the hard part is out of the way, compile the program by typing:

$ make

Compiling a program will take several minutes, at minimum, though it could take several hours depending on the size of the program and the speed of your system. The screen will slowly update as each piece of source code is compiled. When all are compiled they will be linked together to form the program.

If errors occur during compilation there is little you can do unless you know the programming language in which the program was written. If compilation fails, you can try using other configuration options or another version of the program.

INSTALLING

Now that you have a properly built program, install it. As root, type:

# make install

This will make any directories needed on your computer and install the program in them. When this process is complete, you should be able to run the program by typing its name at the prompt. When you are happy that the program works properly, you can delete the directory the source code is in and continue to use the program.

Join the newsletter!

Error: Please check your email address.
Rocket to Success - Your 10 Tips for Smarter ERP System Selection
Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Alastair Cousins

PC World
Show Comments

Cool Tech

SanDisk MicroSDXC™ for Nintendo® Switch™

Learn more >

Breitling Superocean Heritage Chronographe 44

Learn more >

Toys for Boys

Family Friendly

Panasonic 4K UHD Blu-Ray Player and Full HD Recorder with Netflix - UBT1GL-K

Learn more >

Stocking Stuffer

Razer DeathAdder Expert Ergonomic Gaming Mouse

Learn more >

Christmas Gift Guide

Click for more ›

Most Popular Reviews

Latest Articles

Resources

PCW Evaluation Team

Edwina Hargreaves

WD My Cloud Home

I would recommend this device for families and small businesses who want one safe place to store all their important digital content and a way to easily share it with friends, family, business partners, or customers.

Walid Mikhael

Brother QL-820NWB Professional Label Printer

It’s easy to set up, it’s compact and quiet when printing and to top if off, the print quality is excellent. This is hands down the best printer I’ve used for printing labels.

Ben Ramsden

Sharp PN-40TC1 Huddle Board

Brainstorming, innovation, problem solving, and negotiation have all become much more productive and valuable if people can easily collaborate in real time with minimal friction.

Sarah Ieroianni

Brother QL-820NWB Professional Label Printer

The print quality also does not disappoint, it’s clear, bold, doesn’t smudge and the text is perfectly sized.

Ratchada Dunn

Sharp PN-40TC1 Huddle Board

The Huddle Board’s built in program; Sharp Touch Viewing software allows us to easily manipulate and edit our documents (jpegs and PDFs) all at the same time on the dashboard.

George Khoury

Sharp PN-40TC1 Huddle Board

The biggest perks for me would be that it comes with easy to use and comprehensive programs that make the collaboration process a whole lot more intuitive and organic

Featured Content

Product Launch Showcase

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?