Installing Software from Source

Well, installing software on GNU/Linux is a broad subject because each version of GNU/Linux has its own package management system. However all types of GNU/Linux allow the user to install software using the source code. However you probably don't want to tackle this process unless you know a little bit about how to use GNU/Linux commands and a little about the GNU/Linux file system. If you don't know about these two then its better to read up on them first and then return here.

tar command

Installing from source works on any GNU/Linux system, so its a good process to know, and it more or less follows this route once you have a source package:

tar zxvf packagename.tar.gz

Where 'packagename' in the example above is the actual name of your package that you wish to install. The tar command followed by the parameters zxvf uncompresses a tar.gz file and creates a new directory with all the extracted sources. Now you must change your working directory to this new directory using the cd command. usually the new directory name is the name of the compressed source package minus the ".tar.gz" suffix. For example, if my package really was called "packagename.tar.gz" then after running the tar zxvf command on it I would be left with a new directory called "packagename" and then I would type cd packagename to enter this new directory. If you are not sure of the name of the newly created package type ls

./configure

Alright... once inside the new directory, we want to start the actual installation process. To do this 99% of the time you will need to type the following:

./configure

Ok, so this isn't really a command. Each installation package usually has a script called "configure". By putting a dot and then a slash before the name of the script (i.e.. "./configure") you are telling GNU/Linux to execute (run) that script. The configure script then does its stuff, checking what kind of machine you have, what you already have installed, what kind of GNU/Linux you are running etc etc etc.

The most common problem that will occur at this stage is that the configure script will halt and tell you that software library that the new software depends on is missing. This can be a pain which is why people invented package management systems. However if you do experience this error then you need to use a search engine to find out what software the error message is talking about and where to get it, then start the installation process again with this new package. I am not kidding when I say that this can sometimes mean an installation can take days while you search and download all the packages you need. 

make

So, lets assume you don't get any errors created by running the configure script... in which case you are lucky and you should thank whatever angel is looking over you...Now... the next command to type in the install process is make like so:

make

This command actually makes ('compiles') the software for you. You will then end up with a whole lot of compiled files which in total makes up your software. The make process can take a while depending on the speed of your machine and the size of the package sources you are installing. Running other applications will also slow down the process.

When make has stopped, type the following:

make install

this will install the newly created software in the correct places in your system. So now you just need to type the name of the application in your terminal window and it should run. If it doesn't run and throws an error, a common remedy is to type ldconfig and then try again. ldconfig updates the system so that your operating system knows there are new library files etc.

Dependencies

Another much loved sub-topic, is dependencies. GNU/Linux developers often don't write an application from zero, they rely heavily on work that has been done previously by other programmers. This is a smart way to go of course because it saves time, and to aid this process many kind hearted individuals have made libraries of code that other programmers can easily access and use within their own programs. These libraries are stored in fixed places in the GNU/Linux file system, usually in the "/lib" directory.

Now, if you install an application that requires certain libraries so it can run, then as long as you have those libraries already installed on your system then no problem... but on the other hand if you don't have the required libraries then you need to find them and install them. This can be easy, if the programmer is nice they will have included information about dependencies in either the "README" or "INSTALL" files that you will find in the source directory of their application. Some extremely nice programmers give you both the name and the URL where you can get the necessary bits.

Usually lazy GNU/Linux users don't bother to read these files so they just go through the standard process and they probably find that the "./configure" script will give an error telling them what libraries are missing. These lazy types (myself included) then find the required bits and pieces online and install them.

However, if you are new to GNU/Linux I suggest that you read the "README" and "INSTALL" files before starting any installation process. It will save you time and heartache.

Just remember that although a dependency list might be long, you simply get all the necessary packages and install them one by one, following the same process as described above, until finally you have everything you need for the program of your dreams to install and run.