lundi 12 avril 2010

How to manage extra packages on gnu/linux when you do not have access to the system package manager.

Tipicall situations are :
- simple user of a gnu/linux desktop at work wanting to install extra packages,
- administrator wanting to install software unavailable in a particular distribution,
- administrator wanting to test a particular package outside from the main installation,

This method should work on any distribution, provided that you have access to a recent compiler on the machine and can freely download source packages.


1) Installing binary

a) stand-alone binaries
Some softwares for GNU/Linux are provided as generic binary, in particular some non-free softwares like skype are provided as an executable binary that will directly work on any distribution (just have to decompress the static-linked precompiled version).

b) distribution packages
In the case of RPMs or DEBs based distributions, you can manually download the needed package and install it in a separated tree (the /tmp/local or a ~/local directory).
To help getting right all dependences of allready installed packages, the system package data-base can be copied to another alternative place and new packages be installed with relocation options. Alternately you can simply extract the archive.

To extract file.rpm : rpm2cpio file.rpm | cpio -i
To extract file.deb : dpkg -x file.deb


rpm options: --dbpath DBPATH --prefix PATH
apt-get/dpkg options: ????
See the man pages for more details.

You probalbly will have to resolve dependences by hand, i.e.: have to recursivelly install all depending missing packages first).


2) Installing from sources

This allows also working with developpement versions of softwares/packages, under revision control (git,mercurial,svn,etc.)

First create the following directory structure :
~/local/apps
~/local/var/ports/{distfiles,build}

Install stow ! (not explained yet)

Example installing emacs 23.1 :
cd ~/local/var/ports/distfiles
wget http://gnu.c3sl.ufpr.br/ftp/emacs/emacs-23.1.tar.bz2
cd ../build
tar xjvf ../distfiles emacs-23.1.tar.bz2
cd emacs-23.1
less README
less INSTALL
./configure --help | less
export CFLAGS="-O3 -march=native"
./configure --prefix=$HOME/local/apps/emacs --with-gif=no --with-tiff=no
make && make install
cd ~/local/apps
stow emacs

making a binary package from it :


TO BE CONTINUED ... (or not)