When it comes to choosing a Linux distro, you may want to use Arch Linux because it's lightweight and you choose what runs on your system. There's a distro that is even lighter than Arch Linux: Alpine.
In this guide, I will explain how to get a fully working KDE Plasma desktop on Alpine Linux.
The obvious first step is to download the system ISO. Head to https://alpinelinux.org/downloads/. Now pick the extended version since it contains everything we need to get a working install (this guide doesn't cover installing with other versions).
Once the download is done, put the ISO on a USB stick as you'd do for any Linux distro, and boot on it (these two are out of the scope of this guide).
Booting the live system
Now that Alpine is downloaded and you've booted into the live system, login as
If you have ever installed Arch Linux, this prompt might seem familial, although Alpine Linux comes with a step by step installer that helps you get everything ready.
Formatting a Btrfs partition
Now comes the hard part: formatting your disk to Btrfs. Btrfs is the recommended file system for Linux systems nowadays, but Alpine Linux doesn't use Btrfs by default. If you want to use Btrfs for your system partition, you need additional setup.
First, load the Btrfs drivers with
Now, partition your disk using your favorite utilities. If you don't know which tool to use, you can use
cfdisk (install it with
apk add cfdisk), but be careful with this tool! Make sure to reboot after changing the partition table.
apk add btrfs-progs and
mkfs.btrfs -f /dev/sda1 (replacing
sda1 with the name of your partition). You now have configured Btrfs for your system partition. If you want to create additional Btrfs partitions, you can do so following these same steps.
Installing the base system
Installing the system is simple: run the
setup-alpine command and follow the steps.
Setup your keyboard
You get a list of all the available keyboard layouts. First, enter the name of the keyboard language you have, and then select the variant you want (for example in French I can use AZERTY, BEPO or DVORAK). If you are installing Alpine Linux on a Mac, you might want to use the Mac variant.
Setting a computer name
This part may seem like nothing but it is actually very important. If you want to access your computer remotely from another device in your network, you need to give it a name. Make sure you use a name that isn't already existing on your network.
The name can only contain lowercase letters, numbers, dots, hyphens and underscores.
To make sure you get the most up-to-date system once you install, you need to configure the network. While this is not a required step, it is highly recommended that you setup the network.
Generally, just pressing Enter at every prompt should get you connected, unless your network requires special configuration.
root is the system administrator account on POSIX systems. Alpine, by default, does not create additional users.
At the end of this guide, we will disable the
root account for security purposes, but it is required that we give it a password to access the system once it is install.
Selecting a timezone
Selecting a timezone will... obviously, help set the time. If you don't know what you need to put here, you can view the list of TZ database timezones on Wikipedia.
Using a proxy server
If you are on an enterprise network that requires the use of a proxy server, it is now time to enter the address of that proxy server. If you don't use a proxy server, simply press Enter and continue the installation.
Network Time Protocol
The Network Time Protocol (NTP) is a protocol that helps keep your computer's time in sync with Internet time.
Alpine asks you what NTP service you would like to use. Unless you know what you are doing and want to use another service, simply press Enter. If you want to not use NTP, enter
Installing package mirrors
A mirror is the server that is used to download packages that will be installed on the system. By default, Alpine comes with no mirror installed, which greatly limits the amount of packages you can install; so the installer helps us get a mirror installed.
The way I recommend to setup a mirror is to enter
f, which will pick the fastest mirror near you. It takes a while because it have to test the speed of all known mirrors, but you will end up with a perfect config file with the fastest mirror near you.
Once it is done, it will automatically add the fastest mirror to your config and lets you continue the setup:
You can also use any of these 3 other options:
- If you want to use a random mirror, enter
- If you wish to not setup mirrors (not recommended, we assume you will setup mirrors later), simply enter
- If you have a specific mirror you want to use, enter its number if it's in the list, or its URL if it's not in the list
Configuring the SSH server (remote login)
If you wish to access your computer's command line remotely, you might want to install an SSH server.
When Alpine asks you which SSH server you want to use:
opensshif you want to enable remote login;
noneif you don't want
This choice is not permanent, you can always install or uninstall the SSH server after installing the system.
Installing the base system
Regular installation (Ext4)
Selecting the target disk
Alpine will now show you the list of all disks that are attached to the system. Enter the name of the disk you want to use as a system disk (you can setup additional partitions after installing).
Selecting the contents type
Now, you are asked what is this disk supposed to contain. By default, I recommend setting
- if you want to setup encryption, enter
crypt, configure encryption, then enter
- if you want to setup the logical volume manager, enter
lvm, configure logical volumes, then enter
Confirm that you want to erase the disks, and continue the installation.
Advanced installation (Btrfs)
Alpine will now show you the list of all disks that are attached to the system. Press Ctrl+C to quit out of the installer.
First, mount the Btrfs partition using
mount -t btrfs /dev/sda1 /mnt (replace /dev/sda1 with the name of the partition).
Additional steps if you use a UEFI system
Now, mount your EFI system partition to /mnt/boot/efi:
mkdir -p /mnt/boot/efi
mount -t vfat /dev/sda2 /mnt/boot/efi(replace /dev/sda2 with the name of the EFI system partition)
UEFI system users: If you don't have a EFI system partition, follow these steps
apk add cfdisk
- Select your Btrfs partition, hit "Resize". Shrink it by around 500MB
- Go down to the "Free space", hit "New", and Enter. Then hit "Type" and select "EFI system".
- Go to "Write", type "yes", and "Enter"
- Hit "Quit"
mkfs.vfat /dev/sda2(replace /dev/sda2 with the name of the partition you created)
Install some required utilities with
apk add efibootmgr grub grub-bios grub-efi then run
setup-disk -m sys /mnt, which will install the entire system.
Installing the bootloader
The bootloader is already installed and working. You can now remove the installation media from the computer, and enter
reboot to boot into the newly installed system.
By default, Alpine Linux wants to use the extlinux bootloader, but I recommend GRUB as it is simpler to use, configure and maintain.
First, remove all the other bootloaders using
apk del syslinux; and install GRUB on the live system using
apk add grub grub-bios.
You also need to install GRUB on the installed system, using these commands:
apk add grub grub-bios
exitto go out of the chroot environment
Then, finish installing GRUB using
grub-install --root-directory=/mnt /dev/sda (replace /dev/sda with the name of your disk), and these commands to generate a configuration:
mount --bind /dev /mnt/dev
mount --bind /proc /mnt/proc
grub-mkconfig -o /boot/grub/grub.cfg
exitto go out of the chroot environment
You're done installing the bootloader. You can now remove the installation media from the computer, and enter
reboot to boot into the newly installed system.
Now that you have installed Alpine and that you booted from the disk, there are a number of things you need to do.
(Optional) Make it a rolling release distro
If you want to get software updates as they release, you can use Alpine Linux Edge to transform this install into a rolling release install.
To do this, edit /etc/apk/repositories (
vi /etc/apk/repositories), comment all the lines, and uncomment the lines that contains
Save the file (
apk update to fetch the repositories, and
apk upgrade to update your system. Finally, run
reboot to make sure you run the latest kernel.
Enable the Community repository
The Community repository contains additional packages that are not included in the base distro. If you followed the Make it a rolling release distro section, you don't need to enable the Community repository as it should already be enabled.
To enable the Community repository, edit /etc/apk/repositories (
vi /etc/apk/repositories) and uncomment the first line that ends in
community. Save the file (
:wq) and run
With doas, a user can gain administrator privileges without using the root password. Installing doas is recommended but not necessarily required.
apk add doas, then edit /etc/doas.d/doas.conf (
vi /etc/doas.d/doas.conf), add
permit persist :wheel as the last line of the file.
Create a user account
Most desktop apps (including the desktop itself) won't start if you try to run them as root. This means you need to create a user account on this system.
adduser <user> (replace <user> with the name you want), and run
adduser <user> wheel to make this user administrator.
exit, and log in as the user you just created. Run
doas whoami to make sure doas is configured properly. Now, disable the root account by running
doas passwd -l root (you can enable it again with
doas passwd -u root).
Installing KDE Plasma
Now that we have a working system, we need to install a desktop environment. Run
doas apk add plasma elogind polkit-elogind dbus which will install all the required packages, and complete installing Xorg with
Now enable the required services by running these commands:
doas rc-update add dbus
doas rc-update add elogind
doas rc-update add polkit(may not exist)
doas rc-update add udev
doas rc-update add sddm
Then, reboot the system (
doas reboot), and you should be greeted with SDDM. If that's not the case, make sure you have the proper video drivers installed.
Installing GUI apps
Now, it's great, we have a working KDE Plasma desktop, but it's missing a lot of apps (we don't even have a terminal). We can easily solve that:
- log out from KDE Plasma
- press Ctrl+Alt+F2 to access the console
- login from here
doas apk add oxygen-sounds kde-applications-base
You'll obviously also want a browser. KDE recommends using Falkon, but you can also install any browser you want.
Once you're done installing apps from the console, press Ctrl+D to log out, and then Ctrl+Alt+F7 to go back to the GUI.
Configure the keyboard
Earlier during the installation process, the keyboard was configured. Now that Xorg (or Wayland, depending on the session type you select) is running, your keyboard may be set back to QWERTY.
To fix that, head into Plasma's System Settings, Input Devices, then Keyboard, Layouts, and check Configure layouts. Add your prefered keyboard layout, and hit Apply.
To make sure it applies also to the login screen, edit /usr/share/sddm/scripts/Xsetup (
kate /usr/share/sddm/scripts/Xsetup) to add
setxkbmap "fr" (replace fr with your prefered X11 keyboard map)
Set a user nick name
Earlier when we created our user, we didn't specify a name for it. The default name is "Linux User", so we want to change that.
Click on Plasma's Application Launcher, and click on the profile picture. This opens the System Settings, where you can set a proper username (and profile picture if you want).
Once you are done with this, you need one final reboot. You can now enjoy KDE Plasma on a lightweight system (less than 3 GiB of disk space used on a full install, less than 300 MiB of RAM used at boot) that is Alpine Linux.
Next time, I will try running GNOME on Alpine Linux, so stay tuned.