There is a server that I do work on, running an older version of Linux. I don't have root access to the system, so I wanted to build a more recent version of a tool that I use a lot (Vim 7.3). I figured I would just build it and install it in ~/bin. However, it requires ncurses development files which are not installed system-wide. I found the ncurses-devel rpm, and extracted the 'lib' and 'include' folders, where would I put them and how would I tell the ./configure script to find them so I could properly configure and build the package locally?

Edit: I ended up working around this by installing the identical OS in Virtualbox, and building the package there and copying over the binaries.

  • serverfault.com/questions/23734 may be similar enough to help. Most answers involve installing what is effectively an entire system within your homedir, but that can be worked around in Gentoo Prefix and Rootless Gobo.
    – ephemient
    Sep 16, 2010 at 1:42

4 Answers 4


I did this quite frequently in my last job - the solution that seemed to work best was to create a ~/usr directory, and use the --prefix argument to point the ./configure scripts in the right direction. Here's the steps:

  • Create ~/usr directory, and include, lib and bin directories underneath it.
  • In your .profile, .bashrc, or other shell init script, add the following (or equivalent in your shell's dialect):
    export PATH=$PATH:~/usr/bin
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/usr/lib
    export C_INCLUDE_PATH=$C_INCLUDE_PATH:~/usr/include
  • When building packages, use ./configure --prefix=/home/<username>/usr

This arrangement worked for me for most situations where I needed to build things in userspace. The hardest part is usually finding and building all the dependencies you need, but that just takes some googling or judicious use of your package manager's 'get source' functionality.

  • Didn't quite work for me. The configure script doesn't seem to find anything in ~/usr Sep 16, 2010 at 0:31
  • I had the same problem @postfuturist . I ended up fixing it by using ${HOME} instead of ~ in all of my export calls, and then pkg-config was happy and was able to find my user installed libraries and packages.
    – phyatt
    Oct 28, 2015 at 16:21

Normally you should be able to re-configure and change the code to define a new location in your home directory or other path for all libraries and programs...

But, IMHO, the easiest way (if you have plenty of space) is use chroot in a subdirectory with all a linux distro installed in it. Of cuorse as a normal user you can not use chroot, but you can use these great tools: fakechroot and fakeroot

To create the chroot filesystem, I like to deploy a directory with Debian (or any Debian derivate like ubuntu) using the debootstrap utility.

So the procedure is easy (I will not enter in technical details, read the command manuals):

  • Get and install: fakeroot, fakechroot and debootstrap tools
  • create a subdirectory using debootstrap (I was only able to execute this as root. You can do it in another computer and copy the binaries if needed)
  • Execute: fakechroot fakeroot chroot mydebian-dir

If you need more details, I think I had an script somewhere to do all this.


Another solution for this problem is using the Gentoo Prefix, as the MacOSX users and other platform (solaris, AIX) does:


It will compile the Gentoo stack (with portage) in a $PREFIX location. It uses the Gentoo packages, most of the packages support the usage of these settings.

Portage will keep track of all the dependencies, you will have the last version of the software, it has been tested by the community...


If prefix=/home/foo/usr doesn't work, try:

CFLAGS=-I/home/foo/usr/include LDFLAGS=-L/home/foo/usr/lib ./configure

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.