The first step is to find the software you want to install. (I'm assuming you already have a compiler, but if not use your usual packaging tools to install gcc or another compiler if your choice.) Usually a Google source for
software_name source OR src downloadwill locate the software you want for you. The file will likely be named something like
software-src-version.tar,extension. This is called a tarball. Save the file to your system. Conventionally you put source code in /usr/local/src or /opt/src (depending on whether your system adds local files to /opt or /usr/local.) You may find that you need to create this directory. If you are building this on a machine where you don't have root or sudo access – for instance, in your hosting account on a web server or other shared system, you probably want to create a src folder in your home directory. Move to this directory and untar your tarball. If your tarball ends in tar.gz or .tgz, this means that GNUzip compression was used and you can untar it with the command:
tar xvzf directory_where_you_saved_your_download/tarball_name
If it ends with tar.bzip or tar.bz,, this is BZIP compression and you should use
xvzf. If it ends with tar.Z, which you don't see very often anymore, the old Unix compress compression was used, and you should use a capital Z (xvZf).
The tar command should have created a directory named package.version. Move to that directory and then run
./configure. If you want to install the software in a location other than /usr/local, you'll need to run
./configure –prefix=/full/directory/name. (To install under your home directory, you can run
./configure –prefix=$HOME.) If you want to fine tune where the package installs or see your other options, you can get more information by typing
./configure –help. Configure checks your system to make sure that all the required elements to build the program are on your computer and sets up the installation for your computer (it also provides copious information while doing so.) Sometimes configure will need you to provide more information using special command line options, it will tell you what those are when you run it if they are needed. If configure fails to find everything you need, it will tell you what is missing, and it can probably be installed using your favorite package manager (if not, start this process over with that package.)
Once configure has successfully completed, you can actually build the program by running
make. Like configure, make provides a lot of output while it is running. Finally, you can install your program using
make install. You will probably have to run the last step as root using
sudo make installunless you are installing in an alternate location.
At this point your software should be installed and ready to use! If you run into a problem anywhere along the way, try Googling the error message. If this still leaves you struggling, feel free to post in the forum. Enjoy using your new software!
The XKCD Store has a t-shirt version of the comic above.
If you are going to get into anything more complicated than ./configure, make, make install or even troubleshoot problems with that process, Porting Unix Software is a huge help. Although it is somewhat outdated regarding the specific operating system references, the tools and software still work the same way.