diff --git a/docs/docs/installation/debian_based_en.md b/docs/docs/installation/debian_based_en.md index 265658fef..6bedf0384 100644 --- a/docs/docs/installation/debian_based_en.md +++ b/docs/docs/installation/debian_based_en.md @@ -23,23 +23,7 @@ sudo apt full-upgrade sudo apt install git build-essential postgresql postgresql-contrib cmake libmagic-dev ``` -### Install Elixir and Erlang - -* Install Elixir and Erlang (you might need to use backports or [asdf](https://github.com/asdf-vm/asdf) on old systems): - -```shell -sudo apt update -sudo apt install elixir erlang-dev erlang-nox -``` - - -### Optional packages: [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md) - -```shell -sudo apt install imagemagick ffmpeg libimage-exiftool-perl -``` - -### Install AkkomaBE +### Create the akkoma user * Add a new system user for the Akkoma service: @@ -49,7 +33,67 @@ sudo useradd -r -s /bin/false -m -d /var/lib/akkoma -U akkoma **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. -* Git clone the AkkomaBE repository from stable-branch and make the Akkoma user the owner of the directory: +### Install Elixir and Erlang + +If your distribution packages a recent enough version of Elixir, you can install it directly from the distro repositories and skip to the next section of the guide: + +```shell +sudo apt install elixir erlang-dev erlang-nox +``` + +Otherwise use [asdf](https://github.com/asdf-vm/asdf) to install the latest versions of Elixir and Erlang. + +First, install some dependencies needed to build Elixir and Erlang: +```shell +sudo apt install curl unzip build-essential autoconf m4 libncurses5-dev libssh-dev unixodbc-dev xsltproc libxml2-utils libncurses-dev +``` + +Then login to the `akkoma` user and install asdf: +```shell +git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3 +``` + +Add the following lines to `~/.bashrc`: +```shell +. "$HOME/.asdf/asdf.sh" +# asdf completions +. "$HOME/.asdf/completions/asdf.bash" +``` + +Restart the shell: +```shell +exec $SHELL +``` + +Next install Erlang: +```shell +asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git +export KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac" +asdf install erlang 25.3.2.1 +asdf global erlang 25.3.2.1 +``` + +Now install Elixir: +```shell +asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git +asdf install elixir 1.14.5-otp-25 +asdf global elixir 1.14.5-otp-25 +``` + +Confirm that Elixir is installed correctly by checking the version: +```shell +elixir --version +``` + +### Optional packages: [`docs/installation/optional/media_graphics_packages.md`](../installation/optional/media_graphics_packages.md) + +```shell +sudo apt install imagemagick ffmpeg libimage-exiftool-perl +``` + +### Install AkkomaBE + +* Log into the `akkoma` user and clone the AkkomaBE repository from the stable branch and make the Akkoma user the owner of the directory: ```shell sudo mkdir -p /opt/akkoma diff --git a/installation/akkoma.service b/installation/akkoma.service index 012e9185e..2c381ad0d 100644 --- a/installation/akkoma.service +++ b/installation/akkoma.service @@ -8,6 +8,8 @@ Restart=on-failure ; Uncomment this if you're on Arch Linux ; Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl" +; Uncomment if using asdf to manage Elixir and Erlang +; Environment="PATH=/var/lib/akkoma/.asdf/shims:/var/lib/akkoma/.asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" ; Name of the user that runs the Akkoma service. User=akkoma @@ -24,6 +26,8 @@ Environment="HOME=/var/lib/akkoma" WorkingDirectory=/opt/akkoma ; Path to the Mix binary. ExecStart=/usr/bin/mix phx.server +; If using asdf comment the above line and uncomment the one below instead +; ExecStart=/var/lib/akkoma/.asdf/shims/mix phx.server ; Some security directives. ; Use private /tmp and /var/tmp folders inside a new file system namespace, which are discarded after the process stops.