Discourse is an open-source discussion platform for community forums, product support sites and internal knowledge bases, with built-in moderation, trust levels and email notifications. The only officially supported way to self-host it is the discourse_docker project, which builds a single container with Discourse, PostgreSQL, Redis and Nginx, and obtains a Let's Encrypt certificate automatically. In this tutorial you will install Discourse on Ubuntu 24.04 with the official setup script, create the admin account, add a plugin and configure backups and upgrades.

Prerequisites

To follow this guide you need:

  • A server running Ubuntu 24.04 LTS, for example a CubePath VPS, with at least 2 vCPUs, 2 GB of RAM (4 GB recommended) and 20 GB of disk. Discourse must be the only service on ports 80 and 443.
  • A non-root user with sudo privileges.
  • A domain or subdomain, such as forum.your_domain, with a DNS A record pointing to your server's public IP. The setup script checks this before continuing. This guide uses your_domain as a placeholder.
  • An SMTP account from a mail provider or transactional email service (host, port, user name and password). Discourse depends on email for account activation, so the installation is not usable without it.

Step 1 - Preparing the server

Update the system and install Git, which you need to download the Discourse Docker project:

sudo apt update && sudo apt upgrade -y
sudo apt install -y git

Open SSH, HTTP and HTTPS in UFW. Port 80 must be reachable so Let's Encrypt can validate the domain:

sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
OpenSSH                    ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
443/tcp                    ALLOW       Anywhere

Confirm that your domain resolves to this server before continuing:

dig +short your_domain

The output must be your server's public IP address.

Step 2 - Downloading the Discourse Docker project

Clone the official repository into /var/discourse, the path used throughout the Discourse documentation:

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

The containers directory will hold app.yml, which contains your SMTP password and other secrets, so it is readable only by root.

Step 3 - Running the setup script

discourse-setup checks the server's memory and ports, installs Docker if it is missing, asks a few questions, writes containers/app.yml and builds the container. Run it as root from /var/discourse:

sudo ./discourse-setup

Answer the prompts with your own values:

PromptExample answer
Hostname for your Discourse?your_domain
Email address for admin account(s)?admin@your_domain
SMTP server address?smtp.your_provider.com
SMTP port?587
SMTP user name?your_smtp_user
SMTP password?your_smtp_password
notification email address?noreply@your_domain
Optional email address for Let's Encrypt warnings?admin@your_domain
Optional MaxMind Account ID and License keypress Enter to skip

The admin email address is important: only accounts registered with it are promoted to administrator automatically. If the server has less than 2 GB of RAM, the script offers to create a swap file; accept it.

The script shows a summary, asks for confirmation, and then bootstraps the container. This step compiles assets and takes between 5 and 15 minutes, and it ends by starting the container.

Verify that the container named app is running:

sudo docker ps --filter name=app --format '{{.Names}}: {{.Status}}'
app: Up 2 minutes

Step 4 - Creating the admin account

Open https://your_domain in your browser. A valid Let's Encrypt certificate is already in place, requested by the container during the first start.

Click Register, enter the admin email address from Step 3, a username and a password. Discourse sends an activation email; click the link in it and you are logged in as administrator. The setup wizard then guides you through the forum name, description, language, whether the forum is public or requires login, and the logo.

If the activation email does not arrive, create the admin account from the command line instead. Enter the container:

cd /var/discourse
sudo ./launcher enter app

Inside the container, run the admin task and follow its prompts for email and password:

rake admin:create

Type exit to leave the container, then fix SMTP as described in the Troubleshooting section.

Step 5 - Verifying email delivery

Open Admin > Email (at https://your_domain/admin/email), enter your own address in Send Test Email and click Send Test. The message should arrive within a minute. Check the spam folder too; if the email lands there, add SPF and DKIM records for your sending domain as instructed by your mail provider.

To change SMTP settings later, edit app.yml:

sudo nano /var/discourse/containers/app.yml

The relevant keys are in the env section:

  DISCOURSE_SMTP_ADDRESS: smtp.your_provider.com
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: your_smtp_user
  DISCOURSE_SMTP_PASSWORD: "your_smtp_password"
  DISCOURSE_NOTIFICATION_EMAIL: noreply@your_domain

Any change to app.yml only takes effect after rebuilding the container, which causes a few minutes of downtime:

cd /var/discourse
sudo ./launcher rebuild app

Step 6 - Installing a plugin

Plugins are added at build time through app.yml. Many popular official plugins, such as solved topics and reactions, now ship bundled with Discourse, so check Admin > Plugins first: a bundled plugin only needs to be enabled there.

For a plugin that is not bundled, open app.yml:

sudo nano /var/discourse/containers/app.yml

Find the hooks section. It already clones docker_manager, which powers the web upgrade page. Add one git clone line per plugin below it, replacing the example URL with the plugin's repository:

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/your_org/your-plugin.git

Keep the indentation exactly as shown; YAML errors stop the rebuild. Rebuild the container to install the plugin:

cd /var/discourse
sudo ./launcher rebuild app

When the rebuild finishes, the plugin appears in Admin > Plugins, where you can enable and configure it.

Step 7 - Configuring backups

Discourse creates backups that contain the database and, optionally, uploaded files. Open Admin > Backups and click Backup to create one now. Then, in the site settings (search for backup), review:

  • automatic_backups_enabled: turn it on.
  • backup_frequency: days between automatic backups, for example 1.
  • maximum_backups: how many backups to keep before the oldest is deleted.
  • include_thumbnails_in_backups and backup_with_uploads: whether images and attachments are included.

Backups are stored on the server in this directory:

sudo ls -lh /var/discourse/shared/standalone/backups/default/
-rw-r--r-- 1 1000 www-data 24M Sep 25 03:30 your-forum-2026-09-25-033000-v20260920000000.tar.gz

Copy these files off the server regularly. Discourse can also upload backups directly to S3-compatible object storage when you set backup_location to S3 and fill in the S3 settings. To restore a backup, upload it in Admin > Backups on a fresh installation and click Restore (you must first enable allow_restore in the site settings).

Step 8 - Upgrading Discourse

Discourse releases updates frequently. The easiest way to apply them is the web page at https://your_domain/admin/upgrade, provided by the docker_manager plugin, which updates Discourse and its plugins without a full rebuild.

Some updates, such as new base images, require a command line rebuild. The upgrade page tells you when this is the case. Run:

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

Take a backup before major upgrades.

Troubleshooting

  • Setup script reports that port 80 or 443 is in use: another web server is running. Stop and disable it, for example sudo systemctl disable --now nginx, then run sudo ./discourse-setup again.
  • Browser shows a certificate error: the DNS record was not pointing to the server during the bootstrap, so Let's Encrypt failed. Fix DNS and run sudo ./launcher rebuild app.
  • Emails are not delivered: run sudo ./discourse-doctor from /var/discourse. It checks the configuration and sends a test email, showing the SMTP error if delivery fails.
  • Rebuild fails with out-of-memory errors: add swap or move to a server with more RAM; asset compilation needs about 2 GB of memory.
  • Viewing logs: sudo ./launcher logs app shows the container logs, and Admin > Logs shows application errors.

Conclusion

Discourse now runs on Ubuntu 24.04 with the official Docker setup, automatic HTTPS, working email, daily backups and a simple upgrade path. Next, create categories and set their permissions under the forum sidebar, adjust trust level thresholds in the site settings to fit your community, and consider moving uploads and backups to S3-compatible object storage to keep the server disk small.