How to Install Pleroma on Arch Linux

Pleroma is a free, lightweight, and federated social networking server that is built using Elixir. It is an excellent alternative to Mastodon, which is also a social networking server, but with fewer system requirements. In this tutorial, we will show you how to install the Pleroma social networking server on Arch Linux.

Prerequisites

Before we start, you need to have the following prerequisites:

Step 1: Update the System

The first step is to update the system to the latest version. You can do this by running the following command in the terminal:

sudo pacman -Syyu

This command will update the system, as well as all the installed packages.

Step 2: Install Dependencies

Next, we need to install some dependencies, including Elixir, PostgreSQL, and Nginx, which are required to install and run Pleroma. Run the following command to install them:

sudo pacman -S elixir postgresql nginx

Step 3: Configure PostgreSQL

Once PostgreSQL is installed, we need to create a new database user and a new database for Pleroma. Run the following commands in the terminal to create a new user and a new database:

sudo -u postgres createuser pleroma --pwprompt
sudo -u postgres createdb -O pleroma pleroma_production

Step 4: Install Pleroma

Now that all the required dependencies are installed, we can proceed to install Pleroma. To do this, first, we need to clone the Pleroma Git repository. Run the following command to do this:

git clone https://git.pleroma.social/pleroma/pleroma.git

Once the repository is cloned, we need to install the Pleroma dependencies. Navigate to the Pleroma directory and run the following command:

cd pleroma
mix deps.get

Next, we need to configure Pleroma. Copy the sample configuration file to the production configuration file using the following command:

cp config/production.exs.sample config/production.exs

Now open the production configuration file and edit it to match your configuration. Make sure to update the database settings with the username and password that you created earlier. You can use any text editor to edit the file, for example:

nano config/production.exs

Finally, we can compile and build Pleroma using the following command:

MIX_ENV=prod mix pleroma.instance gen --output=config/generated_config.exs
MIX_ENV=prod mix compile
MIX_ENV=prod mix phx.digest

Step 5: Configure Nginx

Now that Pleroma is installed, we need to configure Nginx to serve the Pleroma website. Create a new server block in the Nginx configuration file using your preferred text editor. For example, run the following command to open the Nginx configuration file:

sudo nano /etc/nginx/nginx.conf

Inside the http block, add a new server block for Pleroma:

server {
  listen YOUR_IP_ADDRESS:80;
  server_name YOUR_DOMAIN_NAME;
  root /path/to/pleroma/priv/static/;
  error_page 404 /404.html;
  error_page 500 502 503 504 /50x.html;
  location = /50x.html {
    root html;
  }
  location / {
    try_files $uri @proxy;
  }
  location @proxy {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://localhost:4000;
  }
}

Make sure to replace YOUR_IP_ADDRESS and YOUR_DOMAIN_NAME with your server's IP address and domain name, respectively. Also, replace /path/to/pleroma/ with the actual path to the Pleroma installation directory.

Finally, save and close the file and restart Nginx using the following command:

sudo systemctl restart nginx

Step 6: Start Pleroma

Now we can start Pleroma using the following command:

MIX_ENV=prod mix phx.server

This will start the Pleroma server in production mode.

Step 7: Access Pleroma

Pleroma should now be accessible from your web browser using the URL http://YOUR_DOMAIN_NAME.

Conclusion

In this tutorial, we have shown you how to install Pleroma, a lightweight and federated social networking server, on Arch Linux. Following these steps should give you a fully functional Pleroma installation that you can customize to your liking.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!