Hopefully by now you won’t have to be sold on the invasive practices that social media companies conduct. Websites such as Facebook and Twitter aquire so much data on users that they often know more about you than you know about yourself. The simple solution to this is to not use social media. However, that just isn’t an option for most people. So the next best thing is to setup a self-hosted and federalised social media site so that you have full control over your data. The contributor previously made a video showing all the steps in depth if you want to check it out. If you run into any issues, it is recommended to look at the video.
You’ll need a server or VPS. You’ll also need a domain name pointing to your server’s IP address which is explained in this tutorial.
First things first you’ll need to make sure that you’ve hardened you SSH so that password authentication is disabled. There’s a great tutorial on how to do this which can be read here.
You can manually configure PostgreSQL to suit your system better. Check out the documentation here and then run the below command:
systemctl restart postgresql
Pleroma is not in the Debian app repositories, so we will install it manually. First create the Pleroma user by running the below command:
useradd -m -s /bin/bash -d /opt/pleroma pleroma
Then, still as root, we will create the required directories and give the Pleroma user ownership of them.
mkdir -p /var/lib/pleroma/uploads
chown -R pleroma /var/lib/pleroma
mkdir -p /var/lib/pleroma/static
chown -R pleroma /var/lib/pleroma
mkdir -p /etc/pleroma
chown -R pleroma /etc/pleroma
su -l pleroma to login as the Pleroma user. Now use the
command below to download the Pleroma software and unzip it.
curl 'https://git.pleroma.social/api/v4/projects/2/jobs/artifacts/stable/download?job=amd64' -o /tmp/pleroma.zip
unzip /tmp/pleroma.zip -d /tmp/
Note that we are downloading the amd64 version here. If you know you have a different CPU architecture, replace that with whatever your architecture is.
mv /tmp/release/* /opt/pleroma
./bin/pleroma_ctl instance gen --output /etc/pleroma/config.exs --output-psql /tmp/setup_db.psql
We need to briefly return to the root user so we can run the following
command (via the postgres user) to set up the database. Type ctrl-d or
exit to return to the root user, then run:
su postgres -s $SHELL -lc "psql -f /tmp/setup_db.psql"
Then return to the pleroma user with
su -l pleroma and we will test to
see that Pleroma can run:
That will initialize Pleroma. It might take as long as a minute to get started, so wait a bit, then run the following:
If everything is working, this command will give you a long line of messy output. If it is not, you will get a connection error message. Once it is working successfully, stop the Pleroma daemon and we will interface Pleroma with the web server.
Return again to the root user. Let’s copy Pleroma’s Nginx configuration file from the template given in the installation and enable it:
cp /opt/pleroma/installation/pleroma.nginx /etc/nginx/sites-available/pleroma.conf
ln -s /etc/nginx/sites-available/pleroma.conf /etc/nginx/sites-enabled/pleroma.conf
etc/nginx/sites-available/pleroma.conf file and replace
example.tld with your domain name.
We now have to get a SSL certificate to enable encryption, since we have a model configuration that already includes SSL information, just use Certbot’s certificates to get the needed certificate. Once you’ve got your cert setup, copy over the Nginx configuration with the below command:
Once everything, including your Cerbot certificate is ready, simply reload Nginx with this command:
systemctl reload nginx
Pleroma itself runs as a systemd service similar to other things running on your server like Nginx. To start the service up run the below commands:
cp /opt/pleroma/installation/pleroma.service /etc/systemd/system/pleroma.service
systemctl start pleroma
systemctl enable pleroma
If everything worked then when you go to your domain in the web browser you should see a bare-bones Pleroma instance.
You’ll be able to create new accounts on the Pleroma instance in the login section on the website but the easiest way to setup an admin account is with the CLI. Simply run the below command replaced with your username:
su -l pleroma
./bin/pleroma_ctl user new username firstname.lastname@example.org --admin
If you run into any issues then feel free to checkout the documentation or send the contributor an email or message. Details of the contributor are below.