Installing software to specific locations?

I am a bit new to linux, or at least Ubuntu specifically (I've tried others such as tails, but that was mostly for web browsing), and have been thinking about migrating to it from windows. Things have been going well so far, except for one problem: On windows, I usually keep my apps and other things organized into specific files\custom install locations to make them easier to access and manage. so for example, firefox, thunderbird, etc would be installed in "E:\myusername\apps" (I have them installed on a separate hard drive) or sometimes other apps like virtualbox would go in "E:\myusername\Virtualization\Apps" and so on.

But despite reading other questions like What is the Linux equivalent to Windows' Program Files? and How to understand the Ubuntu file system layout? to get somewhat of an understanding of how linux's file system works and other questions that are (at least kind of) similar to mine such as Install package to specific location and Install chrome to a specific location, none of them seem to answer my specific problem. Is there a way to organize linux apps into a specific folder? If not, is there any other way to make it easier to access and manage linux apps?

Sorry if my question is incredibly basic, but it's been somewhat of a frustration for me in terms of migrating, especially when I have things like apps arranged specifically and I just want to save myself a headache of browsing through multiple directories if I want to configure or tinker with an app. Like for example, WINE will install in /opt/ while gparted will install in (I think) /usr/share and /usr/bin, but neither in one particular location.

edit: fixed links


Solution 1:

Trying to relocate where software is installed is a very bad idea especially since you are new to using Ubuntu

*NIX and Windows are very different from each other. Windows software tends to include everything it needs, but a lot of software in Ubuntu rely on shared relationships between packages (dependencies). *NIX also has a fairly rigidly prescribed directory structure and relies on things like ownership and permissions for security and stability. These concepts don't really exist in Windows.

If you are new to learning Linux, it's really good that you are already doing research to learn how Linux works rather than trying to "swim against the current". You will definitely have a better experience with this mindset.

I also sense a question that wasn't asked from reading in-between the lines, and that involves how to install software. It's best if you find software in the Ubuntu software center (or learn to use apt). Many new users get into trouble when adding a bunch of PPAs, downloading a lot of .deb files, or trying to manually compile software. These are more advanced tasks. Not all PPAs are equal and some can even mess up your system especially if they are outdated or come from sources that are not regularly audited. See: Are PPAs safe to add to my system and what are some "red flags" to watch out for?.

In terms of WINE, know that WINE is merely a compatibility layer to allow you to run some Windows applications with sometimes wildly different results and implementations.

Ironically, one of the biggest difficulties for a lot new users stems from one of the biggest strengths of Linux: an abundance of choice. You have a lot of freedom with what you can do with your system, there are a lot of people online posting about doing wacky things, and it can be hard to tell what you should and shouldn't do.

Definitely avoid blindly running commands in your terminal from websites or guides you see online. It's a really good learning opportunity to research each command so that you know exactly what it does, and the consequences of those actions. It's also a good idea to keep a journal or log of anything you do off the beaten path so that you might revert those changes if needed.

If for some reason, you have an application that does not show up in your list of applications, you can manually create .desktop files, which are similar to application shortcuts in Windows. .desktop files can reside in /usr/share/applications if you want them to be available for all users, or ~/.local/share/applications if you want them to be available just for your user. For more details about this, see: Creating a .desktop file for a new application.

You can also edit existing .desktop files to customize these shortcuts, which can give you a lot of flexibility if you want to use different icons, change their labels, or add new actions.

So to reiterate, a good rule of thumb when you are learning is to try to find the software you need that is available in Ubuntu's repositories. This software will be highly tested to be safe, stable, and polished. It will also be easy to locate in your system search bar and your application list.

Solution 2:

This is an "in addition to" Nmath's answer, not an "alternative to". Everything there is very right.

One of the major reasons not to install anything to "C:" or "C:\Program Files" on Windows is "you always have to be prepared to do a clean zero re-install if something goes wrong (or every 18 months or so just to be proactive) and you want 'your stuff' to be somewhere else when that happens." Another is "if your programs do something stupid and use up all the C:\ disk space, not just that program, but your system totally breaks."

The Unix solution to both of these is separate partitions/mount points. /home is on a separate partition from /, as is the log partition, the data partition,... (if necessary). Need to do a complete reinstall? Sure, the system partition will be wiped out, but /home is right there with all your stuff.

By and large non-"system" programs install themselves into /opt or /opt/local, instead of /. That can also be a different partition (but see the potential dependency issues Nmath points out, when rebuilding the system partition.) Many programs that have had critical dependency mismatch issues in the past have moved to the snap model, where they get their own whole mini-environment with their versions of those dependencies not used by any other program. Do use both of those, as they also solve some issues of "everything on C in Windows".

Note that you can install programs just for you, which usually get installed in some subdirectory of your home directory, ~/bin or ~/opt/bin or wherever. But note that this is not recommended behaviour for a system, just a way for you, a non-privileged user, to install your favourite working tools on my system, without bothering me or any of my other users. Of course, you can symlink, or even mount, ~/bin to some other location if you wish - I definitely have ~/my_stuff symlinked to its own network drive because I want it accessible from all my computers (and backed up differently from ~), for instance. But what's in ~/bin should only be things you wrote for you, not system applications/utilities.