All software programs are built from different files. These files are called source code and are written in programming languages. The most common programming languages that are used on Linux are C and C++.
There are all sorts of reasons that you may want to download and install a piece of software that is distributed as source code. Some of these are as follows:
There are a several disadvantages to installing software from source, such as these:
build-essential
metapackage.If you find a software package that you want to download and install on your Raspberry Pi, the first thing you need to do is make sure that you have all the required tools to build the application:
build-essential
package:sudo apt-get install build-essential
This will install all the software tools you need to use to compile most C and C++ applications, including the make application and the gcc and g++ compilers.
wget http://apache.mirror.serversaustralia.com.au//httpd/httpd-2.4.10.tar.bz2
Once you source code has been downloaded on your Raspberry Pi, you need to extract the software from the archive. An archive is just a file that contains many other files that have been shrunk to make them easier to distribute.
.tar.bz2
archive such as the Apache2 application, run the following command:tarxvfhttpd-2.4.10.tar.gz
The exact command will vary depending on the software that you are trying to install, but will generally be very similar to the command you just used.
These commands will unpack all the files in the Apache2
archive and put them into a folder that contains the entire Apache2
source.
Almost all software packages that you download contain a file inside them, called README.md
. This file generally contains instructions that you need to follow to install and build the software.
Here is the normal process you need to follow to build a software package:
./configure
make
make install
These commands perform lot of processes. Let's start with ./configure
. The ./configure
command is a script that generates the MakeFile
file used by make
to compile the software. This MakeFile
file is customized to suit your Raspberry Pi. It will also let you know whether there are any other dependencies that you need to install to be able to build the software.
The make
command is the command that actually compiles the software from the source code into an application that you can run on your Raspberry Pi. This compilation process will show lots of information as it progresses, and the process may take quite a long time. The Linux kernel can take well over half an hour to compile,so it is probably best to go and grab a cup of coffee!
After the applications have been compiled, you need to install them. Fortunately, most applications include an installation script that does this for you. Simply run make install
!