I need to compile some software on my Fedora machine. Where's the best place to put it so not to interfere with the packaged software?
Rule of thumb, at least on Debian-flavoured systems:
/usr/localfor stuff which is "system-wide"—i.e.
/usr/localtends to be in a distro's default
$PATH, and follows a standard UNIX directory hierarchy with
/optfor stuff you don't trust to make system-wide, with per-app prefixes—i.e.
/opt/mono-2.6.7, and so on. Stuff in here requires more careful management, but is also less likely to break your system—and is easier to remove since you just delete the folder and it's gone.
If you really don't want it to interfere at all, don't put it anywhere in your
If you want it in
$PATH, at least make sure not to install to
/usr/local. I've found that a lot of software looks there even if it's installed by the distro into
My favorite way to install custom-compiled software is in my
$HOME directory. That way you don't have to use
sudo for anything, and it's very nicely separated from the rest of your system. For example:
mkdir ~/stage ./configure --prefix=/home/username/stage && make && make install
And if you want to, you can then add
/home/username/stage/bin to your
Put them to
What I do is extract the source in this directory. It will create a path like
Then I create a symbolic link to it:
/usr/local/src # ln -s postgresql-8.3.7 postgresql
Do all your building in
Doing things this way helps when you need to pop between versions and documents what version you are using.
Per the FHS,
/usr/local/ is used for applications compiled from source, while
/opt/ is used for 3rd party applications not supported by your operating system vendor.
If you want to able to easily install and remove several applications you've built yourself, you can use Stow as a simple package manager.
Two things I'd recommend:
System wide: use stow and install under /usr/local/stow/package-version. Then you can easily switch between version.
In my home, or if I don't have /usr/local write permissions, I personally install programs under ~/.local, which is hinted by XDG standard.
You can also use stow locally, although I never did :)
I have a little different setup than most people because I do a lot of development. I have a /home/jackson/bin/ directory that I install stuff into and I've edited my .bashrc adding this:
export PATH=/home/jackson/bin/bin::$PATH export LD_LIBRARY_PATH=/home/jackson/bin/lib:$LD_LIBRARY_PATH export PKG_CONFIG_PATH=/home/jackson/bin/lib/pkgconfig:$PKG_CONFIG_PATH
I wouldn't do this for everything, but its nice during development.
The easiest way of doing this is to grab the source package (
.src.rpm for RPMites), unpack it, hack the new source/configuration/whatever into it, change the version appropiately and build. Installing this makes your package manager aware of the new package, allows to consider it for dependencies and uninstall/update.
This is a chore the first time around, but if a new version (or some critical patch) comes out, it is then simpler to update. Another benefit is that you can create your own repository with local software, to be shared e.g. by the machines in a lab.