Log inSign up

Running a Discourse forum on your own instance

Discourse is installed with its official Docker launcher: clone discourse_docker into /var/discourse, run ./discourse-setup, and answer the questions about your hostname, admin email and SMTP relay. Working email is required because the first admin account is confirmed by mail. The script builds the container, gets a certificate and starts the forum on ports 80 and 443.

Topic: Websites, CMS and shops · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13 · Updated 2026-12-03

What does Discourse need before you start?

The launcher handles almost everything inside a container, but the host has to meet a few conditions:

  • Ubuntu 24.04 or 22.04, Debian 12 or 13, on a fresh instance with nothing else on ports 80 and 443.
  • At least 2 GB of RAM. The setup script can add swap on smaller machines, yet 2 GB or more makes rebuilds far less painful.
  • Around 20 GB of free disk for the image, database, uploads and backups, with room to grow.
  • A domain such as forum.example.net already pointing at the server (A and AAAA records), as in DNS records.
  • SMTP credentials from a mail relay that accepts authenticated submission on port 587.

Check the DNS before you begin with dig +short forum.example.net; it must return 198.51.100.24 (your server address) or certificate issuance fails.

Why is the mail relay mandatory?

Discourse sends account confirmations, password resets, notification digests and the very first admin activation link by email. Without working mail you cannot even finish the setup through the browser. Plan the outgoing path around an authenticated SMTP relay on port 587 with STARTTLS; port 25 should not be assumed open, and if you want to send directly from the server, ask support with a ticket first. Prepare these values:

  • SMTP server address, for example smtp.example.net.
  • Port 587.
  • Username and password (often an API key) from the relay.
  • A sending address such as noreply@example.net, with SPF and DKIM set up as in the SPF, DKIM and DMARC guide.

Confirm the server can reach the relay: nc -vz smtp.example.net 587.

How do you prepare the server?

Update the system, install Git, and open the web ports. The setup script installs Docker by itself if it is missing, or you can install it first with the Docker Engine tutorial.

sudo apt update && sudo apt -y upgrade
sudo apt install -y git
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
free -h
df -h /

Docker publishes container ports through its own firewall rules, which take effect even where ufw has no matching rule. Keep that in mind: only the ports Discourse needs are published, so this is not a problem here, but it matters if you later add other containers.

How do you run the official installer?

Clone the launcher repository into /var/discourse and start the interactive setup as root.

sudo -s
git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
chmod 700 containers
./discourse-setup

The script checks memory, disk and ports, then asks:

  • Hostname: forum.example.net
  • Admin email: the address that may register the first admin account (you can list several, separated by commas).
  • SMTP server address, port (587), username and password.
  • Notification email: the From address, such as noreply@example.net.
  • Email for Let's Encrypt: where certificate warnings go.

It writes the answers to containers/app.yml, bootstraps the image and starts the container. The first build takes several minutes; let it finish without interrupting the SSH session, or run it inside tmux.

How do you create the first admin?

Open https://forum.example.net, click Register and sign up with one of the admin addresses you entered. Discourse sends an activation link; once you click it, the account becomes an administrator and the setup wizard starts. If the email never arrives, fix mail first, but you can create the admin from the shell in the meantime:

cd /var/discourse
./launcher enter app
rake admin:create
exit

Then open Admin, Emails, and send a test message to prove the relay works. The Logs tab under Emails shows rejected and bounced messages with the reason given by the relay.

How do you change settings later?

Server-level settings live in /var/discourse/containers/app.yml; edit it and rebuild the container to apply changes. A typical mail block looks like this:

  DISCOURSE_HOSTNAME: forum.example.net
  DISCOURSE_DEVELOPER_EMAILS: 'admin@example.net'
  DISCOURSE_SMTP_ADDRESS: smtp.example.net
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: noreply@example.net
  DISCOURSE_SMTP_PASSWORD: "relay-password"
  DISCOURSE_SMTP_ENABLE_START_TLS: true
  DISCOURSE_NOTIFICATION_EMAIL: noreply@example.net
cd /var/discourse
./launcher rebuild app

Forum behaviour, such as categories, trust levels, login methods and themes, is managed in the admin panel instead and needs no rebuild. YAML is sensitive to indentation, so keep two spaces before each key and validate the file if a rebuild fails right at the start.

How do you upgrade Discourse?

Most updates install from the browser at /admin/upgrade. When that page asks for a command-line rebuild, or when the base image changes, run:

cd /var/discourse
git pull
./launcher rebuild app
./launcher cleanup

The rebuild takes the forum offline for a few minutes. ./launcher cleanup removes old images that would otherwise fill the disk. Keep the host itself patched too, with regular apt upgrade runs and a reboot when the kernel changes, as described in automatic security updates.

How do you back up and troubleshoot the forum?

Discourse makes its own backups: enable them in Admin, Backups, and choose whether to include uploads. Archives are stored in /var/discourse/shared/standalone/backups/default/. Copy them off the server regularly:

rsync -az /var/discourse/shared/standalone/backups/default/ backup@203.0.113.50:/srv/backups/forum/

When something goes wrong, these commands give you the facts:

cd /var/discourse
./launcher logs app | tail -n 100
./discourse-doctor
docker ps
df -h /

discourse-doctor checks DNS, ports, mail settings and container state and prints a readable report. A full disk is the most common cause of failed rebuilds, so watch disk usage with the usage monitoring tutorial. The optional daily backups add-on covers the whole server, and restores are requested by ticket.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
A2-4a new community forum2 vCPU, 4 GB RAM, 100 GB NVMe$14.40/mo$43.20 for 3 months
A4-8busy forums and faster rebuilds4 vCPU, 8 GB RAM, 180 GB NVMe$28.80/mo$86.40 for 3 months

Questions about Discourse community forum

Can Discourse run on 1 GB of RAM?

It can start with swap, but rebuilds become slow and can fail. A plan with 2 GB or more is the practical minimum, and 4 GB is comfortable for an active forum.

Can I put Discourse behind my own Nginx?

Yes, by changing the templates in app.yml so the container listens on a socket or local port, then proxying to it. The default standalone setup is simpler and handles HTTPS by itself.

Why did the installer say ports 80 or 443 are in use?

Another web server is already running. Stop and disable it, or use a fresh instance dedicated to Discourse.

Do I need to install Docker myself?

No. discourse-setup installs Docker when it is missing. Installing it beforehand from the official repository is also fine.

How do I move Discourse to another server?

Create a backup in the admin panel, install Discourse on the new server with the same hostname, restore the backup there, then switch DNS.

Is direct email from the server supported?

Use an authenticated SMTP relay on port 587. Port 25 is not promised to be open, so ask support by ticket before planning direct delivery.