Where to install a program?
If you will be compiling your own software then you ultimately control the installation location.
- By convention, software compiled and installed manually (not through a package manager, e.g apt, yum, pacman) is installed in
/usr/local
.
- Some packages (programs) will create a sub-directory within
/usr/local
to store all of their relevant files in, such as /usr/local/openssl
.
- Other packages will install their necessary files into existing directories such as
/usr/local/sbin
and /usr/local/etc
.
These are simply default locations and can be changed during
compilation.
Define installation location when running ./configure
When you are compiling software, the installation location can be specified by using the --prefix=
option when running ./configure
. It is highly recommended that you look at all of the available options for your package by running $ ./configure --help | less
. Additionally, browsing the INSTALL
and README
documents provided with your package is a good idea. They tend to include installation instructions and dependency information that is specific to the package.
Please Note
It should also be noted that although you can store software anywhere, according to the FHS, source code for locally installed software should be stored in /usr/local/src
!
Standardizing where you store your source trees will allow you to easily locate a tree if you need to copy a stock configuration file or binary. Even though some packages use it, your source code should not be stored in /usr/src
as that is designated for system software such as the kernel.
Ensure your locations is found by PATH
Finally, you need to ensure that your installation location is included in your $PATH
. If you decide to install your package in /opt
but it's not in your $PATH
your shell won't find the executables and you will have to use the absolute path to invoke your programs. Here are some great discussions from AU about configuring your $PATH
Additional reading: man hier
/usr/local
) OR on how to create your own package for it.~/apps
or~/programs
and put your programs in there. Make~/apps/binaries
or~/apps/on-path
, add that to your $PATH env var, and symlink the programs you want intobinaries
./usr/local
is globally accessible, installation in~onealdw/apps
cannot be accessed by any user other than myself.