Header Ads

Exploring Alpine Linux 3.2.0

Joherujo - 
AlpineAlpine Linux has become one of the most frequently requested distributions on my list of projects to review. Alpine is an independent distribution which, as the project's front page tells us, is "a security-oriented, lightweight Linux distribution based on musl libc and busybox." The project's About page goes into more detail: "Alpine Linux is a very simple distribution that will try to stay out of your way. It uses its own package manager, called apk, the OpenRC init system, script driven set-ups and that's it! This provides you with a simple, crystal-clear Linux environment without all the noise. You can then add on top of that just the packages you need for your project, so whether it's building a home PVR, or an iSCSI storage controller, a wafer-thin mail server container, or a rock-solid embedded switch, nothing else will get in the way." 

Looking through the download options we find that there are a number of different builds we can select. We are presented with six editions: Standard, Mini, Vanilla, Xen, Raspberry Pi and Generic ARM. I was not able to find any concrete description of what set the various editions apart. Raspberry Pi and Generic ARM seemed straight forward enough, but I wasn't sure what would differ between the Standard, Mini and Vanilla editions. The Standard edition is about 300MB in size and it was the option I chose to download. The Vanilla and Mini editions are both about 90MB in size and I'm not sure what those two editions do differently. 

Booting from Alpine's Standard media brings up a text console. From the text console we can login as the root user without any password. At this point we have a fairly minimal command line interface without manual pages or hints as to what to do next. Luckily, Alpine has an extensive wiki and the documentation includes a section on installing Alpine to our hard drive. As it turns out, most people can probably just run the program setup-alpine and follow the on-screen instructions. 

The setup-alpine program presents us with a text installer that walks us through several configuration steps. We are asked to select our keyboard's layout from a list, give our computer a hostname and then enable networking. We can opt to use DHCP to get an IP address or we can manually provide our own network settings. We are then asked to make up a password for the root account. The following steps ask us to select our time zone from a list, select a package repository mirror the same way and then we are asked if we would like to run OpenSSH or Dropbear as our secure shell server. We are then given the choice of which network time daemon the system should run with options including Busybox, OpenNTPD and Chrony. The user is then asked to select a disk where Alpine will be installed. The next step is interesting. We are asked if we would like to use the target hard disk for storing data only, or we can use the disk to store the entire operating system plus our data. Apparently we have the option of running Alpine from live media and accessing our data from the hard disk. I decided to place the whole Alpine operating system on a local drive. The installer copies its files into place and then asks us to reboot the computer. 

At this point I found Alpine would work well in my VirtualBox test environment. Alpine booted very quickly and generally worked well. However, when I tried to run Alpine on a physical desktop computer I ran into a few problems. When booting on my desktop machine Alpine would present me with a command line and indicate it could not find the operating system. With a little experimenting I discovered the root partition had not been mounted. I performed the mount manually and resumed the boot process. Alpine then reported it could not find any init software. I found /sbin/init on Alpine was created as a symbolic link. I replaced this symbolic link with a hard link to the init program. Alpine resumed booting once more, but eventually ran into a kernel panic before reaching a login prompt. After some experimenting, I gave up on running Alpine on my desktop machine and focused on the instance of Alpine I had running in a virtual environment. 

The Alpine distribution, by default, boots to a text console. We can login to the root account using the password we created at install time. Alpine is quite light on resources, using a mere 40MB of RAM and taking up 265MB of hard drive space for a full install. The distribution ships with basic GNU command line utilities and version 3.18 of the Linux kernel. When we first sign in a message appears letting us known documentation and tutorials can be found in Alpine's wiki. I definitely recommend exploring the section of the wiki containing tutorials and how-to guides as they are well written and provide step-by-step instructions for enabling common services. 

While exploring Alpine's default environment, I made a number of observations which I will share here in no particular order. First, Alpine uses OpenRC to bootstrap the operating system and manage background services. OpenRC is quite light in RAM (using 52kB of resident memory, according to the ps command) and operates very quickly. I usually do not use OpenRC and so I turned to the manual pages, only to discover Alpine does not ship with the man command, nor does the distribution include documentation pages by default. Once the man package has been installed from the repositories, we find documentation is packaged separately from software. So, for example, the repository contains an openrc package and an openrc-doc package for optional documentation. Likewise, the repository holds a coreutils package for common GNU command line programs and a separate coreutils-doc package with documentation for these programs. 

Alpine is a very minimal distribution by default. Not only does the distribution ship without manual pages, by default the Standard edition does not ship with a compiler, firewall (iptables) or a graphical interface. When searching through the distribution's repositories (more on package management later) we can find graphical desktop environments, the GNU and Clang compilers and an iptables package. By default user accounts use the ash command line shell. We can install bash from the repositories. Observant readers will note a pattern. Very little is included in Alpine by default, but most popular software can be installed via the distribution's package manager. 

Alpine ships with an unusual security feature. When a regular user runs the top or ps commands, they can see only the processes they own. This prevents some forms of snooping on other users' processes. When the root user runs top or ps they can see all running processes, regardless of who owns them. Speaking of user accounts, by default we start out with just the root account. If we wish, we can enable additional user accounts using theadduser command. 

Earlier I mentioned Alpine does not include local documentation with the operating system, but there is a good deal of documentation on the project's website. Browsing through the Alpine wiki I found documentation on setting up services such as OpenSSH, an e-mail server and an Apache web server. There are tutorials for setting up desktop environments, configuring common services (such as CUPS, for printing) and tips on using monitoring tools. Each how-to document is laid out in an easy to read format and includes clear instructions. 

On Alpine we use the apk command line utility to manage software packages. The apk program uses a command line syntax similar in style to APT onDebian or DNF on Fedora. The apk program works very quickly, which is nice, but it also offers very terse output. For example, when trying to perform an upgrade apk does not say whether the local software is up to date or not. I like to assume no output from the command means no new upgrades are available, but it is difficult to be sure. Even with verbose output enabled on the command line, apk still does not tell us what it is doing (or not doing) or why. Despite the lack of information from apk, I did find the package manager was functional. Using apk, I was able to install lots of new packages, remove unwanted items and search the repositories for new packages. 

At one point I experimented with adding a desktop environment to Alpine. I suspect, based on the project's documentation and minimal nature, that Alpine is intended for use on low-end devices, routers, home servers and similar headless machines. Still, Alpine's repositories do feature desktop software (including Xfce, Firefox and Claws Mail) so I wanted to give it a try. The Alpine wiki includes instructions for setting up the X display server and a tutorial on enabling Xfce. While I was able to install the necessary packages, I did not get X to work properly as it seemed to be missing the necessary drivers to work inside VirtualBox. I suspect a graphical environment would have worked as expected on a physical computer. 

Conclusions 

I am of the opinion that an operating system should either be easy and intuitive to use (like Linux Mint or Mageia) or the operating system should provide a lot of clear and useful documentation (like FreeBSD or Arch). I believe Alpine fits cleanly into the category of providing a lot of useful documentation while offering a bare and terse user interface. I am okay with this arrangement as it means Alpine offers an uncluttered, clean operating system, but I think it's important to note which sort of system we are dealing with; Alpine is an operating system that requires the administrator to read. 

There are a number of things I like about Alpine. The distribution is lightning fast, very light on resources, offers a good deal of documentation and lots of packaged services. The wiki is well organized and the distribution provides builds for common x86 and ARM hardware. 

I had just one complaint while using Alpine. Basically, it is that some aspects of the distribution are not immediately obvious. For instance, even after skimming through the project's documentation I am still not clear on what the difference is between the Mini and Vanilla editions. The package manager, while capable and fast, is terse to the point of being cryptic. Since, as I noted above, the distribution requires some reading, I think the developers should probably have included manual pages in the Standard installation. In short, I feel that information should be more readily available to facilitate navigating this distribution. 

During my time with Alpine I set up a file server, a web server and some database tools. Everything worked well and I was very much in the debt of the wiki writers. The distribution makes performance a priority and offered me very little trouble once I finished the initial setup. I think people who want to run a minimal system, especially on low-end hardware, will be quite pleased with Alpine.
* * * * *
Hardware used in this review

My physical test equipment for this review was a desktop HP Pavilon p6 Series with the following specifications:
  • Processor: Dual-core 2.8GHz AMD A4-3420 APU
  • Storage: 500GB Hitachi hard drive
  • Memory: 6GB of RAM
  • Networking: Realtek RTL8111 wired network card
  • Display: AMD Radeon HD 6410D video card

1 komentar:

  1. Interesting review. Looks like a straight copy/paste from the DistroWatch website. Have you acknowledged this?

    BalasHapus

Trims untuk kunjungannya, silahkan berkomentar :