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.
By Simon Vasconcelos Lee
Published on 24 November 202615 minute read
127.0.0.1, behind an HTTPS reverse proxy that passes the Host header through unchanged.setup block of lemmy.hjson before the first start, and keep registrations on applications, the default setting.pg_dumpall along with the volumes folder, and apply security releases such as 0.19.21 promptly.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.
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 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.
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.
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.
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:
mkdir -p volumes/pictrs
sudo chown -R 991:991 volumes/pictrs
docker compose up -d
The Compose file starts six services:
| Service | Image | Its role |
|---|---|---|
proxy | nginx:1-alpine | The internal Nginx: it sends ActivityPub requests and the API to the Lemmy server, everything else to the interface |
lemmy | dessalines/lemmy:0.19.21 | The server, the API and federation; reads lemmy.hjson |
lemmy-ui | dessalines/lemmy-ui:0.19.21 | The web interface |
pictrs | asonix/pictrs:0.5.25 | Images, in volumes/pictrs |
postgres | pgautoupgrade/pgautoupgrade:18-alpine | The PostgreSQL database, in volumes/postgres |
postfix | mwader/postfix-relay | A mail relay, which the email section replaces with your SMTP server |
127.0.0.1: this is the only change from the documentation’s file, which publishes it on every address of the server. The project’s Ansible template makes the same choice: the instance is then reached only through the reverse proxy, over HTTPS. The file’s comment notes that this left-hand number can be changed freely.volumes folder keeps the database and images on the server, outside the containers: that is what you back up and move.0.19.21 for Lemmy and its interface, 0.5.25 for pict-rs. An update changes these tags.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:
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 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.
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.
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.
Host header passes through unchanged: federated exchanges are signed, and some headers are part of the signature. The documentation asks you not to change any of them.X-Real-IP and X-Forwarded-For; otherwise Lemmy counts every action against the proxy’s address and its rate limits trip for everyone.Upgrade and Connection headers: the project’s Nginx template forwards them, and the troubleshooting guide checks them first when creating the admin account fails.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:
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;
}
}
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.
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:
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.
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:
if ($http_user_agent ~* " Bytedance|Bytespider|Amazonbot|ClaudeBot") { return 444; }
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”:
| Mode | What it does |
|---|---|
| Require registration application, the default | Each applicant answers a questionnaire, and an admin accepts or rejects the request under “Registration Applications” |
| Open Registration | Anyone creates an account with no approval |
| Close Registration | No 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.
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:
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"
}
smtp_server: the server name and its port, separated by a colon.tls_type: none, tls or starttls. Use starttls on port 587 and tls on port 465.smtp_from_address: the sender address, for example noreply@ followed by your domain, on a domain whose signatures your delivery service carries.With your SMTP server in place, the postfix service is no longer needed: remove it from the Compose file, then apply:
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 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.
| Mode | What it does |
|---|---|
| Open | Lemmy federates with every potential instance |
| Blocklist | Every instance, except those you list under “Blocked Instances” |
| Allowlist | Only the instances listed under “Allowed Instances”, for example enterprise.lemmy.ml,lemmy.ml |
A request asking for ActivityPub JSON must get JSON back, not an HTML page. Replace admin with an account on your instance:
curl -H 'Accept: application/activity+json' https://lemmy.example.com/u/admin
/inbox path receives incoming federation: a web application firewall placed in front of the server must let it through.docker compose logs -f lemmy, in the instance folder. Follows that stay on “Subscription Pending” after a few hours point to a setting to review.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.
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:
| Action | Effect | Who |
|---|---|---|
| Lock | Closes the post to new comments | Moderator |
| Sticky, community | Pins the post to the top of the community | Moderator |
| Sticky, local | Pins the post to the top of the front page | Admin |
| Remove | Removes the post | Moderator |
| Ban from community | Bans the account from the community, with an option to remove its content | Moderator |
| Ban from site | Bans the account from the whole instance, with the same option | Admin |
| Purge | Permanently deletes an account, a post or a comment, media included | Admin |
| Appoint as mod, as admin | Appoints a moderator or an admin | Moderator, admin |
Appoint moderators early for your busiest communities, keep registrations on applications, and review your instance lists as your instance discovers the Fediverse.
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:
| Value | What it does |
|---|---|
StoreLinkPreviews, the default | Generates and keeps a thumbnail for each posted link: reliable previews, more storage |
ProxyAllImages | Routes 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 |
None | No 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.
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:
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:
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.
On a fresh install, start PostgreSQL only, load the dump, then start the rest:
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:
docker compose exec -T postgres psql -U lemmy -c "DROP SCHEMA public CASCADE; CREATE SCHEMA public;"
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:
docker compose pull
docker compose up -d
lemmy and lemmy-ui repositories on GitHub, and a Matrix room for admins.down.sql files. Hence the dump right before every update.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.
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.
| Topic | Our teams | You |
|---|---|---|
| The server | System and security updates, server interventions included | The timing that suits your business |
| Monitoring | Server monitored 24/7, with intervention without waiting for your call | Reading your instance’s logs |
| Lemmy | Proactive monitoring: errors, slowdowns, memory and disk space for the database and images spotted, fix recommended | Its installation, updates and settings, which you apply, yourself or through your AI assistant |
| The community | The server that carries it, monitored and backed up | Rules, admins and moderators, applications, blocked or allowed instances |
| A server that reaches your SMTP server on port 587 or 465 | Your email delivery service and your DNS records | |
| Backups | Every night, encrypted and kept off the machine; restores included | Your database dump before each update, and the restore request, when you need one |
| Migration | Your current server migrated, free of charge | The 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Simafri
Let's talk about your project
Tell us what you need in a few words: we will get back to you quickly.
Thank you! Your request has been sent. We'll get back to you shortly.
Prefer email? Write to us at support@simafri.com.