170

Possible Duplicate:
What is the best place to install user apps?

I've downloaded a .tar.gz and ran sudo sh install.sh. It's asking me where to install the program to. I don't want it cluttering up my home directory, and I want it to be available in the applications menu. Where should I put it? /usr/bin? /usr/local/bin? Or are those only for single binaries? This program wants to create a folder.

mpen
  • 2,186

3 Answers3

113

First of all which Application are you installing? It is always preferable to install through the native Package Management as the Package Manager will handle the location, updates, paths and the launchers (shortcuts) for you. Also updates would be handled. You should ideally search for the package in the Software Center or Synaptic. PPAs can be used if the software is not in the default repos.

However if you are sure of installing this package, use /opt directory, /opt/appname for example. /opt would be suitable for this kind of installs. Launchers may or may not be created depending on the installer. You can create a launcher manually if the installer doesn't create. You may also use $HOME/bin for putting all your apps.

dialogik
  • 273
LFC_fan
  • 1,815
93

For all path-related questions, the Linux Filesystem Hierarchy Standard is the definitive reference.

If the program needs to create a folder, then /usr/local is the directory of choice; according to the FHS:

The /usr/local hierarchy is for use by the system administrator when installing software locally.

Avoid placing your local binaries directly under /usr, because according to the FHS, that hierarchy is reserved for the software provided by the Linux distribution (in this case, Ubuntu).

Note that, placing a binary in /usr/local/bin (or any other bin directory) will not create a menu entry; for that you have to provide a .desktop file and install it in the appropriate directory with the xdg-desktop-menu command.

Nagev
  • 674
  • 7
    I disagree. According to FHS, /usr/local should not contain extra directories beyond the ones specified, and /usr/local/bin should only contain binaries. Creating a folder in /usr/local or /usr/local/bin is a violation of FHS. /opt should be used in this case. – jordanbtucker Mar 28 '15 at 20:52
  • 8
    @jordanbtucker Hmmm, no the FHS states that: "No other directories, except those listed below, may be in /usr/local after first installing a FHS-compliant system." Actually, it's pretty explicit that /usr/local is for locally-installed software: "The /usr/local hierarchy is for use by the system administrator when installing software locally. [...] Locally installed software must be placed within /usr/local rather than /usr unless [...] to replace or upgrade software in /usr." – Riccardo Murri Mar 30 '15 at 08:45
  • 3
    @RiccardoMurri Ah, thanks for the clarification. That is an important difference. – jordanbtucker Mar 30 '15 at 15:58
  • 1
    "Extraction not performed" - You don't have the right permissions to extract archive in the folder "local". 1) I googled Firefox beta; 2) click download; 3) extract manager got opened; 4) I google where to extract it; 5) I get error; How I'm doing it wrong??? This is why people hate Linux! – icl7126 Dec 03 '17 at 09:14
  • 2
    Someone else might come up with something better icl7126 - I'm fairly new to linux (35 year old dev moved to Linux a month ago!) but for me what worked was to right click in the folder where the zip file is - select 'open in terminal'. Then type 'sudo xdg-open .' to open the file browser with elevated permissions. From there I could open the zip file with sufficient privileged to extract to the opt folder. – Chris Nevill Jan 14 '18 at 11:40
  • 1
    As I understand it, "No other directories, except those listed below, may be in /usr/local after first installing a FHS-compliant system." means that FHS-compliant systems proscribe creation of extra directories in /usr/local. The opposite meaning ("it's okay to create extra directories after a first install") would be if s/after/before. /opt/<package> seems the way to go. – P-Gn Mar 23 '18 at 20:45
  • 1
    This article makes a good case for using /opt rather than /usr/local – Stack Underflow Feb 19 '19 at 22:31
  • 2
    @StackUnderflow The usage of /opt and /usr/localis pretty similar in that both are intended to host software not provided by the Linux distro. But /usr/localis reserved to the sysadmin; /opt provides a directory tree under which 3rd party software vendors can install their software. E.g., if you buy a commercial application, it can install its own files in /opt/app-name without risk of interfering with anything installed by the distro or the sysadmin. – Riccardo Murri Feb 20 '19 at 20:13
  • 1
    Hum, OP was talking about an installer for Komodo, so most likely that should go in /opt. As I understand, things that create folders should not go in /usr/local. In /usr/local, you need to work with the existing directory structure. So libs can go in a folder under /usr/local/lib and your man page in /usr/local/man and your executable in /usr/local/bin. If what you need to install doesn't fit that, /opt is the better place. – Didier A. Jun 08 '19 at 07:14
  • @StackUnderflow, the "article" is a copy-paste from the StackExchange answer. – Ilya Serbis Jul 15 '21 at 14:18
11

Usually you would put it in /usr, binaries in /usr/bin if it's something bigger it would go to /opt.

dialogik
  • 273