Why hammer nails with a microscope if there is Alpine Linux?

By calling my heart and working in Digital Design as a systems engineer, I often have to deal with over-complicated software products and architectural designs. This causes a passionate desire to minimize and simplify everything that comes handy, and leads to the delight of human decisions, just doing their job. without registration and sms .


So I got to know Alpine Linux.


Unexpected window


You may like this distribution for the following reasons:



By "mainstream", I mean the CentOS-Debian-Ubuntu trio (of course, the world doesn’t end with them), may all those who believe in these wonderful distributions forgive me. When they are used, periodically, on the border of perception, a poignant thought arises - “can it be possible easier?”


Do we really need it?


$ holywar mode disable
Does all this require you to solve your small task:



Since we remembered minimalism, we can very roughly compare our leading distribution kits in their minimal installation:



holywar: cannot change mode to 'disable': Permission denied


I want a strange


From the part of the above, you can (try) to get rid of manually, but suddenly everything is already invented for us? Ideally, from the distribution of the general purpose server operating system I would like to see:



And that's about it, the rest is up to the package manager. Less executable code and configuration — fewer bugs, fewer bugs — fewer bugs. And the system is still running and available over the network. The idea looks good, now let's see how close the Alpine Linux distribution is to it.


About Alpine


What can fascinate Alpine, especially after CentOS? Desperate minimalism!
And, of course, the absence of the need for certification " Linux Systemd Certified Voldemort ".


What the authors did:



Namely:



In addition, the authors implemented a number of measures aimed at increasing the level of security of the basic system:



As a result, we get a system equipped with a number of additional protection mechanisms, allowing to solve the existing problem and occupies about 130 MB . The running system has 41 packages installed and 13 user processes are running, you can knock on ssh.


And nothing more. It remains to add what you need (and iptables with the ability to restore the configuration at startup, put it).


Open the lid


Please note - Alpine can be useful as a learning platform when learning about Linux! To see the logic of the components is subjectively easier than trying to cover CentOS or Ubuntu right away:



Bootloader configuration



output ls / boot



Running bootloader



/ Etc / inittab content



Further, the state of the system depends on the openrc configuration, namely:



Demons and their link to levels


It remains to read the startup scripts and process them based on the launch levels and dependencies.
We can use the example of syslog (/etc/init.d/syslog) to see what the openrc startup script looks like.


As you can see, these are not always your unloved "footcloths":


Openrc configuration file sample


Variables used during script execution are defined in the corresponding /etc/conf.d/syslog file. In our case, the variable SYSLOGD_OPTS = "- Z" is defined in the file.
Please note that the script declaratively defines the dependencies of this service.


Openrc honestly iterates the startup scripts in a given order, reaches the level of “default” - and here it is, the working system!


Demons under the hood


What exactly is hidden under the openrc startup scripts? Oddly enough - a set of tasks and demons listed below.



Hooray, after completing these steps, the system is ready to go! Do not forget about the dependencies on the above services, which were specified in the init.d files:



Open one of the local consoles where getty waits for us, enter the login, then pass the password to the login process and get access to the running ash shell (when started, the contents of the / etc / profile, /etc/profile.d/* and /.profile to prepare the user environment).


Hooray, no additional entities (of course, useful in some cases, like PAM) - and we are in the system!


It remains to use the package manager apk, and look for the packages we need for our task. (Are they there? You can evaluate it through a web portal ).


And also



Total


The Alpine distribution is not perfect, but its conciseness really impressed me, especially as a container (only 6 processes - init, 4 * getty, syslogd). For me, it looks like what the minimal server operating system should look like (forgive me, CentOS!).


In addition, it is quite suitable for the role of the training platform, which allows you to see what a modern distribution kit consists of, without plunging immediately into the abyss of whateverd services and multiple duplication of functionality in superbly-multi-level configurable tools for all occasions.

Source: https://habr.com/ru/post/415279/


All Articles