Fortunately, there are alternatives such as Pleroma which is a self-hosted Twitter. This is a lightweight federated microblogging platform. Using federation allows the platform to communicate with other federated instances which means that you do not need to gather a lot of people for your own private Twitter to start sharing information. This article aims to help you get started with Pleroma.
The Issue with Twitter
Twitter has been known to randomly ban accounts for vague policy infractions. If you are someone who have amassed years worth of posts in Twitter losing that history can be devastating. Not only that, Twitter has also been known to hand over user data to both advertisers and government agencies. This makes Twitter an unsafe platform for people who either want to have complete control over their data or journalists that are reporting on controversial topics.
What Is Federation and How Does it Work
One solution to this problem is building a social network through server federation. This is a system where you allow multiple servers running similar software to communicate with each other transparently. Because of that, any federated server can act as a node for the whole network where you can access and participate with other servers. In turn, this creates a resilient ecosystem that is able to easily adapt to any circumstance. For example, if a Pleroma server goes down it would not end the Pleroma federated network. It might reduce the amount of posts within the network but other servers will still be able to communicate with each other.
How to Install Pleroma
Pleroma requires a number of things before you can start setting it up:
First, you need to have a publicly discoverable machine. This could either be a machine in your home that you can port forward or a VPS that you purchased from a provider.Further, if you are using a VPS to install Pleroma you need to have root access to that VPS. This is because you will be installing packages that Pleroma requires for it to work properly.Lastly, you need to have a domain name. This is because certbot, the SSL certificate utility, will require a domain name to generate a certificate for your Pleroma instance.
With that in mind, this guide will be focusing on installing Pleroma on a Debian-based VPS from Digitalocean.
1. Set Up Your A and AAAA DNS Records
Before you start, it is wise to first link your domain name to the IP address of your VPS. This ensures that any command that references your domain name below would resolve properly. As such, this becomes especially useful once you set up your SSL certificates later on.
2. Obtain the Pleroma Dependencies
The next thing that you need to do is to download all of the packages that Pleroma requires. As discussed above, I am only going to highlight the installation process for Debian and Ubuntu-based Linux distributions. As such, I will be using apt to install all of the required packages. With that in mind, Pleroma depends on three major programs: postgresql, elixir and erlang. Therefore, you need to install these programs as well as a couple more which will complement those three on doing their work. To do that, you can run the following command:
3. Create the Pleroma User
With that done, the next thing that you need to do is to create the “pleroma” user account. This is the account that you will use to download and install the Pleroma package. Doing it this way ensures that the Pleroma program would not have any superuser access to your system. To do this, you can run the following command:
The -r option will set the “pleroma” user to be a system account rather than a user account.Further, the -s option will set login shell for this user to “false”. This makes sure that the pleroma user, by itself, cannot run any command from a shell.On the other hand, the -m and -d flags set the home directory for the “pleroma” user. The -m flag explicitly sets the account to have a home directory and the -d flag sets that directory to point to “/var/lib/pleroma”.Lastly, the -U flag creates a user group of the same name and adds the newly created Pleroma user to that group.
4. Download Pleroma
From there, you can now download the Pleroma package from their repositories. To do that, you have to first create the directory where the files will be downloaded to:
The first command will create the “pleroma” directory where you will download all of the files for the program.The second command, on the other hand, will transfer the ownership of that folder from root to pleroma. This will, then, allow pleroma to read and write from this folder without any issues.
Once done, the next thing to do is to download the Pleroma source code itself. To do that, you need to use git:
5. Prepare and Install Pleroma
You can now go to the /opt/pleroma directory to start the process of installing the program: From there, you need to run the Mix program to pull all the additional dependencies for Pleroma. To do that, you can run the following command: Once done, you can now proceed with compiling and installing Pleroma. In that, you only need to run one command: This command will do three things:
First, the MIX_ENV=prod option will set the environment variable of the program to target a production setup. This means that the program will not contain any development tools and files.The gen option will create a configuration file that targets the environment variable that you have provided.Lastly, this command will also compile and install Pleroma from its source code. Because of that, this process will take some time depending on the hardware that you are running it on.
6. Configure the Pleroma Install
Once Pleroma is done compiling, it will then ask for some information about your server.
7. Media-specific Configurations
8. Finalize Your Pleroma Configuration
9. Start the Pleroma Database
10. Start Your Pleroma Server
Now, it’s time to run your Pleroma server. You can do this by running the following command: However, this server is still inaccessible from the regular browser. To allow that, you need to first configure certbot and nginx.
Configuring Certbot for Pleroma
Configuring Nginx for Pleroma
11. Final Configurations
1. The pictures that I upload still has geolocation data in them. What did I do wrong?
This can be due to a number of things. However, the most common reason why this happened is because you do not have the exiftool package. For the guide above, exiftool was not a package that was installed by default. As such, to remove the geolocation for the images that you upload, you need to add that package manually. To do that, you can run the following command:
2. I can’t generate a Letsencrypt Certificate. What did I do wrong?
This can also be due to a number of things. The most common cause for this, however, is that nginx is still running. For the certbot command to work, you need to have the common web ports open and not taken by any program. To disable nginx, you can run the following command: Image credit: Pleroma