Baseline Alpine Setup For Reasonable GUI with dwm
Tested as of Alpine 3.22 on x86_64 using the Extended installation image. Once the noted stumbling blocks are attended to this excersise takes about 90 minutes to complete, of which less than an hour demands active attention. Internet connectivity and hardware issues may extend the time this takes.
Installing Alpine
Install Alpine Linux, largely following the instructions on their wiki. Abridged
- Upon booting the USB, we can immediately login to the root account.
- From here we can immediately proceed to run the
setup-alpine
script.
The setup-alpine
script is fairly straightforward, and it presents a ready remedy to many problems. Once you know your answers, repeating the script is trivial.
- Ensure networking works, troubleshoot before commiting to an installation.
- No to installing an SSH server.
busybox
for the time server.- We create a user.
- We enter
f
to find a fast mirror for us. - When asked for an installation type, answer
?
to see the help. For a portable machine ‘syscrypt’ is a reasonable option if the processor supports AES acceleration.
Once we reboot the system into our installed Alpine Linux, we will have a complete if Spartan Linux Operating System.
Filling in the Userland
Now, we extend the operating system by installing a number of utilities that will help us to bootstrap an environment comfortable enough to daily drive.
Commands in this section should be executed as root
which can be accomplished by prexifing them with doas
, however we assume we logged in as root
for this first session after rebooting into out new installation.
We begin by installing a text editor and some fonts which will come in handy later. You may prefer a different console text editor or selection of fonts:
apk add nano
or
doas apk add nano
Now, before we grab fonts we need to enable the community repository.
nano /etc/apk/repositories
Inside of our /etc/apk/repositories
file we uncomment the line for the community repository be deleting the #
character in front of the line containing the community repository url.
To exit nano press ctrl
+x
then y
to save your change.
Now run apk upgrade
to update your repository index, we can also upgrade
:
apk update && apk upgrade
If the community repository is enabled this command to install some fonts will succeed:
apk add font-unifont font-liberation font-noto font-iosevka-base
Having documentation is nice, so let us install the man
pages and associated tools:
apk add mandoc mandoc-apropos docs
Let us add some sound and user account control tools:
apk add alsa-utils alsaconf shadow
Install your GPU drivers using the Intel, AMD, or Nvidia instructions.
With graphics drivers installed, we can setup our X11 server by running:
setup-xorg-base
We can install some packages that will install a number of quality of life tools:
apk add coreutils util-linux findutils
Some tools that enable features that can be especially helpful on portable machines:
apk add acpi acpid xf86-input-synaptics
Might as well install some more software that I will want to have on hand once I have a GUI. Why not install it now:
apk add emacs-X11 less openssh rsync syncthing \
hugo neomutt librewolf adwaita-icon-theme
Important: For our user to be able to eventually log into a graphical environment, we Must add them to the users
group like:
addgroup aaron users
Our final step before becoming our normal user is to install the toolchain necessary to build our DIY Desktop Environment:
apk add git make gcc g++ libx11-dev libxft-dev libxinerama-dev \
ncurses libxft-dev adwaita-icon-theme xsetroot dbus-x11
And we end this session of working as root
:
exit
Bootstrapping Our User Environment
Log in as your user. You should be greeted with a prompt like ~$
which includes your current working directory, ~
which is an alias for your user’s home folder.
Let us begin by making a directory to contain our component source directories. For this demonstration, I will use dde
:
~$ mkdir dde
And go there:
~$ cd dde
Our prompt now looks like:
~/dde$
Let us grab about component sources:
~/dde$ git clone https://git.suckless.org/dwm
~/dde$ git clone https://git.suckless.org/dmenu
~/dde$ git clone https://git.suckless.org/st
Now we begin building
~/dde$ cd dwm
~/dde/dwm$ doas make install
~/dde/dwm$ cd ..
And proceed to dmenu
as our next component:
~/dde$ cd dmenu
~/dde/dmenu$ doas make install
~/dde/dmenu$ cd ..
And finish up this phase by building the st
terminal to use in our graphical environment:
~/dde$ cd st
~/dde/st$ doas make install
~/dde/st$ cd ~
That last command returns us to our home directory base ~
.
To allow a graphical session to start immediatly upon logging in as our user, we need to create two configuration files:
~$ nano .profile
For the contents of .profile
:
startx
Important: All configuration files MUST end with a newline character or they are not valid as files.
Exit nano
saving your work. The next file is .xinitrc
which on a portable maching can look like:
while true; do
xsetroot -name " Time: $(date +"%R") | $(acpi -b | awk '{print $3, $4, $5}') "
sleep 3
done &
xscreensaver -no-splash &
exec dbus-launch --exit-with-session dwm
However, the minimum viable .xinitrc looks like:
exec dwm
After saving yout .xinitrc
file, exit
your session and log back in to enjoy a rich graphical environment.
For some some inital aesthetic tweaks see: Early dwm Enhancements
For the thread that inspired capturing this process see: Some notes on the C language with a dwm tutorial