Results for category "Software"

2 Articles

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

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


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.


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)

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.

The Quick-N-Dirty Guide to Finding and Installing Software

As you will have noted from our other QND guides, they start with asking if you have the particular program, and have you start by typing

which <program_name>

As each distribution has its own way of installing software, this guide is intended as a pointer to installing software in the distributions with which we are familiar.

1.) RedHat Linux

RedHat Linux developed the now common RPM system. (RPM actually stands for RedHat Package Manager) Most of the software mentioned in these QND guides will be found on one of the CDs. A typical RedHat distribution consists of 3 or 4 CDs. Most software will have to be installed as root.

So, insert the CD. (Unless mentioned otherwise in a QND guide, you might as well start with the first one.)

Login as root, or do an su.

mount /dev/cdrom
cd /mnt/cdrom/RedHat/RPMS
ls <program_name*>

For example, if you were searching for fetchmail, you would type, after cd’ing to the RPMS directory

ls fetchmail*

If it’s not on the first CD that you tried then

umount /dev/cdrom

Then repeat the procedure with the next CD. Once you’ve found the program, which will be the program name with a version number, for example fetchmail-5.9.11.rpm then

rpm -Uvh fetchmail-5.9.11.rpm

You’ll see some information as it’s being installed. When done, umount and eject the CDROM as above.

(We’ll continue to use fetchmail as our example package)

2.) Mandrake Linux

Mandrake also uses the RPM format. The procedure is actually, at least last time any of us tried it, identical since Mandrake still keeps its RPMS in a folder called RedHat/RPMS.

3.) Gentoo Linux

Gentoo uses the portage system. Again packages usually have to be installed as root. To find out if it’s available in portage

emerge -s fetchmail

You’ll get a result like

* net-mail/fetchmail
Latest version Available: 5.9.11

It will usually also give the homepage and a brief description.

So, assuming the package is available in portage then

emerge fetchmail

(You may first want to do

emerge -p fetchmail

to see what other packages may be installed as dependencies.)

5.) Debian

Debian’s apt system is well known for its ease of use. To search for a program one types

apt-cache search fetchmail

To install it, one usually only need type

apt-get install fetchmail

4.) ArchLinux

Arch Linux is a relatively little-known distro, though it deserves more notice. It is one of the easiest, as far as installing software. To see if a package is available do

pacman -Ss fetchmail

You will then find the name of the package. Usually, when installing, you don’t need the version number and can simply then do

pacman -Sy fetchmail

You will then see it download and install fetchmail.

5.) FreeBSD

FreeBSD uses the ports system. Most software mentioned in these guides will be available in their ports. So,

cd /usr/ports
whereis fetchmail

In this case you’ll get the answer of /usr/ports/mail/fetchmail.

Another, probably better way to do it is

make search name=fetchmail
cd /usr/ports/mail/fetchmail
make install

Again this must be done as root.

6. NetBSD

NetBSD is almost identical to FreeBSD save that rather than /usr/ports it is in /usr/pkgsrc. So

cd /usr/pkgsrc/mail/fetchmail; make install

The QND guides give the link to a program’s home page. If the program is not available with your distribution, the home page will almost always have information about getting the program, often having the source code and/or rpms available.

If you’re not familiar with installing source code then fear not–we also have a QND guide for it.

Now repeat step one of the QND guide that you were reading. For example, if it was the fetchmail guide then

which fetchmail

If Step 1 still fails, then something subtle is probably wrong. Try emailing your local Linux Users Group or other Linux mailing list to which you subscribe. (We know that you are member of one or the other) something like

“I am trying to install fetchmail on (your distribution, version included). I am using the following method (include the commands that you ran to install it). However, I run ‘which fetchmail’ and it isn’t found. Does anyone have any idea what I’m doing wrong? Thanks in advance.”

Now that you’re done with this, you can go back to the QND guide that you were reading and continue with what is usually step 3.