#Installing Programs on Linux Without root
Prefixed Portage
Most Linux distributions have great package managers like apt or
portage. But installing programs when you don't have root access can
be a pain. You need to find, download and install all the dependencies
and their dependencies, setup a prefix somewhere in your home folder
and hope that everything works.
Prefixed portage is perfect for those kinds of situations. It's
a modified version of portage, the package manager of the Gentoo
distribution. I am using it on a computer running Linux, but you can
also use it on OS X, FreeBSD and Solaris to install applications and
libraries from the portage repository.
This promising tool is for experienced Linux users who have enough
space to fit /usr into their /home and who don't mind getting their
hands dirty to iron out some of the rough spots themselves.
Installing
Prefixed portage is still in development, but there is a script you
can use to automate the installation. This script uses bzip2, sed and
wget or curl. You need to install these first manually if they are not
already installed. The rest of the process requires python, but the
script can install it for you, just follow
the instructions .
First, set the EPREFIX environment variable to the folder you want to
use as a prefix, and prepare your paths:
$ cat >> ~/.bashrc
export EPREFIX="$HOME/gentoo"
export PATH="$EPREFIX/usr/bin:$EPREFIX/bin:$PATH"
export LD_LIBRARY_PATH="$EPREFIX/lib:$EPREFIX/usr/lib:$LD_LIBRARY_PATH"
export LDFLAGS='-L$EPREFIX/usr/lib -Wl,-rpath=$EPREFIX/usr/lib -L$EPREFIX/lib -Wl,-rpath=$EPREFIX/lib'
^D
$ source ~/.bashrc
Next, download the automated script and let it prepare the prefix:
$ wget http://overlays.gentoo.org/proj/alt/browser/trunk/prefix-overlay/scripts/bootstrap-prefix.sh?format=txt -O bootstrap-prefix.sh
$ chmod +x bootstrap-prefix.sh
$ ./bootstrap-prefix.sh $EPREFIX tree
$ ./bootstrap-prefix.sh $EPREFIX portage
Configuration
Because portage is not automatically aware of the applications
installed on the host, one last step is required when you want to
install something.
Packages that are already installed can be added to the
$EPREFIX/etc/make.profile/package.provided file and portage will take
them into consideration when calculating the dependencies. If you do
not do that, portage will install every package it needs in your
prefix. For example, with subversion:
44 Lines hidden Toggle Show/Hide
atnnn@neverfear:~$ emerge -pv subversion
!!! Problem with sandbox binary. Disabling...
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild N ] sys-libs/ncurses-5.5-r03.2 USE="-bootstrap -build -debug -doc -gpm -minimal -nocxx -trace -unicode" 2,260 kB
[ebuild N ] sys-libs/zlib-1.2.3-r01.1 416 kB
[ebuild N ] sys-devel/m4-1.4.9-r1 USE="-examples -nls" 596 kB
[ebuild N ] sys-devel/gnuconfig-20070724 40 kB
[ebuild N ] dev-libs/expat-2.0.1 436 kB
[ebuild N ] sys-devel/autoconf-wrapper-4-r3 0 kB
[ebuild N ] sys-devel/automake-wrapper-3-r1 0 kB
[ebuild N ] sys-apps/sed-4.1.5 USE="-nls -static" 781 kB
[ebuild N ] app-misc/pax-utils-0.1.16 USE="-caps" 64 kB
[ebuild N ] dev-libs/popt-1.10.7 USE="-nls" 712 kB
[ebuild N ] sys-apps/texinfo-4.8-r5 USE="-build -nls -static" 1,487 kB
[ebuild N ] app-shells/bash-3.2_p17-r1 USE="-afs -bashlogger -nls -plugins -vanilla" 2,522 kB
[ebuild N ] net-misc/rsync-2.6.9-r4 USE="-acl -ipv6 -static -xinetd" 793 kB
[ebuild N ] sys-libs/readline-5.2_p7 2,008 kB
[ebuild N ] dev-libs/libxml2-2.6.30 USE="readline -debug -doc -ipv6 -python -test" 4,616 kB
[ebuild N ] sys-devel/libperl-5.8.8-r01.1 USE="-berkdb -debug -gdbm -ithreads" 9,887 kB
[ebuild N ] dev-lang/perl-5.8.8-r2 USE="-berkdb -build -debug -doc -gdbm -ithreads -perlsuid" 0 kB
[ebuild N ] app-admin/perl-cleaner-1.05 6 kB
[ebuild N ] perl-core/PodParser-1.35 96 kB
[ebuild N ] perl-core/Test-Harness-2.64 70 kB
[ebuild N ] sys-devel/autoconf-2.61-r1 USE="-emacs" 1,365 kB
[ebuild N ] sys-apps/help2man-1.36.4 USE="-nls" 84 kB
[ebuild N ] sys-devel/automake-1.10 873 kB
[ebuild N ] sys-devel/libtool-1.5.24 USE="-vanilla" 2,852 kB
[ebuild N ] dev-libs/apr-1.2.11 USE="-debug -doc -ipv6 -urandom" 1,088 kB
[ebuild N ] sys-apps/groff-1.19.2-r1 USE="-X -cjk" 2,836 kB
[ebuild N ] sys-apps/sandbox-1.2.17 228 kB
[ebuild N ] sys-apps/coreutils-6.9-r1 USE="-acl -nls (-selinux) -static -xattr" 5,307 kB
[ebuild N ] dev-libs/apr-util-1.2.10 USE="-berkdb -doc -gdbm -ldap -mysql -postgres -sqlite -sqlite3" 639 kB
[ebuild N ] sys-apps/man-1.6e-r3 USE="-nls" 247 kB
[ebuild N ] sys-apps/man-pages-2.66 USE="-nls" 1,809 kB
[ebuild N ] sys-apps/diffutils-2.8.7-r2 USE="-nls -static" 1,038 kB
[ebuild N ] dev-libs/openssl-0.9.8e-r4 USE="zlib -bindist -emacs -gmp -kerberos (-sse2) -test" 3,264 kB
[ebuild N ] net-misc/neon-0.26.3 USE="ssl zlib -expat -nls -socks5" 771 kB
[ebuild N ] dev-util/subversion-1.4.4-r4 USE="-apache2 -bash-completion -berkdb -doc -emacs -extras -java -nls -nowebdav -perl -python -ruby -vim-syntax" 4,613 kB
[ebuild N ] dev-lang/python-2.5.1-r02.1 USE="ncurses readline ssl -berkdb -bootstrap -build -doc -examples -gdbm -ipv6 -nothreads -sqlite -tk -ucs2" 9,170 kB
[ebuild N ] sys-apps/portage-2.2.00.8027 USE="-build -doc -epydoc (-selinux)" LINGUAS="-pl" 593 kB
*** Portage will stop merging at this point and reload itself,
then resume the merge.
[ebuild N ] app-misc/ca-certificates-20070303-r1 95 kB
[ebuild N ] app-admin/python-updater-0.2 3 kB
[ebuild N ] dev-python/python-fchksum-1.7.1 27 kB
Total: 40 packages (40 new), Size of downloads: 63,674 kB
44 Lines hidden Toggle Show/Hide
As you can see, there are many unmet dependencies. Most of these might
already be installed. On my host system, I added the following lines
to $EPREFIX/etc/make.profile/package.provided
app-misc/ca-certificates-20070303
sys-apps/coreutils-5.97
sys-apps/groff-1.18.1
dev-libs/openssl-0.9.8c
dev-libs/apr-util-1.2.7
dev-libs/apr-1.2.7
dev-lang/perl-5.8.8
sys-libs/zlib-1.2.3
And now subversion is a lot easier to install:
$ emerge -pv subversion
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild N ] dev-libs/apr-1.2.11 USE="-debug -doc -ipv6 -urandom" 1,088 kB
[ebuild N ] net-misc/neon-0.26.3 USE="ssl zlib -expat -nls -socks5" 771 kB
[ebuild N ] dev-libs/apr-util-1.2.10 USE="-berkdb -doc -gdbm -ldap -mysql -postgres -sqlite -sqlite3" 639 kB
[ebuild N ] dev-util/subversion-1.4.4-r4 USE="-apache2 -bash-completion -berkdb -doc -emacs -extras -java -nls -nowebdav -perl -python -ruby -vim-syntax" 4,613 kB
Total: 4 packages (4 new), Size of downloads: 7,111 kB
To figure out the installed version of a package on Debian, you can
use the dpkg command with the -l switch, the locate command or the
--version option of most programs:
$ locate curses.so
/lib/libncurses.so.5
/lib/libncurses.so.5.5
$ dpkg -l | grep expat
ii libexpat1 1.95.8-3.4 XML parsing C library - runtime library
$ perl --version
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
To complete the installation, install the base layout, update portage
to the latest version and update the local database of packages. This
might not be an automatic process. Depending on your host system, you
might need to tweak your configuration to get everything to work.
$ emerge -av baselayout-prefix portage subversion
$ emerge --sync
You can now easily install all of the packages from the Gentoo portage
repository that were ported to the portage prefix repository. Tweaking
and configuration of Prefixed Portage is exactly like in Gentoo, but
using $EPREFIX/etc/make.conf.