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/local for stuff which is "systemwide" - i.e. /usr/local tends to be in a distro's default $PATH, and follows a standard UNIX directory hierarchy with /usr/local/bin, /usr/local/lib, etc. /opt for stuff you don't trust to make systemwide, with per-app prefixes - i.e. /opt/firefox-3.6.8, /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 $PATH. 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 /usr. 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:
And if you want to, you can then add /home/username/stage/bin to your $PATH. |
|||||||||||||
|
|
Most of the time, I like to place my own compiled stuff in |
|||||||||||||||
|
|
FHS says to put it in /usr/local where distributions shouldn't be touching it. |
|||
|
|
|
/usr/local/src What I do is extract the source in this directory. It will create a path like /usr/local/src/postgresql-8.3.7 I will create a symbolic link to this /usr/local/src # ln -s postgresql-8.3.7 postgresql Do all your building in /usr/local/src/postgresql Doing things this way helps when you need to pop between versions and documents what version you are using. |
|||
|
|
If there is possibility - I'd suggest compiling your software and then creating FC package (I believe it's using yum to install software packages). Then you can install that package of your own compiled software and remove it without messing up the whole system. |
|||
|
|
|
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. |
|||
|
|
|
This reminds me, I need to use checkinstall more often! That way I just do the usual
followed by
to create a .deb file... |
|||
|
|
|
Per the FHS, |
|||
|
|
|
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:
I wouldn't do this for everything, but its nice during development. |
|||
|
|
|
It is actually not that hard to create deb's or rpm's from a source tarball. That way, you can use the facilities of your distro's package manager to keep your system clean. This is what I do, most of the time: just create a little rpm. |
|||
|
|
|
There's always the option to "put it where it belongs" but write a simple rpm, first. |
|||
|
|
|
if you are compiling an application you can add its executables path in you PATH env variable. this will not impact other users. |
|||
|
If you want your application to be available for all users on the system and you have the necessary permissions, use /opt. If you want the application to be available only for you (and root), use /home/username |
|||
|
|
|
The easiest way of doing this is to grab the source package ( 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. |
|||
|
|