The Quick-N-Dirty Guide to Installing from Source

1.) Do you have tar, bunzip2 and gunzip?

In a command shell type

which tar bunzip2 gunzip

This should return the path to these programs , probably /usr/bin/tar, etc. (In FreeBSD probably /usr/local/bin/tar). If it finds it, go to step 3. If it doesn’t, there is probably something seriously wrong with your installation that is beyond the scope of this guide. However, you can go to step 2 and see if the instructions there help. (Some distributions, such as Debian, don’t install all of these by default, so the instructions in step 2 can quite possibly help).

2.) Installing

Go to the QND software guide for information about getting and installing tar, gunzip and bunzip2. We’ll wait. If it turns out that they’re not included with your particular flavor of Linux then as mentioned above, there is probably something seriously wrong with your installation and you will need more than this guide.

3.)Using tar to install from source

For this example, we will assume that you downloaded fetchmail-5.9.tar.gz. I prefer to make a separate directory for these things, but the first step here can be skipped without disaster. However, let us assume that you downloaded fetchmail into a directory you’ve made in /tmp called downloads. Therefore, at present, your fetchmail tarball is in /tmp/downloads It’s always a good idea to examine the contents of the tarball first

tar -ztf /tmp/downloads/fetchmail-5.9.tar.gz

That will tell us the contents of the tarball. Now, we decompress and untar it.

mkdir /usr/local/src/fetchmail
tar -zxvf /tmp/downloads/fetchmail-5.9.tar.gz

At this point, you will see the tarball being decompressed and extracted. Various things will flash across your screen. Assuming it completes with no errors, you will now see that you have a directory inside your /usr/local/src/fetchmail directory called fetchmail-5.9

cd fetchmail-5.9
ls

You should see a file in there called README. Read it.

less README

Depending upon the program, it may have installation instructions or may tell you to read another file called INSTALL for directions on installation. If so, then read that one.

less INSTALL

In most cases, the instructions will give the following sequence. (NOTE: Notice that I said MOST–not ALL. Skipping the above steps of reading the README and INSTALL can sometimes result in needless difficulty)

./configure
make
make install

The instructions for installing a tar.bz2 file are almost identical. The difference is in the options passed to the tar command–for a gunzip it was tar -zxvf. For a bz2 it’s usually

tar -jxvf fetchmail-5.9.tar.bz2

On rare occasions, you’ll receive the error message that j is an unknown option. If you get such a message than try

tar -yxvf fetchmail-5.9.tar.bz2

If neither works, then you can always try

bunzip2 fetchmail-5.9.tar.bz2 && tar -xvf fetchmail.tar

4.) Odd and ends

Keep in mind that the above instructions are for tarballs. Sometimes, files are simply compressed (but not tarred.) In that case, they would have, rather than tar.bz2, etc just .bz2. If you get a file called file.bz2 and try tar -jxvf file.bz2 you’ll get an error message to the effect that it’s an inappropriate file format. If you have such a file, simply decompress it, e.g

bunzip2 file.bz2

(If it’s a file called file.gz substitute gunzip for bunzip2.)

There is also a compressing format that just has a .Z extension. If you run into it, use the uncompress command. For example, if your file was called file.Z

uncompress file.Z

If you run across a tarball with it then just do

ucompress file.tar.Z && tar -xvf file.tar

You may come across files with .tgz and .tbz extensions, for example, FreeBSD distfiles. These are simply abbreviations for tar.gz and tar.bz2, so you can treat a .tgz file as if were called .tar.gz and .tbz files as if they were .tar.bz2 files.

From time to time, you might come across a file with a .zip extension, compressed with the Microsoft format. Most Linux distributions have a zip and unzip command, or have it readily available. In FreeBSD the two are available in /usr/ports/archivers. If you install /usr/ports/archivers/zip I believe it installs unzip as a dependency, but I wouldn’t swear to that, nor am I sure if the reverse is true.

If you are using an RPM based distro, and want to install an rpm, the command is (assuming it was fetchmail-5.9.rpm)

rpm -Uvh fetchmail-5.9.rpm

One may also wish to create their own tarfiles. If you had a directory of good bash scripts called bashscripts and wished to tar and compress them to send to a friend, the command would be (I am using the j option for bz2 format-if you wish gz format substitute z for j)

tar -jcf bashscripts.tar.bz2 bashscripts

Now that you understand using tarballs, you can go back to the QND guide you were reading, and continue with what is usually step 3.