Search:  
Gentoo Wiki

TIP_Installing_local_programs

This article is part of the Tips & Tricks series.
Terminals / Shells Network X Window System Portage System Filesystems Kernel Other

Contents

Introduction

When there is no package for an application or you want to compile something yourself, because you find Portage insufficient or whatever you may want to install these into different locations than what portage use, to avoid collision.

The principles

Generally these days, when you compile something "by hand" (running configure and so on) you install it into a special directory, /usr/local. This differs from just /usr in the way that automated packaging systems and so on (like Portage or dpkg) will never install there. At least, they should not.

Compiling foobar-xy-z.tar.gz

First off we decompress the archive,

tar -xvzf foobar-xy-z.tar.gz
Note: The z parameter may differ. Bzip2 archives use j, and not z for example.
Tip: The hyphen (-) in the first argument is redundant in GNU tar

Notice that we're doing this as a regular user. Compiling software manually doesn't have to mean you do it as root. That is rarely necessary, except for when compiling a kernel.

Then, when we have decompressed the archive, the archive probably created itself a directory:

cd foobar-xy-z

Now, on to doing the configure step. Configuring means that before you go ahead and start to compile, you specify what you want and don't want.

./configure --prefix=/usr/local --enable-foo --disable-bar --with-gazonk=2
Note: Notice how we specified --prefix=/usr/local. This is not always necessary, but to be on the safe side, you can use that argument.
Note: All other arguments we passed are mainly what Portage calls USE flags. There are some exceptions, and one USE flag might set more than one configure argument.
Tip: Different applications provide different arguments, with some shared across almost any configuration script (like --prefix) - to see what you can configure, run ./configure --help.

If all went well you should now be ready to start compiling. Don't worry though, compiling doesn't install. It's a simple one word,

make

If it fails at any point, you can always try to seek help on the applications forums, IRC channels, mailing lists or what not.

Final step

Assuming that everything has went well up to now, you are ready to actually install everything into /usr/local. We're still a mortal user, so of course we can't write to /usr/local. Now, we're ready to enter super-user mode. This should only be used briefly, like now - when installing the binaries. We use make install for this purpose:

user@machine ~/foobar-xy-z $ su
Password: 
machine foobar-xy-z # make install

Congratulations! If all went well, you should be able to run your freshly installed application. Don't forget to log out of super-user mode with exit.

INSTALL and README

Most applications contain at least two files, and are always in uppercase: INSTALL and README. Chose your favorite editor and read either one or both of them if you face problems or want to know about quirks.

Retrieved from "http://www.gentoo-wiki.info/TIP_Installing_local_programs"

Last modified: Fri, 15 Dec 2006 12:53:00 +0000 Hits: 1,689