💾 Archived View for the.teabag.ninja › snac-installation.gmi captured on 2024-09-29 at 00:25:25. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

snac installation

2024-08-07 teabag.ninja

Before starting, I suggest having a read over the [Documentation [1] as well as the readme in the git repo [2].

[1] Online Documentation

[2] Snac2 on codeberg

This guide is partly for myself, but thought I could share what I do to get snac up and running on a Debian VPS.

Installation

Make sure your instance is updated, then run the following as root:

apt install libssl-dev libcurl4-openssl-dev curl gcc make nginx certbot python3-certbot-nginx git

and then

git clone https://codeberg.org/grunfink/snac2.git

change in the snac2 directory which is under root home dir, and compile and install:

cd snac2
make
make install

Setting up the actual instance

Now that the snac software is installed, you need to set up and configure your instance. The [Administrator Manual](https://comam.es/snac-doc/snac.8.html) will help here.

The Example there gives a good idea of what to do, but here is what I did for my instance.

Create a user to run your snac instance, so it is not running as root. Set a password; the name and details it asks for are not needed.

adduser snac2

Log in as the "snac2" user

su - snac2

and init your snac instance, then add a user for yourself on your instance

snac init /home/snac2/fedi
snac adduser /home/snac2/fedi eltheanine

Once the nginx config is done, you can then manually start the server and use the link and password supplied to log in, and change your password (or alternatively, set up the systemd service already)

snac https /home/snac2/fedi

Nginx

While still logged in as the snac user, I open another terminal and ssh into my server as root and then set up the nginx config.

example in the snac docs

To check the changes:

nginx -t

and sort any issues you created by fat fingering something (it will tell you), then run

systemctl restart nginx

To get an ssl certificate, run

certbot --nginx

and follow the instructions. It will ask for an email for notifications (for example if there is a problem self-updating and it is running out) and if you want to get the EFF newsletters. Enter details to suit. The email has saved my butt a couple of times when I changed something on my server and it wasn't updating.

Systemd Service

Your instance needs to start/restart automatically!

There is a global service but I have never used that, so will just put down what I do. If you look in your snac2 directory under root (where it pulled down from git and you moved into then `make/make install`, you sill see an examples directory. snac.service is the one we want, and it even includes how to set it up within the file itself!

First make the user directories. As your snac user, ("snac2" in my case) I run the following:

mkdir -p ~/.config/systemd/user

and then back as root, in the snac2/examples directory, editt he snac.service file with the full path of you snac installation. For example, mine is /home/snac2/fedi

Then run the following to copy the service file to that user directory we just made:

cp snac.service /home/<user>/.config/systemd/user/

Log back into your *snac user*, enable the Service, and start it.

Note, you need to log into the shell as the user; logging in from root first will result in an error `Failed to connect to bus: $DBUS_SESSION_BUS_ADDRESS and $XDG_RUNTIME_DIR not defined (consider using --machine=<user>@.host --user to connect to bus of other user)` when you attempt to run the following commands.
if you use ssh key to log on you will need to copy over to the user directory to alloow logging in. I may cover this another time but there are online guides available for this and a quick write up [here](https://the.teabag.ninja/setting-up-linode-for-akkoma.html) I did as part of Akkoma instance setup..
systemctl --user enable snac.service
systemctl --user start snac.service
If your service isn't starting, you can check errors with either `systemctl --user status snac.service` or `journalctl --user -fu snac.service`

To enable the user service to remain going when you close the user session, as root run the following:

loginctl enable-linger <user>

Give your server a reboot and check the web page to make sure it comes up.

And that is it!

The Teabag Ninja