A Huge Thanks To Teabag Ninja Whose Original Akkoma Tute Got Me Started
Original OTP Akkoma Docs – Should you be interested. These have errors in code below the vertical rectangle in which that code does work. I sometimes used the code (choose Debian) if you try it.
Installing Akkoma on your host
Before starting, have a read over https://docs.akkoma.dev/stable/installation/otp_en/ to familiarize yourself with the process. This guide is mostly a copy of that, with some adjustments for clarity. Hopefully. Be sure to watch for the “exit” user when there!
OTP releases are the closest that Elixer has to a binary release.
Prepare your system
This guide assumes a Debian 11 install on Linode, but should work the same for any install of Debian 11 on amd64. It works also on Linux Ubuntu 22.04 Jammy on a server with only 2 GB.
Ssh into your server and drop to root if not already with
su - and enter the root password.
Update your server:
apt full-upgrade -y
Then install the packages we need for the installation and setup:
apt install curl unzip libncurses5 postgresql postgresql-contrib nginx certbot libmagic-dev
There are optional packages for media/processing: https://docs.akkoma.dev/stable/installation/optional/media_graphics_packages/ I installed them all as it’s not much space, and I wasn’t sure which features I would be needing down the road. The base installation doesn’t need them, but if you want to strip geolocation from images then you’d need
exiftool for example.
apt install imagemagick ffmpeg libimage-exiftool-perl
If you feel the urge to configure PosgresSQL you can do so here
I don’t bother, I run basically a single user instance, therefore I don’t have to learn. This is a basic guide to get an instance up. Don’t do crap here then complain to me that my guide screwed up your install. It didn’t: YOU DID.
Create the Akkoma user
adduser --system --shell /bin/false --home /opt/akkoma akkoma
Set the flavour environment variable to the string you got in Detecting flavour section. For example if the flavour is
amd64 the command will be (which for our Linode, it is):
Clone the release build into a temporary directory and unpack it
su akkoma -s $SHELL -lc " curl 'https://akkoma-updates.s3-website.fr-par.scw.cloud/stable/akkoma-$FLAVOUR.zip' -o /tmp/akkoma.zip unzip /tmp/akkoma.zip -d /tmp/ "
Move the release to the home directory and delete temporary files
su akkoma -s $SHELL -lc " mv /tmp/release/* /opt/akkoma rmdir /tmp/release rm /tmp/akkoma.zip "
Create uploads directory and set proper permissions (skip if planning to use a remote uploader)
Note: It does not have to be
/var/lib/akkoma/uploads, the config generator will ask about the upload directory later (I just did this though as I did not see a reason not to)
mkdir -p /var/lib/akkoma/uploads
chown -R akkoma /var/lib/akkoma
Create custom public files directory (custom emojis, frontend bundle overrides, robots.txt, etc.)
Note: It does not have to be
/var/lib/akkoma/static, the config generator will ask about the custom public files directory later
mkdir -p /var/lib/akkoma/static
chown -R akkoma /var/lib/akkoma
Create a config directory
mkdir -p /etc/akkoma
chown -R akkoma /etc/akkoma
Run the config generator
su akkoma -s $SHELL -lc "./bin/pleroma_ctl instance gen --output /etc/akkoma/config.exs --output-psql /tmp/setup_db.psql"
This will ask a bunch of questions to set up the instance, like instance name and domain name etc. Pressing enter to use the defaults where it makes sense isn’t a silly idea. 😉
Once that is done, create the postgres database
su postgres -s $SHELL -lc "psql -f /tmp/setup_db.psql"
Create the database schema
su akkoma -s $SHELL -lc "./bin/pleroma_ctl migrate"
Start the instance to verify that everything is working as expected
su akkoma -s $SHELL -lc "./bin/pleroma daemon"
Wait for about 20 seconds and query the instance endpoint, if it shows your uri, name and email correctly, you are configured correctly
sleep 20 && curl http://localhost:4000/api/v1/instance
Stop the instance
su akkoma -s $SHELL -lc "./bin/pleroma stop"
Set up Let’s Encrypt SSL Certificates and nginx config
First, stop nginx so it won’t hijack the connection
systemctl stop nginx
Then you can run the standalone certbot challenge which stands up it’s own webserver. Replace
yourinstance.tld with the domain you are using.
certbot certonly --standalone --preferred-challenges http -d yourinstance.tld
If you enabled ngingx again now you should see the default nginx landing page – but we’ll wait until we’ve edited the nginx config.
The official guide source path is incorrect for the nginx config, below has the correct one at time of writing:
cp /opt/akkoma/installation/akkoma.nginx /etc/nginx/sites-available/akkoma.conf
Then enable the config
ln -s /etc/nginx/sites-available/akkoma.conf /etc/nginx/sites-enabled/akkoma.conf
Edit the nginx config for your domain using
Press Ctrl+\ to search, type in
example.tld then press Enter, then enter your (sub)domain for your instance, and Enter again. It will prompt, pres A for all occurances of
example.tld to be replaced with your (sub)domain Ctrl+X to exit, Y to save, Enter to confirm filename (which remains the same). Clear as mud? Good.
Verify that the config is valid:
Now that certbot has run and the config has been set up for your instance, you can start nginx again
systemctl start nginx
Set up the system service for Akkoma
Copy the supplied service file into the proper directory
cp /opt/akkoma/installation/akkoma.service /etc/systemd/system/akkoma.service
Start Akkoma and enable it on boot
systemctl start akkoma
systemctl enable akkoma
Install a Front-End!
If you go to your instance in the browser now, you should see a page saying Akkoma is installed but there is no FE. As we are on a small VPS, we want a lightweight one, and PleromaFE fits the bill:
su akkoma -s $SHELL -lc "./bin/pleroma_ctl frontend install pleroma-fe --ref stable"
Unless you’re a command line wizard, you’ll probably want to install AdminFE also:
su akkoma -s $SHELL -lc "./bin/pleroma_ctl frontend install admin-fe --ref stable"
We’re not done yet… but we’re so close, keep going!
Set up auto-renew of Let’s Encrypt certificate
Create the directory for webroot challenges
mkdir -p /var/lib/letsencrypt
Uncomment the webroot method in the nginx config (read the text inside
akkoma.conf, it explains: remove the
# from in front of those lines below the description)
Then verify the config is still valid after your uncommenting that section:
If it isn’t, go work out what you did wrong and fix it 😉
Restart nginx to load with the changes
systemctl restart nginx
Do a dry run to confirm the webroot method and post hook is working
certbot renew --cert-name yourinstance.tld --webroot -w /var/lib/letsencrypt/ --dry-run --post-hook 'systemctl reload nginx'
Add it to daily cron. Make sure you replace
example.tld with the domain of your instance, or it won’t renew (don’t ask how I realised that)…
echo '#!/bin/sh certbot renew --cert-name yourinstance.tld --webroot -w /var/lib/letsencrypt/ --post-hook "systemctl reload nginx" ' > /etc/cron.daily/renew-akkoma-cert
chmod +x /etc/cron.daily/renew-akkoma-cert
If everything worked the output should contain /etc/cron.daily/renew-akkoma-cert run-parts –test /etc/cron.daily
Create your Admin User
Now we are getting to the fun stuff!
su akkoma -s $SHELL -lc "./bin/pleroma_ctl user new <nickname> <email> [option ...]"
--name <name> - the user's display name --bio <bio> - the user's bio --password <password> - the user's password --moderator/--no-moderator - whether the user should be a moderator --admin/--no-admin - whether the user should be an admin -y, --assume-yes/--no-assume-yes - whether to assume yes to all questions
So as an example:
su akkoma -s $SHELL -lc "./bin/pleroma_ctl user new joeuser firstname.lastname@example.org --admin"
This will create an account withe the username of
joeuser with the email address of
email@example.com, and set that user’s account as an admin. This will result in a link writen in the terminal that you can copy and paste into the browser, which logs you in and enables you to set the password. Once you have done that, you’re logged and it all works!
Just a last couple of things though… almost done. I promise.
Add email capability
You know, for email verification, or notices of reports etc. Now, this can probably all be added in AdminFE after the settings migration to DB… but I did it this way, so here we go.
I had an issue of this not actually working. I ended up asking some folks with more experience than me who looked at a screenshot of the email settings in ADminFE and told me to turn off STARTTLS.
And then it all just worked.
I will update this when I work out the way to make it work first time.
Paste in below the other entries:
config :pleroma, Pleroma.Emails.Mailer, enabled: true, adapter: Swoosh.Adapters.SMTP, relay: "smtp.emailprovider.com", username: "YOUR_USERNAME@emailprovider.com", password: "YOUR_SMTP_PASSWORD", port: 465, ssl: true, auth: :always
Send Test email:
su akkoma -s $SHELL -lc "./bin/pleroma_ctl email test --to firstname.lastname@example.org"
Send confirmation emails to all unconfirmed user accounts:
su akkoma -s $SHELL -lc " ./bin/pleroma_ctl email resend_confirmation_emails"
Migrate settings to DB…
…to enable changing settings in AdminFE instead of command line or files like some freakn wizard.
su akkoma -s $SHELL -lc "./bin/pleroma_ctl config migrate_to_db"
Can be done in AdminFE, but have left here as it may be useful. Perhaps. If you import follows exported from another account, you probably don’t need to add one.
Follow a relay:
su akkoma -s $SHELL -lc "./bin/pleroma_ctl relay follow <relay_url>"
Unfollow a relay:
su akkoma -s $SHELL -lc "./bin/pleroma_ctl relay unfollow <relay_url>"
List relay subscriptions:
su akkoma -s $SHELL -lc "./bin/pleroma_ctl relay list"
This is where you store themes, emoji etc, that don’t get overwritten during upgrades. as we are using the OTP version, it is:
© 2023 abcro
Powered by WP Made with ❤ by abcro