Skip to content

Install Discourse: How to

Discourse is an open source software designed for the creation of forums and community platforms. It offers a modern, user-friendly interface and a variety of features that make it a popular choice for online discussions. In this guide, we’ll show you how to install Discourse on a Linux server, including all the necessary steps to configure it correctly.

Prerequisites

Before you start installing Discourse, make sure that you meet the following requirements:

  1. A Linux server: You need a server that runs a Linux distribution. Discourse primarily supports Ubuntu 20.04 and 22.04.
  2. Hardware requirements
    • Modern single core, better dual core CPU
    • 1GB RAM (minium, with SWAP)
    • 64Bit Linux compatible with Docker
    • 10GB storage space
  3. Root access: You need root rights or a user with sudo rights to install the necessary software packages and make configurations.
  4. Docker: Discourse uses Docker to isolate all dependencies and the application itself. Docker must therefore be installed on the server.
  5. Public IP: During setup, Discourse checks whether the server on which the installation is running is actually accessible via the domain. Ports 80 and 443 must be open.
  6. Domain name: You should have a domain or subdomain for your Discourse instance, e.g. forum.yourdomain.com.
  7. SMTP relay: Discourse requires an SMTP relay to send e-mails.

Step 1: Prepare the system

First you have to prepare your server. Log in to your server with SSH:

ssh user@dein-server-ip

Updating the system

It is important that your system is up to date. Execute the following commands to update all packages:

sudo apt update<br>sudo apt upgrade 

Install Docker

Discourse runs in a Docker environment, so install Docker. First, we add the APT repository to Docker:

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

We can then install Docker and Docker-Compose with the following command:

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Install Git

In addition to Docker, Discourse also requires Git. So we install git with the following command:

sudo apt install git -y

Step 2: Clone discourse repository

Now we clone the official Discourse Docker image into the /var/discourse folder:

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

The command clones the Docker image into the /var/discourse/ folder and changes the permissions with chmod.

Step 2: Start Discourse Setup

We should now be in the /var/discourse folder, this is important as the setup can only be executed from here. If we are not in the folder: cd /var/discourse

The setup is started with the following command:

./discourse-setup

A few questions are then asked:

Hostname for your Discourse? [discourse.example.com]: 
Email address for admin account(s)? [me@example.com,you@example.com]: 
SMTP server address? [smtp.example.com]: 
SMTP port? [587]: 
SMTP user name? [user@example.com]: 
SMTP password? [pa$$word]: 
Let's Encrypt account email? (ENTER to skip) [me@example.com]: 
Optional Maxmind License key () [xxxxxxxxxxxxxxxx]:

When you set up your Let’s Encrypt account, you will receive a free HTTPS certificate for your Discourse Forum, which you should definitely set up if you want to make your website secure.

The setup generates an App.yml file, which can be found in the folder /var/discourse/containers/ and then starts the bootstrapping.

What is boat rapping?

Bootstrapping refers to the process by which a system or application is initialized with the necessary resources, dependencies and configurations in order to be transferred to an operational state. In software development, especially with container technologies such as Docker, the term is often used to describe the first step in setting up an application. Discourse bootstrapping, for example, involves loading and setting up a Docker container with all the necessary dependencies, such as databases and software components. The process ensures that the application can be started correctly without the need for manual intervention.

Depending on the performance of your hardware, Discourse’s bootstrapping takes between 2 and 8 minutes. Once the bootstrapping is complete, you can access your Discourse forum under your previously defined domain.

discourse install

Now you can register with the previously specified admin mail and receive a confirmation mail. Therefore the SMTP setup must also work.