How to Install Listmonk on VPS with Docker: Self-Hosted Newsletters with PostgreSQL and SMTP
Newsletter bills have a habit of growing exactly when your audience does. Every new subscriber adds to the monthly charge, even though what you actually need is simple: send email to your own list, from your own server, without a middleman holding your readers' data. Listmonk fits that need. It is an open-source newsletter manager that runs as a single application next to a PostgreSQL database, and it charges nothing per subscriber. You only pay for the VPS and whatever SMTP service you use for delivery.
This guide installs Listmonk on a VPS with Docker Compose, connects it to SMTP, and sets up a list, a template, and a first campaign ready to send. The core steps follow Listmonk's official installation documentation: download the official compose file, start it, open the panel on port 9000.
Before you start: what you need
- A VPS with Docker and Docker Compose v2 installed. One CPU and 2 GB of RAM is enough for a small to medium newsletter; scale up once your list reaches tens of thousands.
- A domain or subdomain pointed at the VPS, for example
newsletter.example.com, if you want to open it over HTTPS. This guide uses that domain as an example. - An SMTP account from an email delivery provider, with its host, port, username, and password. Listmonk sends through SMTP, so without these credentials no campaign can go out.
- Port
9000free on the VPS.
Check Docker and Compose first:
docker --version
docker compose versionExpected result: both commands print a version number without errors. If docker compose is not recognised, you probably still have the old Compose v1 — upgrade to the Compose v2 plugin before continuing.
Step 1: download the official Compose file
Create a working directory, then download the official docker-compose.yml from the Listmonk repository:
mkdir -p /srv/docker/listmonk && cd /srv/docker/listmonk
curl -LO https://github.com/knadh/listmonk/raw/master/docker-compose.ymlThis file defines two services: app using the listmonk/listmonk:latest image, and db using postgres:17-alpine. PostgreSQL data lives in a volume called listmonk-data, and uploads map to ./uploads on the host. The file's startup command already runs the database installation automatically on first start (./listmonk --install --idempotent --yes), so there is no separate manual install step.
Before starting anything, change the default database credentials. In the compose file, the default user, password, and database name are all listmonk. Generate a long random password:
openssl rand -base64 24Copy the result and edit the credential section of docker-compose.yml — all three values share one anchor, so a single password change applies to both the app and the database. Do not skip this: the default credentials are widely known, and leaving them in place is leaving a door open.
For public use behind a domain, also change the app's port mapping from "9000:9000" to "127.0.0.1:9000:9000" and point a reverse proxy at it. Listmonk does not handle HTTPS itself, so Nginx or Caddy is the right place to terminate TLS. A minimal Nginx block looks like this:
server {
listen 443 ssl;
server_name newsletter.example.com;
ssl_certificate /etc/letsencrypt/live/newsletter.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/newsletter.example.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:9000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}You can issue the certificate with Certbot once the domain's DNS points at the VPS. If you are only trying things out locally, skip the reverse proxy and open port 9000 directly.
Step 2: start the stack and create the Super Admin
From /srv/docker/listmonk, run:
docker compose up -dThen check the status:
docker compose ps
docker compose logs -f appExpected result: both containers (listmonk_app and listmonk_db) show as running, and the app log stops showing database connection errors. Give the first start about half a minute, since the schema installation takes a moment.
Open http://localhost:9000 from the VPS, or https://newsletter.example.com once the reverse proxy is live. On the first visit, Listmonk asks you to create a Super Admin user. Choose a strong username and password, and store them in a password manager.
Alternatively, you can create the Super Admin automatically on first start with the LISTMONK_ADMIN_USER and LISTMONK_ADMIN_PASSWORD environment variables in the compose file — but this only works on the very first start. Once the containers exist, changing those variables will not change the existing account; change it through the user menu in the panel instead.
Step 3: connect SMTP
Without SMTP, Listmonk can only hold drafts. In the panel, open Settings, then the SMTP tab. Fill in the details from your SMTP provider:
- The SMTP host and port (usually 587 for STARTTLS or 465 for SSL/TLS — follow what your provider asks for).
- The authentication protocol and credentials (username and password, or an app password).
- A From address whose domain you have verified with the provider.
Save, then send a test email using the test option on the same page. Expected result: the test email lands in the destination inbox within a minute or two. If it does not arrive, check the spam folder first, then the app log — that is where the real SMTP error is recorded.
One important note about delivery: Listmonk does not fix your domain's reputation. If the domain lacks correct SPF, DKIM, and DMARC DNS records, major email providers may reject your mail or file it as spam. Set those three records up with your domain provider before sending to thousands of people, not after.
Step 4: create a list and add subscribers
In Listmonk, a subscriber is a recipient identified by an email address and a name, and one subscriber can belong to many lists. A list is the grouping: one for a weekly digest, another for product announcements, for example.
Create the first list from the Lists menu, then choose its opt-in type:
- Single opt-in: subscribers join the list as soon as they are added, with no confirmation step.
- Double opt-in: subscribers must click a confirmation link in an email before receiving campaigns. List growth is slower, but the list stays much cleaner of fake addresses and spam complaints.
Once the list exists, add subscribers from the Subscribers menu. For small numbers, add them one by one. For a migration from another service, use the CSV import — prepare a file with email and name columns, then follow the column mapping on the import page. Listmonk also supports extra per-subscriber attributes stored as JSON (a city or a language, for instance), which you can later use for segmentation: send only to subscribers matching a certain attribute instead of the whole list.
Watch each subscriber's status within a list: unconfirmed (added directly without explicit confirmation), confirmed (clicked the confirmation), and unsubscribed (will receive no further campaigns). Campaigns to a double opt-in list only reach confirmed subscribers — so do not be surprised if the sent count is smaller than the total names on the list.
Step 5: prepare a template, then send the first campaign
A template is a reusable HTML design shared across campaigns — typically a fixed header and footer, with the campaign content inserted in the middle. Listmonk supports Go template expressions for dynamic content such as a subscriber's name. The safest way to start: duplicate the built-in template, adjust its colours and footer to match your identity, and save it as your own. Do not edit the built-in template directly; if it breaks, you lose a healthy starting point.
Now create a campaign from the Campaigns menu:
- Give the campaign a name and a clear subject line.
- Pick the target list and the template you just prepared.
- Write the email content — rich text, HTML, or plain text.
- Send a test email to yourself and open it on both phone and desktop.
- If it looks right, start the campaign.
Expected result: the campaign runs, and its analytics page starts showing sent, opened, clicked, and bounced counts. The last two metrics carry a privacy caveat: tracking pixels and click tracking are common in the industry, but you still have to use them in line with the rules where your readers live. And always include a working unsubscribe link — besides being the right thing to do, it is what keeps your domain's reputation intact.
Backups: do not wait until the list is big
A subscriber list is an asset that is hard to rebuild from scratch. Schedule regular database backups, for example with this command from the project directory:
docker compose exec db pg_dump -U listmonk listmonk > listmonk-backup.sqlStore the resulting file outside the VPS. The listmonk-data volume does keep data across container restarts, but a volume is not a backup: if the VPS disappears, the volume goes with it.
Common problems
Port 9000 is already in use. Run docker compose ps and check what else runs on the VPS. Change the port mapping in the compose file, or stop the conflicting service, then run docker compose up -d again.
The app cannot reach the database. The most common cause: the database password was changed in the compose file after the first start. The credentials in the file must match what is already stored in the database volume. If they no longer match, restore the old password, or start over with a fresh volume (and lose the old data).
The test email never arrives. Check the SMTP credentials, port, and TLS protocol. Many providers require an app password rather than the main account password. Check the app log too — SMTP authentication errors are usually spelled out there.
Links in emails point to localhost. Check the domain settings in the panel's Settings and make sure the public address is your domain, not localhost:9000.
A campaign stalls halfway. Do not hit send again right away. Check the app log and the SMTP status first; resending without a diagnosis can deliver duplicates to part of your list.
Summary
| Part | What is used |
|---|---|
| Application | listmonk/listmonk:latest (port 9000) |
| Database | PostgreSQL 17 (postgres:17-alpine image, listmonk-data volume) |
| Compose file | https://github.com/knadh/listmonk/raw/master/docker-compose.yml |
| Delivery | External SMTP, configured in the panel's Settings |
| Lists | Single or double opt-in, with a per-list subscriber status |
| Templates | Reusable HTML, with Go template expressions |
| Campaigns | To one or several lists, with open, click, and bounce analytics |
Final checklist
- The official compose file is downloaded and the default database password is changed.
- Both containers are running and the panel opens.
- The Super Admin account is created and stored in a password manager.
- SMTP is connected and the test email has arrived.
- One list is created (double opt-in recommended) and the first subscriber is in.
- A personal template is created from a copy of the built-in one.
- A test campaign has been sent and checked on phone and desktop.
- Database backups are scheduled and stored outside the VPS.
One question for you: which list will you move to Listmonk first — a newsletter that is already running, or a new list that has so far only lived in a spreadsheet? Tell us your plan in the comments, and if any step in this guide gets stuck on your server, post the error message so it can be discussed together.
Read also: if you also schedule meetings from the same VPS, the companion guide in this batch is available at the Cal.com guide to self-hosted scheduling with booking pages. Meanwhile, the Rnevio article "How to Install Ghost on VPS with Docker: A Self-Hosted Blog with MySQL and Persistent Content" covers another platform with a built-in newsletter feature, useful as a comparison before you decide.


Diskusi
Ada pertanyaan atau pengalaman yang ingin dibagikan?
Komentar ditinjau sebelum ditampilkan. Mari berdiskusi dengan sopan dan sesuai topik.
Tulis komentar