From d956dc2f0961042a3834ee7e52f4cebecacb59dd Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Tue, 30 May 2023 21:17:26 -0400 Subject: [PATCH 1/6] Add asdf install guide for debian/ubuntu Closes #557 --- docs/docs/installation/debian_based_en.md | 74 +++++++++++++++++------ installation/akkoma.service | 4 ++ 2 files changed, 60 insertions(+), 18 deletions(-) diff --git a/docs/docs/installation/debian_based_en.md b/docs/docs/installation/debian_based_en.md index 265658fef..cb10bb66e 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,61 @@ 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 Elixir 1.14+, 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 libwxgtk3.0-gtk3-dev libwxgtk-webview3.0-gtk3-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils libncurses-dev openjdk-11-jdk +``` + +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" +``` + +Next install Erlang: +```shell +asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git +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 elxir 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. From 48a0145736d6e42589098e2d1840b587cabdf702 Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Tue, 30 May 2023 21:21:44 -0400 Subject: [PATCH 2/6] add command to restart shell --- docs/docs/installation/debian_based_en.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/docs/installation/debian_based_en.md b/docs/docs/installation/debian_based_en.md index cb10bb66e..0a48a605d 100644 --- a/docs/docs/installation/debian_based_en.md +++ b/docs/docs/installation/debian_based_en.md @@ -60,6 +60,11 @@ Add the following lines to `~/.bashrc`: . "$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 From f68b047bf7bc872f29b3a189554edcee7bcf6325 Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Wed, 31 May 2023 08:46:05 -0400 Subject: [PATCH 3/6] remove java and gui dependencies --- docs/docs/installation/debian_based_en.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/docs/installation/debian_based_en.md b/docs/docs/installation/debian_based_en.md index 0a48a605d..b87e89a46 100644 --- a/docs/docs/installation/debian_based_en.md +++ b/docs/docs/installation/debian_based_en.md @@ -45,7 +45,7 @@ Otherwise use [asdf](https://github.com/asdf-vm/asdf) to install the latest vers First, install some dependencies needed to build Elixir and Erlang: ```shell -sudo apt install curl unzip build-essential autoconf m4 libncurses5-dev libwxgtk3.0-gtk3-dev libwxgtk-webview3.0-gtk3-dev libgl1-mesa-dev libglu1-mesa-dev libpng-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils libncurses-dev openjdk-11-jdk +sudo apt install curl unzip build-essential autoconf m4 libncurses5-dev libssh-dev unixodbc-dev xsltproc fop libxml2-utils libncurses-dev ``` Then login to the `akkoma` user and install asdf: @@ -68,6 +68,7 @@ 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 ``` From 2482d967823ded541a4a8f1f3a949fd41299c13d Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Wed, 31 May 2023 08:59:03 -0400 Subject: [PATCH 4/6] remove one more java dep --- docs/docs/installation/debian_based_en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/installation/debian_based_en.md b/docs/docs/installation/debian_based_en.md index b87e89a46..f6f13b40c 100644 --- a/docs/docs/installation/debian_based_en.md +++ b/docs/docs/installation/debian_based_en.md @@ -45,7 +45,7 @@ Otherwise use [asdf](https://github.com/asdf-vm/asdf) to install the latest vers 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 fop libxml2-utils libncurses-dev +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: From 5ce38591e59e19ea013e07470f8eeb1d81792995 Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Wed, 31 May 2023 09:03:25 -0400 Subject: [PATCH 5/6] fix typo --- docs/docs/installation/debian_based_en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/installation/debian_based_en.md b/docs/docs/installation/debian_based_en.md index f6f13b40c..a198d4b5a 100644 --- a/docs/docs/installation/debian_based_en.md +++ b/docs/docs/installation/debian_based_en.md @@ -77,7 +77,7 @@ 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 elxir 1.14.5-otp-25 +asdf global elixir 1.14.5-otp-25 ``` Confirm that Elixir is installed correctly by checking the version: From 5e3ca133f29ffb9c0fc393e9d1e7fe938cd59b58 Mon Sep 17 00:00:00 2001 From: Francis Dinh Date: Sun, 11 Jun 2023 08:46:56 -0400 Subject: [PATCH 6/6] reword to not mention specific elixir version --- docs/docs/installation/debian_based_en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/installation/debian_based_en.md b/docs/docs/installation/debian_based_en.md index a198d4b5a..6bedf0384 100644 --- a/docs/docs/installation/debian_based_en.md +++ b/docs/docs/installation/debian_based_en.md @@ -35,7 +35,7 @@ sudo useradd -r -s /bin/false -m -d /var/lib/akkoma -U akkoma ### Install Elixir and Erlang -If your distribution packages Elixir 1.14+, you can install it directly from the distro repositories and skip to the next section of the guide: +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