Install Alpine Linux on an older computer

For the old hardware, I would much rather find new ways to use it, rather than just throwing it away. The Alpine Linux is a non-comercial distribution known for its small resource requirements, simplicity and security.

The version I have used for my install is 3.11.3. However, the purpose of this article is to provide a rather general overview of what you need to do. So the intention is to use the latest versions for everything, even if this might lead to some different here and there, as compared to the following content.

You can find more information on the project’s webpage: https://www.alpinelinux.org/about/

What should you do first?

  • Learn how to get into the BIOS of your machine and make sure you can boot from a USB stick. If this is not possible, then you must find an alternative to creating the installation media;
  • Check if your machine supports x64 architecture, so that you know which version of the install kit to download;
  • Obviously, you should have another device present, for researching situations not described in this tutorial or create new installation media etc.

Create a bootable image of Alpine Linux

Which version of alpine linux should you download for your bare metal install? For a rather normal install you should probably download the standard x64 version.
https://alpinelinux.org/downloads/

We will use balenaEtcher (https://www.balena.io/etcher/) to create the bootable USB stick. It has a quite intuitive interface, very accesible to everybody. The main thing to take into account is that it will delete all the data on your USB stick, so be sure this will not affect you.

Boot from the USB stick and install

A basic requirement is to be able to boot from a USB device. Depending on your machine, you might need to make some changes in your BIOS.

A couple of great tutorials installing Alpine with xfce as a virtual machine can be found at:

The operating system

I had multiple attempts to install the operating system, mainly because trouble setting up the network connection. However, with a little bit of patience and luck, you should be fine.

As the operating system loads from the USB stick, follow this:

  • use root as username to login;
  • setup-alpine and follow the default options as much as possible;
  • remove the USB stick;
  • reboot

Small introduction

  • Alpine apk does not have anything to do with the Android world apk files;
  • rc-service <name> start will immediately start your package;
  • rc-update add <name> will add your package to the default runlevel;
  • rc-update del <name> will prevent the package to start.

Sources:

XFCE as grapical interface

  • apk update
  • apk add nano
    nano is a very comfortable editor in the linux world. As opposed to vi which is already installed, nano has a rather more beginner friendly interface.
  • nano /etc/apk/repositories
    and ensure that /community is not commented.
  • setup-xorg-base
  • apk add alpine-desktop
  • apk add xfce4
  • reboot

At this point, you have two options. The first one is to manually start the desktop environment by using exec startxfce4 every time you want the desktop environment. The second is to continue with this sequence of commands, to have it start automatically.

  • apk add thunar-volman udisks2
    This is an extension for the Thunar file manager, which enables automatic management of removable drives;
  • apk add faenza-icon-theme
    As the name states, this is a nice icon theme;
  • apk add slim
    slim is a lightweight and simple to configure login manager;
  • rc-service dbus start
  • rc-update add dbus
  • rc-service udev start
  • rc-update add udev
  • rc-update add slim
  • reboot

Sources:

Further customisation and commands

Set a network name

For accesting the host easier inside the network, you can give the computer a name. I think I went around with the solution a bit, but I have named my computer shorty with the following process:

  • echo "shorty" > /etc/hostname
  • hostname -F /etc/hostname
  • setup-interfaces
    This will start helper which will guide you though configuring the network
  • reboot

Source:

Change the password for a user

echo "root:password" | chpasswd

This command will change the password for user root to password.

Connect with root via ssh

First and most important: this is not a safe practice, you should not use the root user directly. However, I use my computer for testing inside my home network. And it is more comfortable to do more settings via the command line, from my workstation.

So, use the following commands:

  • nano /etc/ssh/sshd_config
  • Ensure the following is present: PermitRootLogin yes

Source: https://superuser.com/questions/539139/putty-password-access-denied