How can I compile/install additional software on a managed linux workstation?
Only system administrators with elevated privileges (a.k.a. sudo or root privileges) are allowed to use the commands apt, apt-get or dpkg to install pre-compiled .deb-packages on a managed linux client.
As a possible way around this restriction, most software can be built from its source code and installed without elevated privileges to a custom location. Details to install software from its source code are typically listed in accompanying files named README and INSTALL, the following describes a generic installation process:
Generic installation process
- Download a source code archive, unpack it and enter the source code directory
Execute the command ./configure --prefix=/home/$USER/package
The configure script checks for dependencies necessary to build the software and creates the so-called Makefile. If it fails due to missing dependencies, install those first and set the necessary environment variables to make them available (see table below)
configure --help lists options and environment variables possible to pass to the script
Execute the command make to build the software
Execute the commande make install to install it
Variable |
Meaning |
PREFIX |
Toplevel directory path where the software is going to be installed |
CPPFLAGS |
C preprocessor environment variable to add directories containing library headers in a custom location |
LDFLAGS |
Linker environment variable to add directories containing libraries installed in a custom location |
Simplified example
The directory opt serves as the location for all custom-built software in the following examples.
Install a software where all dependencies are available
./configure --prefix=/home/$USER/opt
make
make install
Install software depending on previously built libraries
export CPPFLAGS=-I/home/$USER/opt/include
export LDFLAGS=-I/home/$USER/opt/lib
./configure --prefix=/home/$USER/opt
make
make install