Quick Installation Howto
It has become very common for the Linux newbie to hear about the thousands of free software programs, just ready for the taking. Many begin downloading the code and don't really know what to do with it next to make sense of it all. Many programs come in packages, if this is the case, it can be quickly learned how to make the code productive. For Red Hat-based systems rpm-i is used and for Debian-based systems apt-get install is used and the user will be quickly done and on to something else. What happens if you run into a source code archive, what will you need to do then? Many of the major distributions don't bother to explain what to do. You may be surprised to learn that changing source code into productive software can be very, very easy; once you learn the steps.
What it All Means
Source code is the "raw stuff" of programming, as many of you know. In order to make this "raw stuff" useful and productive, you need to convert it to a binary. This process is called compiling. This procedure is commonly used during development but many maintainers do not use it, especially during the early stages of a project. First of all, the code is what the programmers want. Secondly, assembling a package continuously can be a distraction to the real task of development.
Luckily, the process is very easy to follow. First, log in as root, then you should be ready to start:
- Move the download to the root directory. If you were as careful as you should be, you should not have been logged in as root while on the web. It will then most likely be in your home directory.
- The download most likely will end in tar.gz or .tgz. Both of these endings mean the same thing: It's a group of files that have been compressed using the gzip command. They are then archived using the tar command. In both cases, unpacking the files is done by typing tar -xzvf, followed by the name of the file. When in this order, these options unzip the file, extract if from the archive, display the actions of the command, and force it to continue running despite and problems or errors. There are other options that can be used, but this set should be able to get you through most archives.
- The result of this is a directory with the name and version of the software. Change to that directory, from there go to the sub-directory that has the source code. If the coders were organized, you will most likely find this in the src directory.
- Find the file within the source code sub-directory that contains the installation instructions. Usually, it will be called README or INSTALL. Today, it is becoming more and more source code packages contain a standard file of instructions from the Free Software Foundation. This file should help make installation a breeze, but in case it doesn't contain this file continue on with the next steps.
- From the command line, type: ./configure. Then watch the monitor as the messages are displayed. What's happening here is that the value of different variables are being defined to match your system. The files that end in .h list these variables. While all of this is happening, shell scripts are being written to recreate your original configuration and to log what happens. Also, most importantly, the files that you will need to compile (the makefiles) are being created. If the last few configuration messages don't display any errors, you can go on to the next step.
- From the command line, type: make. What this command does is actually compile the software. Just like earlier, you will see messages being displayed, and, again, you should watch for error messages at the end before you go on. You should note that with some software this step is skipped. Read all instructions in the INSTALL file to find out the correct way to compile the file.
- From the command line, type: make install. What this is doing, is installing the binary (data files) and any documentation. By default, everything is placed somewhere in the /usr/local directory, but the --prefix=PATH option can be used if you have somewhere else you would like to put it. If you don't see any errors at the end, then the program is ready to run.
- Now, you should type make clean to remove the files that have been created from the installation directory.
During this process, the most common error is usually a missing library. If that occurs, you will have to install the library before you can go on. The library is most likely a package so it shouldn't cause any problems. If you have bought a box set, the library may be on one of the CDs. If not, then an Internet search should be able to do the trick.
At times, even when you try your best, it won't be enough. Linux distributions vary in many ways and not all software and run on all machines. This isn't a conspiracy of any kind, just a reflection of the coders' awareness of each distribution. If you continue to try and it still does not work, write the author if after a second download it still does not work. Or, you can also search for a different peice of software, with Linux it is likely that you will be able to find an alternative.