I’m new to Linux and I still don’t see enough benefit to package managers to understand how they have become so dominant.
For example: say I’ve heard Emacs is amazing and I want to try it out. I go to the Ubuntu Software Center and search for Emacs.
I get 11 results, half of which looks like it has nothing to do with emacs or are in Dutch. Then, there are 5 results that look plausible, all with barely any reviews and horrible documentation. So, I have no way of knowing which is the real Emacs or that it is what I want.
I say I guess I will use the command line. Here, again, I get 8 results. At least here 6 of them actually say emacs in the name but no way to know which is the real deal.
I understand that the lack of dependency problems and knowing it is correct for your operating system are great benefits.
But how is this better than going to a browser, searching for Emacs, finding the downloads page, clicking on the one for my operating system and letting it go. That way I know it is what I want, can see it step through and have been to the developer’s site so I have an idea how supported and documented the program is.
Package mangers offer some nice features, but I don’t see that they do enough to have become basically the only way to get software on Linux.
Why are package managers prevalent? Because people don’t like having to download the source for every program they want to run, the source for all of its dependencies ( both build time and run time ), and compile it all themselves ( which often involves working out differences in configuration settings, and patching the code itself to work right with the specific versions of the other packages you have ). It is much nicer when someone else has compiled the program for you, its runtime dependencies, and the package manager figures out what it needs to download and install for you.
Another way of looking at it from a more Windows’ centric position is to think of “dll hell”. On Windows, you download program A, and it uses library Z. Program A’s installer places a copy of library Z in your system directory. You then download program B, which also uses library Z, but a slightly different version. It replaces the copy of library Z in your system directory with its version. But that version doesn’t work right with program A, so it breaks. Eliminating this kind of breakage, as well as eliminating the need for both programs to include a copy ( whether it is compatible or not ) is what package managers do. They figure out what libraries each program needs, and installs the correct version(s), replacing older ones when they are compatible, and installing both if they are not.
Most windows software has taken the aproach of just including library Z with both programs, and installing it to their own private direcotry. This stops the breakage, but means that downloading the two programs requires downloading the same library twice, and taking up more disk space, and more ram since they aren’t sharing the library, which defeates the original purpose of having the common library in the first place.
Finding one single precompiled binary that will work on your Linux
system, without using a package manager, is not usually feasible. There
are simply too many kinds of Linux out there.
On Windows, you can find a single precompiled binary that will work,
because Windows is controlled by a single corporation and thus it is
relatively monolithic and consistent. About the only thing that varies
from one Windows box to the next is the version of Windows it’s running,
and perhaps the service packs.
But Linux is far more diverse. Anyone can create their own distribution,
and many individuals and groups have done so. There are hundreds of
them, ranging from the popular to the obscure; from general-purpose to
highly specialized. No one could possibly compile a binary that would
work with all of them.
Thus, package managers. The creators of a distribution, being intimately
familiar with the components of that distribution, package up the
software to work with those components. They set up the dependencies and
identify conflicts. They stand prepared to handle any problems that crop
up, as long as they crop up on their own distribution. They keep up with
upstream changes. They deal with bug reports stemming from their own
mistakes, and pass the rest upstream.
You don’t have to use these services, of course. You can always
download the source tarball and compile it yourself. It’s well worth
doing so, at least once, to gain some appreciation of the complexities
involved in packaging software. The maintainers do a lot of work to make
things easy for the end users. Don’t devalue that work.
If you’re having trouble finding the right package on Ubuntu, I suggest
you ask for help on Ask Ubuntu.
Don’t install software that you downloaded from the internet before checking in your package manager to see if the same software is available from your distribution’s default software repositories. Installing software from untrusted sources is the easiest way to hose your operating system.
Package managers in Linux are designed to resolve dependency issues automatically and to make selecting software as easy as possible. However it restricts the user’s freedom of choice to provide only the latest versions of all software packages in the software repositories. In the case of Emacs you may see GNU Emacs 24 as well as some older versions of Emacs, but it is a safe choice to select the latest GUI version of Emacs and install that version. Typically a GUI version of a package will have a nice icon to the left of the package’s description in the package manager to give you a visual cue that it is a GUI version.
Using the package manager is the best way for a new user to select packages for installation. Installing packages from the terminal gives the user many more options to choose from, but it might be confusing for a new user.
Since you are a new user, I also have some advice about using Emacs. Emacs has a few features that other text editors in my default software repositories don’t have, and installing Emacs is the easiest way for me to get a text editor with these features. I normally use only two features that are unique to Emacs, so I use Emacs when I need to use these features, and a more user-friendly text editor otherwise. Emacs is very customizable, and I have customized my Emacs to make it easier to use for doing the tasks that I normally do in Emacs.
On Windows applications are usually standalone, and work well by themselves.
Linux takes a different approach, it’s a composition of many small applications that work together. So if you want to create a new one you can simply compose others, saving plenty of time and maintenance.
But that net of relationships requires a package manager to handle what to install.