-- Leo's gemini proxy

-- Connecting to yujiri.xyz:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; lang=en

yujiri.xyz

Software

Learn programming for good instead of profit

Anatomy of a Linux system


Here I'd like to go through the main components of a Linux system. Linux is a very diverse world; almost every detail can vary depending on what distribution you use, but I think a high-level perspective is still useful.


Package management


The way software distribution traditionally works on Linux is very different from what you find on Windows, Mac, or smartphones. On those platforms, when you want to install a prorgam, you go to the program's website and download it, or else you download it from some kind of "app store" run by Microsoft or Google or Apple (but these stores are generally not curated - any registered developer can publish anything to them). On Linux, you normally install things from a repository (like an app store, except all the apps are free software) run by the same people who make your Linux distribution. They take the program's source code, compile it themselves, and host it on this repository, and your distribution comes with a tool for installing things from this repository, called a package manager.


This might seem like a strange and pointless extra step compared to just downloading programs from the people who make them, but there are good reasons for it.


It reduces the amount of trust you place in upstream developers. Linux distribution repositories are curated, so when you get something from your package manager, you know it's been reviewed by your distribution's maintainers. Therefore, malware making it into Linux distribution repositories is unheard of.


It solves dependency management. Distribution packages contain information about all the dependencies they need and the package manager installs them automatically, so when you install something from your package manager, it'll almost always work out of the box, rather than failing because some library it needs isn't installed.


It solves updates. Your package manager can intelligently update all programs and libraries on your system with a single command. This means programs for Linux don't need to worry about having their own self-update system, and you don't have to worry about the security implications of your programs being able to just download new code from the internet at any time and run it.


It solves uninstalling. Your package manager keeps a list of which files were installed by each package, so when you want to uninstall something, you can do so reliably, even if the program doesn't come with an "uninstall" button.


Packages from your distribution repository are likely to be better integrated with your system than if you got them directly from the upstream developer. Many programs need to know a lot of system-dependent values, like what folder executables are supposed to be installed in, and where to find your installed themes and fonts. Again, Linux is a very diverse world - upstream developers can't possibly know about every distribution's answer to these things, so if you get software directly from them, it might get things like this wrong. Distribution packages often patch the program to correct these values for your system.


Package managers use special file formats that contain information about packages to install. The two most common package formats are `.deb` (used by Debian, and the many other distributions based on it) and `.rpm` (used by Red Hat, and the many other distributions based on it).


Service management and daemons


Remember that `init` refers to the first process started by the kernel at boot time. Generally, the init process starts something called a *getty* that lets you log in to a terminal (or else a graphical version of a getty that logs you into a desktop environment). `init` also handles something called service management. On some distributions, the service manager is technically a separate program that gets started by init, but the two are often talked about together.


The service manager's job is to start various background programs called services or *daemons*, and supervise them afterward (restart them if they crash, etc). Examples of these services:

One that connects you to the internet (actually, a few different ones that handle different parts of this complicated process).

One that detects when hardware, such as a mouse, is connected or disconnected. This one is called udev.

One that keeps your computer's time synchronized with an online time server. This one is called `ntpd` (Network Time Protocol daemon) (it's common for daemons to have their name end in 'd' like this).


The most popular service manager on Linux today is systemd. The old standard is called sysvinit (named after an old version of Unix called System V). There are several less popular alternatives, such as OpenRC and runit.


Desktop environment / window manager


Linux distributions aimed at non-technical users usually ship with a desktop environment preinstalled. This is a more extricable component than the rest - you can, on such a distribution, uninstall the desktop environment and install a different one of your choice, whereas you can't really do that with the package manager or service manager because they're too integrated.


GNU


GNU is an organization that publishes and advocates for free software. A whole lot of important Linux software is maintained by GNU, including a package called coreutils, which contains the core command-line tools like `ls` and `cp` (this is why some people insist on referring to Linux as "GNU/Linux" or "GNU+Linux" since Linux is technically only the kernel and most of the other software involved is GNU). They're also a big proponent of copyleft licensing, so if you see something described as "GNU software", you know that it's free software, with copyleft licensing, for Linux.

-- Response ended

-- Page fetched on Mon Jun 3 00:31:22 2024