-This guide is a step-by-step installation guide for Alpine Linux. The instructions were verified against Alpine v3.10 standard image. You might miss additional dependencies if you use `netboot` instead.
+This guide is a step-by-step installation guide for Alpine Linux. The instructions were verified against Alpine v3.16 standard image. You might miss additional dependencies if you use `netboot` instead.
-It assumes that you have administrative rights, either as root or a user with [sudo permissions](https://www.linode.com/docs/tools-reference/custom-kernels-distros/install-alpine-linux-on-your-linode/#configuration). If you want to run this guide with root, ignore the `sudo` at the beginning of the lines, unless it calls a user like `sudo -Hu akkoma`; in this case, use `su -l <username> -s $SHELL -c 'command'` instead.
+As of Alpine Linux v3.16, `doas` is the preferred way of running privileged commands, which is what this guide will use.
+If you are running an earlier version, replace `doas` with `sudo` (and use `sudo -Hu akkoma` instead of `doas -u akkoma`).
+If you want to run this guide with root, ignore the `doas` at the beginning of the lines, unless it calls a user like `doas -u akkoma`; in this case, use `su -l <username> -s $SHELL -c 'command'` instead.
-* The community repository must be enabled in `/etc/apk/repositories`. Depending on which version and mirror you use this looks like `http://alpine.42.fr/v3.10/community`. If you autogenerated the mirror during installation:
+* The community repository must be enabled in `/etc/apk/repositories`. Depending on which version and mirror you use this looks like `https://dl-5.alpinelinux.org/alpine/v3.16/community`. If you autogenerated the mirror during installation:
```shell
awk 'NR==2' /etc/apk/repositories | sed 's/main/community/' | tee -a /etc/apk/repositories
* Install `erlang-eldap` if you want to enable ldap authenticator
```shell
-sudo apk add erlang-eldap
+doas apk add erlang-eldap
```
### Install PostgreSQL
* Install Postgresql server:
```shell
-sudo apk add postgresql postgresql-contrib
+doas apk add postgresql postgresql-contrib
```
* Initialize database:
```shell
-sudo /etc/init.d/postgresql start
+doas rc-service postgresql start
```
* Enable and start postgresql server:
```shell
-sudo rc-update add postgresql
+doas rc-update add postgresql
```
### Install media / graphics packages (optional, see [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md))
-**Note**: To execute a single command as the Akkoma system user, use `sudo -Hu akkoma command`. You can also switch to a shell by using `sudo -Hu akkoma $SHELL`. If you don’t have and want `sudo` on your system, you can use `su` as root user (UID 0) for a single command by using `su -l akkoma -s $SHELL -c 'command'` and `su -l akkoma -s $SHELL` for starting a shell.
+**Note**: To execute a single command as the Akkoma system user, use `doas -u akkoma command`. You can also switch to a shell by using `doas -su akkoma`. If you don’t have and want `doas` on your system, you can use `su` as root user (UID 0) for a single command by using `su -l akkoma -s $SHELL -c 'command'` and `su -l akkoma -s $SHELL` for starting a shell.
* Git clone the AkkomaBE repository and make the Akkoma user the owner of the directory:
* Answer with `yes` if it asks you to install `rebar3`.
* This may take some time, because parts of akkoma get compiled first.
* After that it will ask you a few questions about your instance and generates a configuration file in `config/generated_config.exs`.
* Check the configuration and if all looks right, rename it, so Akkoma will load it (`prod.secret.exs` for productive instance, `dev.secret.exs` for development instances):
* The previous command creates also the file `config/setup_db.psql`, with which you can create the database:
```shell
-sudo -Hu postgres psql -f config/setup_db.psql
+doas -u postgres psql -f config/setup_db.psql
```
* Now run the database migration:
```shell
-sudo -Hu akkoma MIX_ENV=prod mix ecto.migrate
+doas -u akkoma env MIX_ENV=prod mix ecto.migrate
```
* Now you can start Akkoma already
```shell
-sudo -Hu akkoma MIX_ENV=prod mix phx.server
+doas -u akkoma env MIX_ENV=prod mix phx.server
```
### Finalize installation
If you want to open your newly installed instance to the world, you should run nginx or some other webserver/proxy in front of Akkoma and you should consider to create an OpenRC service file for Akkoma.
#### Nginx
* Install nginx, if not already done:
```shell
-sudo apk add nginx
+doas apk add nginx
```
* Setup your SSL cert, using your method of choice or certbot. If using certbot, first install it:
If that doesn’t work, make sure, that nginx is not already running. If it still doesn’t work, try setting up nginx first (change ssl “on” to “off” and try again).
* Copy the example nginx configuration to the nginx folder
* Before starting nginx edit the configuration and change it to your needs. You must change change `server_name` and the paths to the certificates. You can use `nano` (install with `apk add nano` if missing).