Linux3

From SourceWiki
Jump to navigation Jump to search

Starting to administer systems

Introduction

Installing Software

Package Managers

Building from Source Code

Let's build the latest and greatest version of the popular, open-source statistics package--R. We can download the source code from a mirror site right here in Bristol!

cd $HOME
mkdir BUILD
mkdir INSTALL
cd BUILD
mkdir R
cd R
wget http://www.stats.bris.ac.uk/R/src/base/R-3/R-3.0.1.tar.gz

OK, take a look at what we have so far:

ls -l
-rw-r--r-- 1 gethin gethin 25508280 2013-05-16 08:11 R-3.0.1.tar.gz

So far, so good. Let's unpack the tarball:

tar -xzf R-3.0.1.tar.gz
ls -l
drwxr-xr-x 10 gethin gethin     4096 2013-05-16 08:11 R-3.0.1
-rw-r--r--  1 gethin gethin 25508280 2013-05-16 08:11 R-3.0.1.tar.gz

We have a directory called R-3.0.1, let's move into that directory and take a look at what's inside:

cd R-3.0.1

In common with many other projects, the R distribution uses something called the automake package which creates makefiles for subsequent use in compiling the source code. The typical pattern of commands in this situation is to run configure, followed by make, possibly some sort of test, and finally make install to complete the software installation.

Configure scripts often follow convention when it comes to the options that they will accept. For example:

./configure --help

will list all the valid options for this particular configure script. --prefix is a common option. We can use it to tell the system where we would ultimately like the package to be installed, once it is built. For the purposes of this example, we will run:

./configure --prefix=$HOME/INSTALLS/R/3.0.1