Using Yum to install packages for my user only

23

9

I would like to be able to install packages by using a package manager (Yum is available on my server), but I don't have root access. I don't technically need root access, I just want the packages to be installed in my home directory.

Is there any way I can do this?

Olivier Tremblay

Posted 2010-10-12T15:34:52.567

Reputation: 411

Answers

9

As Ignacio points out, you can use yumdownloader.

But for the second step

rpm -ivh --relocate /usr=/home/username/usr --relocate /etc=/home/username/etc

or

rpm -ivh --relocate /=/home/username/progname

is probably easier.

If the RPM has any scripts that assume they are running as root, you might also need to add the --noscripts option.

Plus you can add the --aid option to resolve dependencies.

Yet another useful options in this case is --root to avoid rpm to write to /var path (since you're not root), so the command will be something like:

rpm -ivh --relocate /=/home/username/progname --root /home/username/progname

Mikel

Posted 2010-10-12T15:34:52.567

Reputation: 7 890

Wel, well, well. First option with relocate did not work, because it needs access to /var as root. Second option did not work because it seems you need root access to do that. I get the following error message: error: Unable to change root directory: Operation not permitted – Sylvain – 2015-09-22T10:12:09.260

1

Please take note of the following guideline from Fedora: "The use of RPM's facility for generating relocatable packages is strongly discouraged. It is difficult to make work properly, impossible to use from the installer or from yum, and not generally necessary if other packaging guidelines are followed. However, in the unlikely event that you have a good reason to make a package relocatable, you MUST state this intent and reasoning in the request for package review.".

– Cristian Ciupitu – 2013-10-21T20:07:38.193

11

Not using yum. You can use yumdownloader though, and then put the packages through rpm2cpio ... | cpio -id in order to extract their contents, and then place the files in the appropriate locations.

Ignacio Vazquez-Abrams

Posted 2010-10-12T15:34:52.567

Reputation: 100 516