Self-host Lemmy on a managed VPS: your federated forum on your own server

When you self-host Lemmy on a managed VPS, you run your link and discussion communities from a machine of your own, connected to the Fediverse, which our teams keep up to date and monitor day and night. Lemmy is free software under the AGPL-3.0 license. This guide follows its official documentation: the resources to plan for, installing with Docker Compose, the first admin, HTTPS, registrations, email, federation, moderation, images, backups and updates.

Simon Vasconcelos Lee By Published on 24 November 202615 minute read

All guides

In short

  1. The AGPL-3.0 license lets you use Lemmy freely, at work or anywhere else; if you modify it, your version must offer its source code to the people who use it over the network.
  2. The documentation puts the default Docker install at roughly 150 MB of RAM, with negligible CPU usage. Disk is what grows, with images and federated content.
  3. Install it with Docker Compose: six services, including an internal Nginx that splits requests between the web interface and the server. Publish its port on 127.0.0.1, behind an HTTPS reverse proxy that passes the Host header through unchanged.
  4. Create the first admin through the setup block of lemmy.hjson before the first start, and keep registrations on applications, the default setting.
  5. Settle on your domain before you federate, back up the database with pg_dumpall along with the volumes folder, and apply security releases such as 0.19.21 promptly.

What Lemmy does

Lemmy is a link aggregator and forum for the Fediverse. Its README compares it to Reddit, Lobste.rs or Hacker News: you subscribe to the communities you care about, post links and discussions, then vote and comment. The difference is federation: anyone can run a server, and those servers, called instances, talk to each other the way mail servers do.

An instance brings together four components. lemmy-ui is the web interface, with a Node.js server for server-side rendering; the documentation notes that it happily runs on quite low-powered servers. lemmy_server, written in Rust, handles HTTP requests from apps and other instances, sends outgoing federation and constantly computes the ranking that keeps the front page fresh. pict-rs processes images, and PostgreSQL holds everything else.

What the AGPL-3.0 license allows

Lemmy is published under the GNU AGPL version 3 license. You can use it, in business too, for an internal community, a public one or your clients’, with no license to buy. The license preamble says so: it protects the freedom to share and change the software, and you may even charge for distributing copies.

Section 13 adds a condition specific to the AGPL: if you modify the program, your version must prominently offer everyone who uses it remotely, over a network, the chance to obtain its source code at no charge. If you distribute copies, the license’s source-sharing obligations apply as well. Running Lemmy unmodified does not trigger this section.

The resources to plan for

The documentation’s administration page gives a clear benchmark: Lemmy uses roughly 150 MB of RAM in the default Docker installation, and CPU usage is negligible. The 0.19.20 release notes add that the Lemmy backend’s memory usage dropped significantly on x86 processors, thanks to a change of memory allocator.

The documentation puts no figure on disk space or database growth: they depend on member count, followed communities and images. On a managed VPS, tell us about your community, its size and how open it is to federation, and we recommend the size that fits.

Installing with Docker Compose

The project offers two official installation methods: manual with Docker, or automated with Ansible, which it recommends because it simplifies installing and updating. This guide follows the Docker page. You need Docker and Docker Compose 2.0 or later; on Debian, the documentation asks you to install Docker from Docker’s official apt repository.

Create a folder for Lemmy, then download the documentation’s files. The addresses below are the documentation’s own, pinned to the versions that ship with Lemmy 0.19.21: the documentation repository at the commit checked, and lemmy-ansible at its 1.5.20 tag.

Terminal
mkdir lemmy
cd lemmy
wget https://raw.githubusercontent.com/LemmyNet/lemmy-docs/244b7fe7ed9c3adef969da75e8bc0963608276f8/assets/docker-compose.yml
wget https://raw.githubusercontent.com/LemmyNet/lemmy-ansible/1.5.20/examples/config.hjson -O lemmy.hjson
wget https://raw.githubusercontent.com/LemmyNet/lemmy-ansible/1.5.20/templates/nginx_internal.conf
wget https://raw.githubusercontent.com/LemmyNet/lemmy-ansible/1.5.20/files/proxy_params
wget https://raw.githubusercontent.com/LemmyNet/lemmy-ansible/1.5.20/examples/customPostgresql.conf

These files carry placeholders to replace. The commands below set your domain and a random password, the same one in docker-compose.yml and lemmy.hjson, as the documentation requires. They also clean up nginx_internal.conf: it is the template the Ansible install fills in, and besides the resolver the documentation asks you to set to 127.0.0.11, it holds conditions between {% and %}, for Ansible’s Anubis option, which Nginx cannot read. The second command removes them and keeps the default route to lemmy-ui. The third publishes the port on 127.0.0.1.

Terminal, in the lemmy folder
PASS=$(openssl rand -hex 24)
sed -i -e 's/{{ domain }}/lemmy.example.com/g' -e "s/{{ postgres_password }}/$PASS/g" docker-compose.yml lemmy.hjson
sed -i -e 's/{{ nginx_internal_resolver }}/127.0.0.11/' -e '/{% if anubis/,/{% \(else\|endif\) %}/d' -e '/{% endif %}/d' nginx_internal.conf
sed -i 's/- "10633:8536"/- "127.0.0.1:10633:8536"/' docker-compose.yml

On RedHat distributions, the documentation gives 10.89.0.1 instead of 127.0.0.11. Next, give the pict-rs folder the owner its container expects, then start:

Terminal
mkdir -p volumes/pictrs
sudo chown -R 991:991 volumes/pictrs
docker compose up -d

The Compose file starts six services:

ServiceImageIts role
proxynginx:1-alpineThe internal Nginx: it sends ActivityPub requests and the API to the Lemmy server, everything else to the interface
lemmydessalines/lemmy:0.19.21The server, the API and federation; reads lemmy.hjson
lemmy-uidessalines/lemmy-ui:0.19.21The web interface
pictrsasonix/pictrs:0.5.25Images, in volumes/pictrs
postgrespgautoupgrade/pgautoupgrade:18-alpineThe PostgreSQL database, in volumes/postgres
postfixmwader/postfix-relayA mail relay, which the email section replaces with your SMTP server

Tuning PostgreSQL

The customPostgresql.conf file is an example computed by pgtune for 8 GB of RAM and 4 CPUs: the documentation asks you to generate your own for your machine. The Compose file mounts it into the container, and the project’s Ansible template has PostgreSQL read it through this line in the postgres service:

docker-compose.yml, postgres service
    command: postgres -c config_file=/etc/postgresql.conf

The example file ties shared_buffers to the container’s shared memory, shm_size in the Compose file: keep those two values in step.

lemmy.hjson and the first admin

Lemmy reads its configuration from lemmy.hjson, mounted into the container as /config/config.hjson. The downloaded file holds the database access, the domain, the pict-rs address with its API key, and email. The domain, hostname, is mandatory.

With nothing else set, the first visit to the interface opens the “Lemmy Instance Setup” page, where whoever arrives first creates the admin account. To have it exist from the start, Lemmy’s configuration provides a setup block, read at the first start only: add it to lemmy.hjson before docker compose up -d. If the instance has already started once, the database exists and the block is no longer read: use the setup page instead, right after that first start.

lemmy.hjson, block to add
  setup: {
    admin_username: "admin"
    admin_password: "a-password-of-10-to-60-characters"
    site_name: "My instance"
    admin_email: "admin@example.com"
  }

The database password also serves as the pict-rs API key, in lemmy.hjson and in the Compose file’s PICTRS__SERVER__API_KEY variable. Lemmy needs it to delete images: if you change that key, change it in both places.

HTTPS: the reverse proxy

The internal Nginx in the Compose file already splits requests between the interface and the server. In front of it, you add a reverse proxy that listens on ports 80 and 443, obtains the certificate and forwards to 127.0.0.1:10633. The documentation is firm about this for a precise reason: federation requires HTTPS, and Lemmy’s tls_enabled option, on by default, must stay on for it to work.

With Nginx

This block uses the headers from the project’s Nginx template and the troubleshooting guide, on port 80 so that Certbot can set up HTTPS:

Nginx block
server {
    listen 80;
    listen [::]:80;
    server_name lemmy.example.com;
    server_tokens off;

    client_max_body_size 20M;

    location / {
        proxy_pass http://127.0.0.1:10633;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}
Terminal
sudo nginx -t
sudo certbot --nginx

The project’s full template adds response caching, security headers and compression: the troubleshooting guide gives it as the reference, and the configuration to compare yours against when in doubt.

With Caddy

The documentation accepts any other reverse proxy, Caddy included. Here, the internal Nginx already sorts the requests: Caddy only has to forward everything to port 10633. It obtains its Let’s Encrypt certificate on its own, keeps the Host header and forwards Upgrade with no extra setting. The header_up line adds the X-Real-IP header the troubleshooting guide asks for:

Caddyfile
lemmy.example.com {
    encode gzip
    reverse_proxy 127.0.0.1:10633 {
        header_up X-Real-IP {remote_host}
    }
}

The documentation’s Caddy page offers another template, which sends requests straight to the lemmy and lemmy-ui containers: it is meant for a setup without the internal Nginx.

When bots load the interface

If the interface slows down at times while the server keeps responding, the troubleshooting guide often traces it to greedy scraping bots. It suggests the caching from the Nginx template, or blocking by user agent in nginx_internal.conf, inside the server block, extended with the agents you see in your logs:

nginx_internal.conf, inside server
if ($http_user_agent ~* " Bytedance|Bytespider|Amazonbot|ClaudeBot") { return 444; }

The site and registrations

The admin panel opens from the cog at the top right, next to the search icon. The documentation’s “First Steps” page suggests starting with a description, so that people know whether the instance covers one topic or all of them, then an icon and a banner, your organization’s logo for instance. It also suggests appointing a second admin, to act while you are away.

Registrations have three modes, under “Registration Mode”:

ModeWhat it does
Require registration application, the defaultEach applicant answers a questionnaire, and an admin accepts or rejects the request under “Registration Applications”
Open RegistrationAnyone creates an account with no approval
Close RegistrationNo more sign-ups

The documentation recommends applications: they keep bots and trolls from using your server to spam the Fediverse. It is also a requirement for the instance list on join-lemmy.org, along with a description and an icon, federation with at least one instance from that list, at least five active users in the past month and the latest major version of Lemmy.

Email: an authenticated SMTP server

Lemmy sends its emails through the SMTP server described in the email block of lemmy.hjson: password resets, address verification if you require it, and notices to admins for applications and reports if you turn them on. The downloaded file points to the Compose file’s postfix service, a relay that delivers mail to recipients itself.

On a Simafri VPS, configure an authenticated SMTP server, your mail provider’s or an email delivery service’s, on port 587 or 465. The two credentials are the block’s only optional fields:

lemmy.hjson, email block
  email: {
    smtp_server: "smtp.example.com:587"
    smtp_login: "smtp-username"
    smtp_password: "smtp-password"
    smtp_from_address: "noreply@lemmy.example.com"
    tls_type: "starttls"
  }

With your SMTP server in place, the postfix service is no longer needed: remove it from the Compose file, then apply:

Terminal
docker compose up -d --remove-orphans

To check sending, the documentation suggests requesting a new password: set an address in your settings, log out, enter that address on the login page and click “forgot password”. The email you receive proves everything works, and you can ignore it.

Federation

Federation follows the email model: your members only talk to your server, and your server exchanges with other instances. The documentation’s federation page describes it as enabled by default, as does the database default; the “Federation enabled” box in the admin panel lets you confirm it.

At first, your instance shows no content from elsewhere. To follow a remote community, paste its address into your instance’s search, for example https://lemmy.ml/c/announcements, then click “Follow”: its new content then reaches you. Search also accepts the !community@instance and @member@instance forms, and the addresses of posts and comments.

Open, blocklist or allowlist

ModeWhat it does
OpenLemmy federates with every potential instance
BlocklistEvery instance, except those you list under “Blocked Instances”
AllowlistOnly the instances listed under “Allowed Instances”, for example enterprise.lemmy.ml,lemmy.ml

Checking that federation works

A request asking for ActivityPub JSON must get JSON back, not an HTML page. Replace admin with an account on your instance:

Terminal
curl -H 'Accept: application/activity+json' https://lemmy.example.com/u/admin

The domain is part of the identity of every account, community and post in the Fediverse. The documentation is explicit: it can be changed in the database before any federation, never after, or federation breaks. Settle on it before you follow your first remote community.

Moderating a federated instance

The Fediverse has no shared moderation team and no platform-wide rules: each instance creates and enforces its own policy. Two instances can therefore have opposite rules, and since federation is open by default to any instance that speaks the same protocol, their content meets. The documentation gives admins two answers: block federation with specific instances, or federate only with instances allowed one by one.

Actions are taken from the three-dot menu of a post or comment, and are reverted the same way, purges aside:

ActionEffectWho
LockCloses the post to new commentsModerator
Sticky, communityPins the post to the top of the communityModerator
Sticky, localPins the post to the top of the front pageAdmin
RemoveRemoves the postModerator
Ban from communityBans the account from the community, with an option to remove its contentModerator
Ban from siteBans the account from the whole instance, with the same optionAdmin
PurgePermanently deletes an account, a post or a comment, media includedAdmin
Appoint as mod, as adminAppoints a moderator or an adminModerator, admin

Appoint moderators early for your busiest communities, keep registrations on applications, and review your instance lists as your instance discovers the Fediverse.

Images with pict-rs

pict-rs receives the images your members upload and downloads thumbnails for external links. It stores everything in volumes/pictrs, under its container’s user 991. In the pictrs block of lemmy.hjson, image_mode chooses how remote images are handled:

ValueWhat it does
StoreLinkPreviews, the defaultGenerates and keeps a thumbnail for each posted link: reliable previews, more storage
ProxyAllImagesRoutes every remote image through your server, which caches it for a while: your members no longer connect to third-party servers, and your bandwidth use goes up
NoneNo local thumbnails: the link’s preview image is returned as is

The Compose file shows in a comment how to pass options to pict-rs, here a maximum size and conversion to WebP: -m 4 --image-format webp. The members’ documentation reserves uploads for images and short animations, and points videos and large images to PeerTube or Pixelfed, shared afterwards by link.

Backups

With Docker, everything lives in the volumes folder: the database in volumes/postgres and images in volumes/pictrs. The documentation sums it up: copying that folder to a new instance restores your data. Also keep lemmy.hjson, docker-compose.yml, nginx_internal.conf, proxy_params and customPostgresql.conf, which hold your configuration and your secrets.

For the database, the documentation gives a full, compressed dump, taken without stopping the instance:

Terminal, in the lemmy folder
docker compose exec -T postgres pg_dumpall -c -U lemmy | gzip > lemmy_dump_$(date +%Y-%m-%d_%H_%M_%S).sql.gz

For a full, consistent copy of images and database, stop the instance while the archive is made:

Terminal, in the lemmy folder
docker compose down
sudo tar -czf lemmy-$(date +%F).tar.gz volumes lemmy.hjson docker-compose.yml nginx_internal.conf proxy_params customPostgresql.conf
docker compose up -d

The documentation also offers a script run from another machine: the database dump over SSH, and the volumes folder copied with rsync. Schedule your copies to match your instance’s activity, and send them off the server. Stored on its disk, these archives are also part of its nightly backups.

Restoring the database

On a fresh install, start PostgreSQL only, load the dump, then start the rest:

Terminal, in the lemmy folder
docker compose up -d postgres
gunzip < lemmy_dump_2026-11-20_03_00_00.sql.gz | docker compose exec -T postgres psql -U lemmy
docker compose up -d

If the lemmy service has already started on that database, it has created its tables there: the documentation asks you to clear the database first, then run the commands above again. This wipes the existing database:

Terminal
docker compose exec -T postgres psql -U lemmy -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;"

Updates

With Docker, an update changes the version numbers in docker-compose.yml, for example dessalines/lemmy:0.19.21 and dessalines/lemmy-ui:0.19.21 to the next release. When a release needs extra steps, its notes describe them. Dump the database, then, from the instance folder:

Terminal
docker compose pull
docker compose up -d

Lemmy 1.0, in beta

The 1.0 branch is in beta: 1.0.0-beta.3 dates from 29 October 2026, and the stable release remains 0.19.21. Its upgrade page asks for tested backups, PostgreSQL tuned for the machine and a trial run on a copy of the database. It warns that the migrations rewrite most tables: on lemmy.ml, they took about 24 hours, with the site offline. The configuration changes too, with a single connection URL for the database and for email, and new variables for lemmy-ui.

Who does what on a managed VPS

Self-hosting means running the server on top of the application. On a managed VPS, our teams take charge of the server and proactively monitor your instance; Lemmy remains your software, with its settings, your communities and your rules.

TopicOur teamsYou
The serverSystem and security updates, server interventions includedThe timing that suits your business
MonitoringServer monitored 24/7, with intervention without waiting for your callReading your instance’s logs
LemmyProactive monitoring: errors, slowdowns, memory and disk space for the database and images spotted, fix recommendedIts installation, updates and settings, which you apply, yourself or through your AI assistant
The communityThe server that carries it, monitored and backed upRules, admins and moderators, applications, blocked or allowed instances
EmailA server that reaches your SMTP server on port 587 or 465Your email delivery service and your DNS records
BackupsEvery night, encrypted and kept off the machine; restores includedYour database dump before each update, and the restore request, when you need one
MigrationYour current server migrated, free of chargeThe timing of the switch

If you would rather have our teams work inside the application itself, that service is billed by the hour or at a fixed rate, with an estimate shared before the work starts.

Lemmy, on a server run for you

With a Simafri Managed VPS, our teams keep your Lemmy instance’s server up to date, monitor it day and night and step in without waiting for your call; they also proactively monitor your instance and recommend useful fixes, which you apply, yourself or through your AI assistant. Backups are encrypted every night and kept off the machine, restores are included, and migrating your current server is free.

Explore Managed VPS

Frequently asked questions

Is Lemmy free for a business?

Yes. Lemmy is under the AGPL-3.0 license: you can use it at work with no license to buy. If you modify its code, your version must offer its source code to the people who use it over the network. What remains is the cost of the server that runs it.

How much RAM does Lemmy need?

The documentation puts the default Docker install at roughly 150 MB of RAM, with negligible CPU usage. Plan disk space for the PostgreSQL database and images, which grow with your members and federated content.

How do I install Lemmy with Docker Compose?

Download the documentation’s docker-compose.yml, lemmy.hjson, nginx_internal.conf and proxy_params, replace the domain and password, give volumes/pictrs to user 991, then run docker compose up -d. Publish port 10633 on 127.0.0.1, behind an HTTPS reverse proxy.

How do I create the first Lemmy admin?

Add a setup block to lemmy.hjson before the first start, with admin_username, a password of 10 to 60 characters and site_name. Without that block, the first visit opens the setup page, where whoever arrives first creates the admin account.

Does Lemmy work with the rest of the Fediverse?

Yes. Lemmy speaks ActivityPub and exchanges with other Lemmy instances and with community-based platforms such as Piefed or Mbin. Federation requires HTTPS, and the Host header must pass through the reverse proxy unchanged.

How do I moderate a federated Lemmy instance?

Publish your rules, appoint admins and moderators, keep registrations on applications and follow up on reports. Against an instance whose rules clash with yours, block federation with it, or federate only with a list of allowed instances.

How do I back up Lemmy?

Dump the database with docker compose exec -T postgres pg_dumpall -c -U lemmy, compressed with gzip, and copy the volumes folder, which holds the database and images, along with lemmy.hjson and docker-compose.yml. Copying that folder to a new instance restores your data.

Does a managed VPS cover Lemmy?

A managed VPS covers the server: system, security, monitoring and backups. Our teams also proactively monitor your instance and recommend useful fixes, which you apply. Work inside the application is billed by the hour or at a fixed rate.

Contact us