How to Install Pleroma on Debian Latest
Pleroma is a lightweight, customizable, and federated social networking server that runs on the Erlang/OTP platform. It supports ActivityPub, a decentralized social networking protocol that allows different social network servers to communicate with each other. In this tutorial, we will show you how to install Pleroma on Debian 10 (Buster).
Prerequisites
Before we begin, make sure you have the following:
- A server running Debian 10 (Buster).
- A sudo user.
- A domain name pointed to your server.
Step 1: Update the System
First, update the system packages to their latest versions with the following command:
sudo apt update && sudo apt upgrade -y
Step 2: Install Dependencies
Next, install the required dependencies for Pleroma:
sudo apt install -y build-essential curl git inotify-tools postgresql postgresql-contrib erlang erlang-tools erlang-dev elixir imagemagick ffmpeg
Step 3: Set Up PostgreSQL
Pleroma requires a PostgreSQL database to store its data. You can install PostgreSQL and create a PostgreSQL user with the following commands:
sudo apt install -y postgresql
sudo -u postgres psql -c "CREATE ROLE pleroma LOGIN PASSWORD 'password';"
sudo -u postgres createdb -O pleroma pleroma_db
Replace password with a strong password for the pleroma user.
Step 4: Clone Pleroma Repository
Clone the Pleroma repository from its GitHub page:
git clone https://git.pleroma.social/pleroma/pleroma.git
cd pleroma
Step 5: Configure Pleroma
Configure Pleroma by copying the example configuration files and editing them:
cp config/example.secret.exs config/prod.secret.exs
cp config/example.config.exs config/prod.secret.exs
nano config/prod.secret.exs
In the prod.secret.exs file, replace the following settings with your own values:
config :pleroma, :instance,
name: "example.com",
email: "[email protected]",
web_push: false,
image_proxy: false,
registrations_open: true
config :pleroma, :auth, :oauth,
client_id: "",
client_secret: "",
config :pleroma, :activitypub,
enabled: true,
inbox_queue: :furcorn,
outbox_queue: :senna,
shared_inbox: false,
deliver_activity: true
config :pleroma, :media_proxy,
enabled: false,
secret: "your-secret-here"
Save and close the file.
Step 6: Build Pleroma
Build Pleroma with the following command:
mix deps.get --only prod
MIX_ENV=prod mix compile
MIX_ENV=prod mix phx.digest
MIX_ENV=prod mix ecto.create
MIX_ENV=prod mix ecto.migrate
Step 7: Start Pleroma
Start Pleroma with the following command:
MIX_ENV=prod mix phx.server
Pleroma should now be accessible from your browser by visiting http://your-domain.com:4000.
Step 8: Set Up Nginx
To use Pleroma with a domain name and HTTPS, you need to install and configure Nginx. Install Nginx with the following command:
sudo apt install -y nginx
Create an Nginx configuration file for Pleroma:
sudo nano /etc/nginx/sites-available/your-domain.com.conf
Replace your-domain.com with your domain name and paste the following configuration block:
server {
listen 80;
listen [::]:80;
server_name your-domain.com;
location / {
proxy_pass http://127.0.0.1:4000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Save and close the file. Then, enable the site and restart Nginx:
sudo ln -s /etc/nginx/sites-available/your-domain.com.conf /etc/nginx/sites-enabled/
sudo systemctl restart nginx
Now, you should be able to access Pleroma from your domain name with HTTP.
Step 9: Configure HTTPS
To enable HTTPS, you can use Let's Encrypt, a free and open certificate authority. Install the Certbot client with the following command:
sudo apt install -y certbot
Then, obtain a certificate with the following command:
sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email [email protected] -d your-domain.com
This command will install the certificate and configure Nginx to use HTTPS.
Step 10: Set Up a Systemd Service
Run Pleroma as a systemd service to start it automatically during system boot and restart it in case of a crash. Create a file /etc/systemd/system/pleroma.service with the following content:
[Unit]
Description=Pleroma
After=network.target
Requires=postgresql.service
[Service]
User=pleroma
Group=pleroma
Restart=on-failure
WorkingDirectory=/opt/pleroma
Environment="MIX_ENV=prod"
ExecStart=/usr/bin/mix phx.server
KillMode=process
[Install]
WantedBy=multi-user.target
Save and close the file. Then, enable and start the service:
sudo systemctl enable pleroma
sudo systemctl start pleroma
Conclusion
You have successfully installed Pleroma on Debian 10 (Buster) with Nginx and Let's Encrypt. You can now start using Pleroma as your social network server.