Ready for a lightweight and customizable Linux experience? Dive into our guide on installing Alpine Linux and setting up a desktop environment.
You’re in the right place if you’re seeking a lightweight and customizable Linux experience. Alpine Linux, known for its minimalistic design and enhanced security, offers a refreshing alternative to traditional distributions.
Moreover, Alpine is a systemd-free operating system, which means it does not use the systemd system as its default init system. Instead, it relies on OpenRC – an init system and service manager- providing a simple and modular initialization process while efficiently managing system services.
Although the distribution’s biggest strength is on the server side, especially in containerization, more experienced Linux users will find in Alpine the flexibility, simplicity, and speed that they have been looking for in their desktop system.
So, are you ready? Let’s dive in and unleash the power of Alpine Linux!
Before we go into how to install Alpine and add a desktop environment to it, let’s take a quick look at the main benefits of using Alpine.
Lightweight and minimalistic: Alpine Linux is designed to be lightweight, making it ideal for resource-constrained systems. It consumes minimal disk space and has low memory requirements, resulting in improved performance.
Enhanced security: With a strong emphasis on security practices, Alpine employs advanced measures such as stack protection, hardened kernel, and Address Space Layout Randomization (ASLR). Its minimal package set reduces the attack surface and ensures a more secure desktop environment.
Customizable: The distro offers flexibility and customization options, allowing you to tailor your desktop environment to suit your preferences. You can choose from various lightweight window managers, desktop environments, and software packages.
Powerful package manager: Alpine utilizes an efficient and reliable package manager called APK (Alpine Package Keeper). It provides a vast repository of packages, making installing and updating software on your system easy.
Container-friendly: Alpine Linux is widely used in containerized environments due to its small size, fast boot time, and reduced attack surface. It is an excellent choice for running Docker containers, enabling efficient resource utilization.
Active community and support: Alpine Linux is widely used in containerized environments due to its small size, fast boot time, and reduced attack surface. As a result, it is an excellent choice for running Docker containers, enabling efficient resource utilization.
The first step in Alpine Linux installation is, of course, to download the installation ISO image. Visit the download page at https://alpinelinux.org/downloads/ and click the “x86_64” button in the “STANDARD” section.
Wait for the download to complete. This should be done quickly, as the Alpine installation image is relatively small (under 200 MB).
The next step is to prepare a live Alpine installation USB by writing the ISO you downloaded to it. There are many ways to do this, but one of the easiest is using the dd command.
Of course, if you choose to perform the Alpine installation in a virtual machine using software like VirtualBox or similar, you can skip this step and directly load the Alpine ISO there.
Because Alpine is a very light and minimalist Linux distribution (considering that we will add a desktop environment), installing it on a virtual machine with 2 GB of memory and 10 GB of disk space would be sufficient.
Once you have booted into the Alpine ISO, you will be presented with the screen as one shown below.
This is the time to clarify that Alpine Linux installation, like Arch or Slackware, is entirely terminal-based. However, this should not bother you because the actions are simple and detailed below.
Log in as “root.” The system will not prompt you for a password; you will be taken directly to the shell. Type “setup-alpine” and press “Enter” to begin the Alpine installation.
setup-alpine
The first step is to set up your keyboard layout. The various keymaps are available, so we will use the “us” that meets our needs. Of course, if you use another one, look for it in the list and enter the correct one.
Then select the keyboard variant. Here again, we choose just “us.”
Next, you need to set the hostname. We choose to use “alpine,” but you can type in another, then confirm by pressing the “Enter” key.
It’s time to set up the network connection. Alpine Linux will try to detect your network interfaces automatically. It’s the “eth0 ” (in our case), so we confirm the selection by pressing “Enter.”
However, if your network interface is not identified automatically, you can type “?” for more information.
In the next step, you can manually set the IP address of your network interface. However, since we have DHCP, the default option for configuring it, we hit “Enter” once more to accept that option.
We answer “n” to the next question since we don’t want to make extra manual network interface configurations.
You should now have a properly configured network interface, so it’s time to move on to the next step.
Set the password for the root user by entering it twice. Don’t worry that there is no regular user account set to use on your Alpine desktop system. We’ll add it a little later.
Next, let’s configure the timezone. In our case, we will use “America/New_York.” To see your exact syntax, type “?” and you’ll be presented with a list of all available ones.
Accept the default “none” value to opt out of proxy configuration.
Choose the primary mirror that will serve as the software source for your Alpine system. Option 1 is our default, but if you prefer another, please provide its number.
Enter the required information, such as username and full name, and set a password for the account that will operate your Alpine Linux desktop system.
Additionally, you can enter the SSH key for the newly created user account. Since we don’t have one, we choose the default value “none.”
Alpine offers two primary secure shell daemons – OpenSSH and Dropbear. The latter is simpler but has its key format, so we stick with the widely used OpenSSH. Hit “Enter” to accept the default value.
Select the disk that will be used for your Alpine installation. In our case, this is “vda.”
You will be given to choose between several options on how the installation will be performed. Let’s take a look at them.
Since we are installing a desktop system, we select the “sys” mode and confirm by hitting “Enter.”
The installer will warn you that all information on the disk will be erased. Type “y” and hit “Enter.”
The installation will take up to a minute. Once complete, reboot the system.
Your newly installed Alpine system will load. Log in as user “root” and use the password you set during installation.
We will perform simple actions to make our newly installed Alpine system more user-friendly and software-rich.
Edit the “/etc/apk/repositories” file and remove the comment (#) before the community repository line to enable it. Then, save the file and exit.
vi /etc/apk/repositories
It contains software made by users in teams with Alpine’s developers and is well-near integrated with the Alpine packages.
Next, we’ll install a Bash shell (which isn’t installed by default) and the “sudo” command. Finally, we’ll add our user to the “wheel” group so that we can execute commands with root privileges and set his default shell to Bash.
apk add bash bash-completion sudo shadow echo '%wheel ALL=(ALL) ALL' > /etc/sudoers.d/wheel adduser linuxiac wheel usermod -s /bin/bash linuxiac
Code language: JavaScript (javascript)
Finally, reboot the system.
Here’s where APK, Alpine Linux’s trusty package manager, steps into the spotlight. If it’s new to you, we highly recommend getting acquainted with it before diving into the commands below.
Don’t worry; we’ve made this easy for you with our comprehensive and user-friendly guide, “Alpine User’s Guide to APK: How to Manage Packages.” It’s a great starting point for your journey with the apk command. Now, back to the topic.
Once the base Alpine system is installed, we can move on to the next step – installing the desktop environment. We’ll show you how to install three of the most popular ones, KDE Plasma, GNOME, and Xfce, so you can choose the one you prefer.
But first, however, we need to prepare the system for the desktop environment.
Alpine Linux provides users with the “setup-xorg-base” command. This standalone script automatically configures a graphical environment, installing basic Xorg packages and udev, and is also required for Wayland sessions. Type the following command:
setup-xorg-base
All the packages needed to run the desktop environment will be automatically installed.
KDE Plasma is a desktop environment that provides a user-friendly and customizable interface for Linux-based operating systems. It is known for its modern and visually appealing design, flexibility, and extensive customizability.
Enter the following command to install the Plasma desktop on your Alpine Linux system.
apk add plasma elogind polkit-elogind
This will install the Plasma desktop, as specified by the “plasma” meta package, the SDDM display manager, and other goodies.
Please remember that this will only install the base Plasma desktop environment.
Suppose you want to add any of its many applications to enjoy its full power. In that case, you must install some of the Plasma metagroups packages shown below using Alpine’s APK package manager.
Or you can use the command below to install them all at once, which is the approach we will use.
apk add kde-applications
Let’s install the Firefox browser now because the Plasma desktop doesn’t have one by default.
apk add firefox
Install additional fonts to make working with the Alpine system more visually pleasing.
apk add font-terminus font-inconsolata font-dejavu font-noto font-noto-cjk font-awesome font-noto-extra font-liberation
Finally, set the SDDM display manager automatically to start on boot and reboot the system.
rc-update add sddm reboot
After the restart, you will be greeted by the SDDM login manager. Enter the username and password for the user you created earlier and enjoy the KDE Plasma desktop.
The GNOME desktop environment is easy to install on Alpine Linux. First, run the command below to get a basic GNOME installation.
setup-desktop gnome
Once all packages have been downloaded and installed, perform the following command to allow GNOME Software to manage APK packages:
rc-update add apk-polkit-server default
Code language: JavaScript (javascript)
Add some additional fonts for a more visually pleasing GNOME experience.
apk add font-terminus font-inconsolata font-dejavu font-noto font-noto-cjk font-awesome font-noto-extra font-liberation
Finally, install the Firefox web browser and reboot the system.
apk add firefox reboot
The GDM login manager will greet you. So log in and enjoy GNOME.
Xfce is lightweight, efficient, and visually appealing while using minimal system resources desktop environment, so it’s a perfect match for your Alpine system. Here’s how to install it.
First, execute the following command to install the basic Xfce desktop, LightDM login manager, and Firefox:
apk add xfce4 xfce4-terminal xfce4-screensaver lightdm-gtk-greeter dbus firefox
Next, install some additional fonts:
apk add font-terminus font-inconsolata font-dejavu font-noto font-noto-cjk font-awesome font-noto-extra font-liberation
Enabled LightDM and D-Bus services to start up on boot automatically:
rc-update add dbus rc-update add lightdm
And finally, reboot the system:
reboot
The LightDM login manager will greet you, and after logging in, you will experience one of the fastest-running systems you have ever encountered.
Xfce desktop environment running on Alpine Linux." width="1024" height="641" />
APK (Alpine Package Keeper) is Alpine’s package manager, allowing users to search, install, remove, and update software on Alpine-based systems.
Below is a quick guide on how to use it, which, as you’ll see, is very easy. Moreover, if you have previous experience with other package managers such as APT, DNF, or Pacman, you’ll immediately feel at home with APK.
Search for Packages
apk search package_name>
Code language: HTML, XML (xml)
Install Packages
apk install package_name1 package_name2 . >
Code language: HTML, XML (xml)
Remove Packages
apk del package_name1 package_name2 . >
Code language: HTML, XML (xml)
Update/Upgrade System
apk update apk upgrade
Cleaning Cache
apk cache clean
Installing Alpine Linux and setting up a desktop environment is a straightforward process that provides a lightweight and secure operating system for various purposes.
Following the steps outlined in this guide, users can enjoy the benefits of Alpine Linux’s minimalistic design and efficient resource utilization. In addition, the distro offers a reliable and secure foundation, whether for a lightweight server, a desktop, or a development environment.
To learn more about Alpine, check out the official documentation or visit the project’s website.
So, what do you think of Alpine? Feel free to express your opinion or ask questions in the comments below.