Where do you put installed stuff on Ubuntu?

Packages installed with synaptic are usually well installed on your system (i.e. bin in /usr/bin/, etc.). However, when a software is not in the repo, I always wonder where I should install it, when everything comes together (i.e. /bin, /var, /man are all subfolders of the main folder of the software).

For now, I've opted for /var/opt/ or /usr/share, but I'm not really sure this is a best practice... is there any guidelines on that?


Solution 1:

The usual location us /usr/local or /opt. From the Linux Directory Hierarchy:

/usr/local, /opt

These are obsolete folders. When UNIX didn't have a package system (like RPM), sysadmins needed to separate an optional (or local) Software from the main OS. These were the directories used for that.

Solution 2:

/usr/local is intended for this

Have a look at checkinstall: https://help.ubuntu.com/community/CheckInstall

sudo checkinstall make install

It will create (and subsequently) install a .deb package, so you can do a clean removal, or install the same package easily and quickly on other machines (of the same architecture)

Solution 3:

/usr/local/ is my favorite.

You might like to skim the FHS -- keeping in mind that it is a bit dated, and it was never proscriptive, instead descriptive of common practice. That said, it's still worth a read.

/opt/ is another common choice. I don't like it. It feels funny. You might find it fine. /var/opt/ feels outright wrong -- /var/ is a home for data, not binaries.