Search:  
Gentoo Wiki

TIP_install_programs_without_portage

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

Contents

Introduction

This article shows how to cleanly install applications which are not in the portage tree. This may be necessary, because there are still lots of applications that did not make their way to portage or because you want a version of the package that is not in portage. There is of course more than one way to do this, but I think my way is rather clean, because

How to do it

Linux is a multiuser system. This is great even if there is only one person using the system, because you can have special users for various tasks. On my system, for example, I have a user called sandbox which I use whenever I want to test programs. For installing applications outside portage we will introduce a special user called admin, who has write access to one directory under /usr.

Setting up your system for non-portage packages

In this paragraph I will show you how to set up your system. Here, you need your root account. First we have to create a new user called admin:

useradd -g users -m admin

This will also create the directory /home/admin. If you don't want to remember passwords for all your special users, you can skip

passwd admin

and instead always use

su
su admin
cd

I prefer this way. Now that we have a user, we need a directory where this user can install programs. I will call it non-portage (Note: Any path is fine; the standard path to use would be /usr/local, so if your /usr/local directory is empty, you might prefer to use this instead of /usr/non-portage).

mkdir /usr/non-portage
chown admin /usr/non-portage
chmod 755 /usr/non-portage

Finally, your shell has to know that there may be executable programs in your non-portage directory. Add

export PATH="/usr/non-portage/bin:${PATH}"

to your global or local profile. To update your profile, type

source /etc/profile

Installing packages

Now that you have set up your system, you need to be able to install applications. For this purpose, you only need the admin account. The only thing you have to do is tell to program to install itself in the non-portage directory.

From Source

Usually you will want to install packages from source. This is really easy. Instead of

tar -xvzf some-source.tar.gz
cd some-source
./configure
make
make install

You just write

tar -xvzf some-source.tar.gz
cd some-source
./configure --prefix=/usr/non-portage
make
make install

That's all!

I suggest that you keep the source for later uninstalling

mkdir installed_packages
mv some-source installed_packages

Binary packages

There are various binary installers for different programs. Sometimes you can pass the installation directory as a parameter. More often you will have to edit the installation script.

RPMs

emerge rpm (as root)
rpm -Uvh --root=/usr/non-portage package.rpm

(may not work, rpm has probably to be installed on /usr/non-portage, correct me please)

A reader's sample test:

rpm -Uvh --nodeps --root=/usr/non-portage hudlite-server-1.3.1-1.i386.rpm
 error: can't create transaction lock on /usr/non-portage
 Preparing...                ########################################### [100%]
 1:hudlite-server         ########################################### [100%]
 error: %post(hudlite-server-1.3.1-1.i386) scriptlet failed, exit status 255

The RPM files are installed in /usr/non-portage.

Another way to simply extract files within an RPM (for manual installation) is:

cd /usr/non-portage
rpm2cpio ./rpm_file.rpm | cpio -idv

Or if you just don't want to emerge the rpm tools package, you can convert the rpm to a .tar by typing this:

rpm2tar rpm_file.rpm

or if you want it to be .tar.gz for whatever purpose, you can do:

rpm2targz rpm_file.rpm

Then extract it as any other tar file into the /usr/non-portage dir.

DEBs

emerge dpkg (as root)
dpkg -i --instdir=/usr/non-portage package.deb

This is not working, complains about

dpkg: failed to open package info file `/var/lib/dpkg/status' for reading: No such file or directory

to avoid this problem you must do simple steps:

# touch /var/lib/dpkg/status
# touch /var/lib/dpkg/available
# touch /usr/sbin/update-rc.d
# chmod +x  /usr/sbin/update-rc.d

[added by xanda]

We can also install a .deb file by convert it to .rpm

your machine needs to have 'alien' installed

emerge alien

to convert a .deb package to .rpm package, just simply follow this command

alien -r package-name.deb

now you can follow the instruction on how to install rpm file ;)

Uninstalling packages

After installing from source you can easily uninstall packages, too:

cd installed_packages/some-source
make uninstall

If you want to keep original source instead of the compiled stuff, this is ok, too, but you will have to rebuild the package in order to uninstall it :) Don't forget --prefix=/usr/non-portage when you configure!

If you have installed binary packages, you probably have to uninstall the files by hand. At least you are sure they can only be inside /usr/non-portage :-)

I hope this TIP was helpful. Feel free to edit and extend where appropriate.


that is how you do it!

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

Last modified: Mon, 28 Apr 2008 00:16:00 +0000 Hits: 24,769