Installing Pleroma on NixOS
Introduction
Pleroma is a free, federated social networking platform that is designed to be lightweight and scalable. It is built on top of the Elixir language and Phoenix framework, and can be deployed on a variety of platforms including Linux, FreeBSD, and OpenBSD.
This tutorial will guide you through the process of installing Pleroma on NixOS, a functional Linux-based operating system that is designed to be highly customizable and easy to maintain.
Prerequisites
Before you begin, you will need:
- A running instance of NixOS
- A user account with sudo privileges
- Basic knowledge of the command-line interface (CLI)
Step 1: Install Erlang and Elixir
Pleroma is written in Elixir, which is a functional programming language that runs on top of the Erlang virtual machine. To install Erlang and Elixir on NixOS, open a terminal window and run the following command:
sudo nix-env -iA nixpkgs.erlang nixpkgs.elixir
This command will install the latest versions of Erlang and Elixir from the NixOS package repository.
Step 2: Install PostgreSQL
Pleroma requires a PostgreSQL database to store its data. To install PostgreSQL on NixOS, run the following command:
sudo nix-env -iA nixpkgs.postgresql
This command will install the latest version of PostgreSQL from the NixOS package repository.
Step 3: Create a PostgreSQL Database and User
Next, you will need to create a PostgreSQL database and user for Pleroma. To do this, run the following commands:
sudo su - postgres
createdb -O postgres pleroma
createuser -d -R -S pleroma
These commands will switch you to the postgres user account, create a new database called "pleroma", and create a new user called "pleroma" with the necessary permissions.
Step 4: Install Pleroma
To install Pleroma on NixOS, run the following command:
sudo nix-env -iA nixpkgs.pleroma
This command will install the latest version of Pleroma from the NixOS package repository.
Step 5: Configure Pleroma
Once Pleroma is installed, you will need to configure it to use the PostgreSQL database and set other necessary options. Open the file /etc/pleroma/config.exs in a text editor, and make the following changes:
- Set the database configuration:
config :pleroma, :ecto,
adapter: Ecto.Adapters.Postgres,
username: "pleroma",
password: "",
database: "pleroma",
hostname: "localhost",
pool_size: 10
- Set the Pleroma instance name:
config :pleroma, :instance,
name: "My Pleroma Instance",
# Other options...
- Set the Pleroma administrator email:
config :pleroma, :instance,
email: "[email protected]",
# Other options...
Save and close the file when you are finished.
Step 6: Start Pleroma
To start Pleroma, run the following command:
sudo systemctl start pleroma
This command will start the Pleroma service, which will listen for incoming requests on port 4000 by default.
Conclusion
In this tutorial, you learned how to install Pleroma on NixOS and configure it to use a PostgreSQL database. With your instance up and running, you can now start exploring the world of federated social networking!