Return to Level1Techs.com

Where do you install software in linux?


#1

Ideally everything can be found in repositories and handled by a package manager, but that’s not always the case, with Fedora more so than with Ubuntu. So if downloading and compiling source code or cloning github repos, where do you put them?

It’s easy to clutter ~/Download as a “temporary” dumping ground. Plus not having the directory in the PATH means having to remember absolute paths to execute programs… or even forgetting of their existence.

I’ve seen suggestions for /opt, /usr/local, but since that requires root permissions, is that such a good idea?

Another option is to create packages from source with tools like checkinstall and then let the package manager handle the installation, which is nice. But is there an equivalent for Fedora?


#2

I question this. Do you have examples?


#3

System-wide programs go in ‘/usr/local’ if they’re locally compiled. They go in ‘/opt’ if they’re precompiled.

You can make a ‘bin’ directory in your home folder for programs if their scope is limited to your account.


#4

psensor, gnubiff, checkinstall

So, downloading .tar and github repos into /usr/local? Requiring sudoing?


#5

Ah, there all old projects I guess?

https://copr.fedorainfracloud.org/coprs/scx/gnubiff/

https://copr.fedorainfracloud.org/coprs/nunodias/psensor/

checkinstall seems to be the oldest, with no maintenance for over 9 years (hence no support by anyone). the RPM spec will have been updated since then and the Linux FHS in 2015, youd want to check this program doesn’t conflict with modern distros.


#6

I prefer /opt

Funny that /opt and /usr/local are root owned directories (on ubuntu). Probably makes sense for some reason I’m unaware of.

Installers tend to spatter files all over the damn place unfortunately, and it seems to be different per distribution :rage:


#7

I saw the psensor copr repo, but notice that the Fedora 28 package failed to build… and the gnubiff one isn’t available for F28.

In general, is it safe adding all these third party repos? Are they just random people? I was used to getting these packages from the official Ubuntu repos without searching for other sources.

Fedora too it seems.

As long as they un-splatter them properly, I’m less concerned.

To be clear, you clone github repos into /opt and compile there?


#8

because people don’t like POSIX

derp


#9

Interesting, I don’t see where it defines folder structure or file locations. Is it supposed to?

Anyway I found this which may be handy.

https://www.tecmint.com/linux-directory-structure-and-important-files-paths-explained/


#10

I put everything in /opt for the sake of consistency. Easier for me.


#11

Was’t posix I was thinking of. Derp moment.


#12

Yeah, consistency is the point of this thread.

Couldn’t using /opt and sudo cause permissions and ownership issues though?

Also, since /opt is (usually) part of the root volume/partition, it might require changing the space allocation strategy vs having a smaller root and larger /home setup.


#13

OpenSUSE puts a bin folder in each user’s home folder iirc


#14

I was thinking of making a ~/opt or equivalent. Maybe convenient if it’s a single user system.


#15

I have a Projects in the /home/admindev directory for all of my GitHub and School stuff. For very special things I have a /mnt/Lab/Projects directory.

Things like IntelliJ, CLion, and various other tools, they go in /opt. I also have a lot of things in ~/.vim/bundle and ~/.vim/colors (muh customize) :wink:

I have a few things in /usr/lib and /usr/local but I couldn’t tell you what they were. Maybe Composer and Laravel? :thinking:


#16

Here is the de jure official documentation: http://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html

The de facto reality is that there’s a gray area. Personally, if I pull something from git, I put it in /usr/local and consider the git pull kind of equivalent to compiling, but you could also put it in /opt. You can also put either or both on separate partitions.

This would be unusual, but not unprecedented. The home folder is supposed to serve as a division in scope from the rest of the system, so it would follow that ~/bin ~/opt ~/lib ~/etc ~/opt ~/srv and ~/var are all hypothetically viable, although I have only ever seen ~/bin.

I believe this would be the most appropriate.

I think this makes sense for stuff you are working on, but not necessarily something you’re just pulling off of GitHub to use. Again though, it’s all pretty arbitrary. Just watch out for SELinux if you want to execute something from an unusual place.


#17

Breh, this is how I roll:

image


#18

I have an ‘archbuilds’ and ‘voidbuilds’ folder on my machine and I can bet you know what those are for. I also just have an apps folder that I throw exe’s and shit into. Appimages, flatpaks, everything.


#19

I too am lazy to make my own repos and packages most of the time, so I do this:

./configure --prefix=$HOME/local

It seems to not interfere with anything and keeps things separate.


#20

Not all code requires ./configure or make install. Some just need make or already have a binary executable. It just seems wrong to require root to make/run regular projects, which is why I’m hesitant about anything outside of /home, but on the other hand that doesn’t seem good for organization.