Alpine Linux
Date: 20 Aug 2022
In the world of Ubuntu, Linux Mint, Arch and many more, Alpine Linux was fresh and light to me.
Since last year I was thinking to convert my old laptop into a “server” to understand more about networking, remote accessing data using cron jobs, auto backing up the data etc. But one thing always stopped – the Linux distribution. Earlier I was running Lubuntu on my old laptop and was connecting to it via SSH. The availability of GUI was not giving me a complete feeling of having a server-like machine with me. I didn’t knew how to handle the OS after deleting the desktop packages. And I was also having few hardware issues so whenever I tried running the latest Ubuntu distribution, it crashes. I knew that I was not taking the complete advantage of having access to the Linux environment for me. So, I went for Arch Linux. I faced several issues while I just started connecting the laptop with a network. I know that arch wiki is the go-to place, but it didn’t help much in this case. It is definitely a dictionary for almost any Linux distribution. And I blame myself for not spending enough time in debugging the issues I was having. Somehow it is just the wireless network card issue, so I used Ethernet and proceeded with the installation. I created partitions manually, setup users and passwords, downloaded the kernels (normal and LTS), grub. When I had everything and was about to bring up the xorg packages, my connection gets disabled. I spend many days and did the same process for more than 20 times, but no luck. I always landed in the same manner and at the same place. It was always with the network connection. BTW at that time, I didn’t knew that xorg packages are something for desktop which I didn’t wanted since I was going for the tty.
But I got a very good idea on how the installation happens and what all things build a Linux distribution. Earlier, I installed Ubuntu on my other machines for many times and this arch installation experience was completely relatable with the process happening in the background automatically in other distributions. I really enjoyed the process. I tried Debian too yet still no luck, thanks to my crappy hardware (or to my “dumb” brain). I am still wondering how come machines aged more than 15 years still managed to handle Debian and Ubuntu distributions but my 9 years old laptop couldn’t handle any distributions other than a very few selected ones. After getting tired of installing the Arch Linux for more than 20 times, I gave up. But couple of weeks back, the idea of having a database server got to me again. So, I started looking for a light weight server distribution on the internet. I came across CentOS (the most common ones), Debian, Ubuntu server, openSUSE server mode and Alpine. I tried CentOS and openSUSE, but ended up with the same issue (not the network but the machine always got stuck during the installation process). Then I tried Alpine. It is somewhat different from other distributions because it is completely independent from the regular distributions and not from a Debian family, arch family or any other popular ones. It has its own history. I was not sure whether I wanted this on my laptop because this was not so popular which means not many developers who are supporting it and developing it. Nevertheless, I went for it. It was closer to the Arch Linux installation process but can be installed with a single command (I have seen few arch Linux installation procedures which is similar to this, kind of quick installers I guess, but didn’t give them a try). In the end, I have an OS running on my old laptop just like I wanted. In the beginning, for sure, I was not expecting it to be stable during or after the first reboot. But surprisingly it is alive after going through the entire process. The package manager of Alpine is completely different – apk. With all these differences, I started looking more into the history and features of this distro. I was really surprised when I saw where it is used.
Alpine Linux is small, secure and simple. It was actually made for servers, routers and was made to run directly on RAMs. This is more under embedded systems category. The image itself is less than 300MB if I remember it correctly. It takes a very small amount of space, when installed on the hard drive. According to Wikipedia, this is under some kind of LEAF project. Coming to the “secure” part of Alpine, all binaries are Position Independent Executables (PIE). As far as I understood, it is something to do with randomization of memory locations so that the attacker will have hard time in tracing out the location of data. Coming to the “simple” part of Alpine, the package manager is called as Alpine Package Keeper(apk) and it handles installing packages in a whole different and efficient way than other package managers like apt etc. The philosophy behind it is “read only once, write only once”. More clear explanation can be found in videos created by the channel “Docker”. Though Alpine was started before 2010, it recently got active. One interesting fact is Docker uses alpine images as it’s default base images, so whenever you try to run a “hello world” container, it will be running on the Alpine OS. It is said that the recent traction for alpine is because of Docker. However, no clear statements were found anywhere. Alpine Linux uses completely different init system called “OpenRC” instead of “Systemd” (the most common ones in the Linux distributions). Personally, I feel systemd is more complex and heavy. Not clear about the technical components behind it though, but while using it (during the installation of Arch Linux) this is what I encountered.
So, finally I got my server-like machine up and the learning began already. I was not expecting to encounter with something like this distribution. I think there is a lot more to learn about this distro. I will be using this server for all those automated tasks in backing up the data, updating remote repos regularly via Cron jobs, learning more about networking, tweaking into the kernel etc. Since this distro is made for routers and firewalls, I think its worth exploring the distribution itself along with the use-case I am looking for.
References to checkout to get enough clarity on Alpine Linux –
- How to install Alpine Linux- link
- Small, Simple, and Secure: Alpine Linux under the Microscope - link
- Looking at Alpine Linux - link