Centos – Install development files locally to build on system without root access

centoslibraries

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.

Best Answer

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
    export CPLUS_INCLUDE_PATH=$CPLUS_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.

Related Question