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 PC World newsletter!

Error: Please check your email address.

Our Back to Business guide highlights the best products for you to boost your productivity at home, on the road, at the office, or in the classroom.

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Alastair Cousins

PC World
Show Comments

Most Popular Reviews

Latest News Articles

Resources

PCW Evaluation Team

Azadeh Williams

HP OfficeJet Pro 8730

A smarter way to print for busy small business owners, combining speedy printing with scanning and copying, making it easier to produce high quality documents and images at a touch of a button.

Andrew Grant

HP OfficeJet Pro 8730

I've had a multifunction printer in the office going on 10 years now. It was a neat bit of kit back in the day -- print, copy, scan, fax -- when printing over WiFi felt a bit like magic. It’s seen better days though and an upgrade’s well overdue. This HP OfficeJet Pro 8730 looks like it ticks all the same boxes: print, copy, scan, and fax. (Really? Does anyone fax anything any more? I guess it's good to know the facility’s there, just in case.) Printing over WiFi is more-or- less standard these days.

Ed Dawson

HP OfficeJet Pro 8730

As a freelance writer who is always on the go, I like my technology to be both efficient and effective so I can do my job well. The HP OfficeJet Pro 8730 Inkjet Printer ticks all the boxes in terms of form factor, performance and user interface.

Michael Hargreaves

Windows 10 for Business / Dell XPS 13

I’d happily recommend this touchscreen laptop and Windows 10 as a great way to get serious work done at a desk or on the road.

Aysha Strobbe

Windows 10 / HP Spectre x360

Ultimately, I think the Windows 10 environment is excellent for me as it caters for so many different uses. The inclusion of the Xbox app is also great for when you need some downtime too!

Mark Escubio

Windows 10 / Lenovo Yoga 910

For me, the Xbox Play Anywhere is a great new feature as it allows you to play your current Xbox games with higher resolutions and better graphics without forking out extra cash for another copy. Although available titles are still scarce, but I’m sure it will grow in time.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?