Saturday, June 14, 2008

Installing rpm packages without a root account

A root account is usually needed for installing rpm packages, because of at least two reasons:
R1) write access to the rpm database /var/lib/rpm and to the lock
R2) write access to default installation path.

However, there are workaround if you really want to install something and the root account is not available.

R1): using --root to specify a local copy of the rpm database/lock.
R2): using --prefix to specify a local installation path

Let's see an example of installing Acrobat Reader 8.x without a root account:

[leo@localhost ~]$ cd /home/leo
[leo@localhost ~]$ mkdir -p var/lock
[leo@localhost ~]$ cd var/lock/
[leo@localhost lock]$ cp -r /var/lock/rpm/ .

[leo@localhost download]$ rpm -ivh AdobeReader_enu-8.1.2-1.i486.rpm --nodeps --root /home/leo/ --prefix=/home/leo/opt/
Preparing... ########################################### [100%]
1:AdobeReader_enu ########################################### [100%]
error: unpacking of archive failed on file /usr/bin/acroread;48541048: cpio: open failed - Permission denied

Don't be panic when seeing that there was an error in installing the executable to /usr/bin. We only need to use the local copy of it. Just try the following:

[leo@localhost ~]$ cd opt/Adobe/Reader8/bin
[leo@localhost bin]$ ls
acroread
[leo@localhost bin]$ ./acroread

Mission accomplished!

No comments: