I want to install a set of software organized into directories at the root level.

Is there any method in which I can use pacman to install certain packages into a directory of my choosing?

2 Answers 2


Yes, that's possible, by specifying a different root location,

-r, --root Specify an alternative installation root (default is /). This should not be used as a way to install software into /usr/local instead of /usr. This option is used if you want to install a package on a temporary mounted partition that is "owned" by another system. NOTE: if database path or logfile are not specified on either the command line or in pacman.conf(5), their default location will be inside this root path.

  • What should I do about the dbpath with that method?
    – Ayrx
    Oct 2, 2012 at 9:46
  • @TerryChia you want to alternate where pacman stores information of installed packages?
    – daisy
    Oct 2, 2012 at 9:52
  • No, but I got an error: failed to initialize alpm library (could not find or read directory), which from some googling - i assume to be an error with the dbpath.
    – Ayrx
    Oct 2, 2012 at 9:56
  • @TerryChia Hmm, I think the '-r' is used to install a new system just like what the Installation Media does, I don't have a Arch at hand right now, will try it later. If this doesn't work, you're going to modify the PKGBUILD file, the XXX_install function defined there. (A prefix can be specified for most software based on autogen)
    – daisy
    Oct 3, 2012 at 10:06

I know what you wanna do. You want something like running an executable with in a container "if it is" to avoid damaging the system.

Solution: link needed directories by pacman like /var using:

ln -s /var .

Use -s for soft linking

Run pacman with -r .:

sudo pacman -r . -S package

and you will be fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .