ivanpollak.com

Alpine linux as a server

How I configured my alpine linux server.


This is a direct follow-up of the previous blog post. Because the whole setup (installing and configuring the server) would result in a really long blog post, I decided to split those two "chapters" into two different blog posts.

The services, that will be installed on my server are:

Updating the repositories

To use all the packages, that alpine linux provides, the user needs to enable them. This can be done via manually editing /etc/apk/repositories. In here, the community repository is commented out by default. However many packages are in this community repository. To change this, just remove the # in front of the url. A adjusted config could look like this:

#/media/sda/apks
http://dl-cdn.alpinelinux.org/alpine/v3.23/main
http://dl-cdn.alpinelinux.org/alpine/v3.23/community
http://alpine.ethz.ch/alpine/v3.23/main
http://alpine.ethz.ch/alpine/v3.23/community

If everything worked correctly, btop for example, now should be installable.

Installing NetBird

NetBird is an european alternative to tailscale. Because I like sovereignty, I prefer local companies, thus NetBird will be used on my server.

Because NetBird doesn't have a package (or rather doesnt have one that works), I had to install curl and then paste some command that they provide on their website. Please note, that this command might be outdated at the time of reading. Take this command (and every other curl | sh command) with a grain of salt.

# Install curl
doas apk add curl

# Install NetBird
curl -fsSL https://pkgs.netbird.io/install.sh | sh

After the installation was complete, to setup NetBird, just run:

netbird up

This will prompt the user to go to a website and confirm that the device should be added to the account. When this is confirmed, the device is now available in the mesh.

Installing miniflux

There is an official guide on the miniflux website, on how to setup the miniflux service on alpine. The following section will largely be similar to the instructions over there.

Install all the needed packages using:

doas apk add miniflux miniflux-openrc miniflux-doc postgresql postgresql-contrib

Start the database service:

# Launch database on startup
doas rc-update add postgresql

# Launch the database now
doas rc-service postgresql start

Setup the database:

# Switch to the postgres user
doas -su postgres

# Create the database for miniflux
createdb miniflux2

# Exit out of postgres user shell
exit

To now configure miniflux, open the /etc/miniflux.conf file. In here, we need to define the environment variables, because the miniflux service is superviced by supervise-daemon by OpenRC (instead of systemd).

To achieve the required configuration, insert the configuration below into /etc/miniflux.conf:

LOG_DATE_TIME=yes
LISTEN_ADDR=127.0.0.1:8080
DATABASE_URL=user=postgres password=secret dbname=miniflux2 sslmode=disable

# Run SQL migrations automatically:
RUN_MIGRATIONS=1

To now finalize the configuration, run:

# Create database tables, etc
doas miniflux -c /etc/miniflux.conf -migrate

# Create admin user
doas miniflux -c /etc/miniflux.conf -create-admin

Lastly, start the miniflux service using:

doas service miniflux start

by ivanpollak