I am not sure where to install such programs in Linux systems. Are there any conventions? They can just reside in the home directory and be ran from there as well. But is that the correct way of installing them? What are my options?
Asked
Active
Viewed 2,126 times
7
-
1Many of them will handle that for you, if you install them as described here https://askubuntu.com/q/25961/832813. – Quasímodo Feb 27 '20 at 00:56
1 Answers
5
Take a look at your $PATH for clues.
$ echo $PATH
/home/YOU/bin -- Yes
/home/YOU/.local/bin -- Yes
/usr/local/sbin -- Yes
/usr/local/bin -- Yes
/usr/sbin -- Never (package manager)
/usr/bin -- Never (package manager)
/sbin -- Never (package manager)
/bin -- Never (package manager)
/usr/games -- Never (package manager)
/usr/local/games -- Yes
/snap/bin -- Never (package manager)
Now let's remove all those locations on your $PATH that are reserved for package-manger-only use:
/home/YOU/bin
/home/YOU/.local/bin
/usr/local/sbin
/usr/local/bin
/usr/local/games
So the best places to manually-install applications are in your /home and in /usr/local.
- Example: Were I installing Project Foo, I might create a new directory
/usr/local/foo
to contain safely all the Project Foo files. That would keep the files separate from my other Project Bar files (in/usr/local/bar
) and Project Baz files (in/usr/local/baz
)
That's not all the possible places. Lots of manually-installed services wind up in /var as well as /usr/local.

user535733
- 62,253
-
2Advice: Always keep notes about what you manually install, where you got it from, where you installed it to, and a link to the install/uninstall instructions. Very handy for when you need to re-install it after all kinds of unexpected disaster. – user535733 Feb 26 '20 at 20:01
-
It would be good to mention some libraries and programs guide the user through installation. There are often
./configure
,make
andsudo make install
steps. – nmd_07 Feb 27 '20 at 16:00 -
"So the best places to manually-install applications are in your /home and in /usr/local" - so right in the roots of /home or /usr/local? I don't think Android Studio for example belongs in /usr/local/bin or /usr/local/sbin either. – samus Nov 05 '21 at 20:52
-
The official docs are vague (Install Android Studio): "Unpack the .zip file you downloaded to an appropriate location for your applications, such as within /usr/local/ for your user profile, or /opt/ for shared users.". However, these posts have helped: Into which directory should I install programs in Linux?, What is /usr/local/bin? – samus Nov 05 '21 at 21:13
-
"within /usr/local" doesn't specify where within, exactly. If I had to guess, I'd say /usr/local/android_studio, but installing additional 3rd-party binaries right in the root of /usr/local could get messy rather quickly. Also, what if multiple versions of Android Studio were required, or the Android SDK or Java SDK were to be installed within the same location, then /usr/local/android/studio would seem more suitable. However, if there was another completely different IDE to be installed altogether, then maybe /usr/local/dev/android/studio would be more accommodating. – samus Nov 05 '21 at 21:26
-
@samus I think I understand. Edited to address your suggestion -- take a look. – user535733 Nov 05 '21 at 21:46