(Last Updated On: February 23, 2019)

This guide will walk you through the installation of Discourse Forum Software on Ubuntu 18.04 LTS Bionic Beaver. Discourse is a free and open source, feature-rich software designed for creating community discussion forums, long-form chat rooms and mailing list for your company’s team, customers e.t.c.

What Powers Discourse

Discourse is built with:

  • Ruby on Rails — Our back end API is a Rails app. It responds to requests RESTfully in JSON.
  • Ember.js — Our front end is an Ember.js app that communicates with the Rails API.
  • PostgreSQL — Our main data store is in Postgres.
  • Redis — We use Redis as a cache and for transient data.

Hardware Requirements

Discourse has the following hardware requirements. This may vary depending on the number of users you expect to use the system.

  • Modern single core CPU, dual core recommended
  • 1 GB RAM minimum (with swap)
  • 64 bit Linux compatible with Docker
  • 10 GB disk space minimum

Other Requirements (Compulsary)

Follow steps below to Install Discourse on Ubuntu 18.04 LTS Bionic Beaver.

Step 1: Update Ubuntu 18.04 Server

We always start our installation by ensuring all system packages are up to date.

sudo apt update
sudo apt upgrade -y

Step 2: Install Docker

Run below commands to install the latest release of Docker which works fine for Discourse.

wget -qO- https://get.docker.com/ | sh

If you would like to use Docker as a non-root user, you should now consider adding your user to the “docker” group with:

sudo usermod -aG docker username

You can query for installed version using the command below.

$ docker version
Client:
Version: 18.09.2
API version: 1.39
Go version: go1.10.6
Git commit: 6247962
Built: Sun Feb 10 04:13:47 2019
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 18.09.2
API version: 1.39 (minimum version 1.12)
Go version: go1.10.6
Git commit: 6247962
Built: Sun Feb 10 03:42:13 2019
OS/Arch: linux/amd64
Experimental: false

Docker should be in a running status.

$ systemctl status  docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2019-02-23 08:55:15 CET; 1min 54s ago
Docs: https://docs.docker.com
Main PID: 28222 (dockerd)
Tasks: 8
CGroup: /system.slice/docker.service
└─28222 /usr/bin/dockerd -H fd://
Feb 23 08:55:14 ubuntu-2gb-nbg1-1 dockerd[28222]: time="2019-02-23T08:55:14.792931869+01:00" level=warning msg="Your kernel does not support swap memor
Feb 23 08:55:14 ubuntu-2gb-nbg1-1 dockerd[28222]: time="2019-02-23T08:55:14.793210296+01:00" level=warning msg="Your kernel does not support cgroup rt
Feb 23 08:55:14 ubuntu-2gb-nbg1-1 dockerd[28222]: time="2019-02-23T08:55:14.793354019+01:00" level=warning msg="Your kernel does not support cgroup rt
Feb 23 08:55:14 ubuntu-2gb-nbg1-1 dockerd[28222]: time="2019-02-23T08:55:14.795671966+01:00" level=info msg="Loading containers: start."
Feb 23 08:55:14 ubuntu-2gb-nbg1-1 dockerd[28222]: time="2019-02-23T08:55:14.946891414+01:00" level=info msg="Default bridge (docker0) is assigned with
Feb 23 08:55:15 ubuntu-2gb-nbg1-1 dockerd[28222]: time="2019-02-23T08:55:15.019658891+01:00" level=info msg="Loading containers: done."
Feb 23 08:55:15 ubuntu-2gb-nbg1-1 dockerd[28222]: time="2019-02-23T08:55:15.117287717+01:00" level=info msg="Docker daemon" commit=6247962 graphdriver(
Feb 23 08:55:15 ubuntu-2gb-nbg1-1 dockerd[28222]: time="2019-02-23T08:55:15.117884716+01:00" level=info msg="Daemon has completed initialization"
Feb 23 08:55:15 ubuntu-2gb-nbg1-1 systemd[1]: Started Docker Application Container Engine.
Feb 23 08:55:15 ubuntu-2gb-nbg1-1 dockerd[28222]: time="2019-02-23T08:55:15.153778133+01:00" level=info msg="API listen on /var/run/docker.sock"

Step 3: Configure Mail Server

You need a working email server or choose Recommended Email Providers for Discourse. Configure email server by:

  • Creating an email user account for Discourse
  • Configuring DKIM and SPF for your domain.

Postfix Server can also be used.

Step 4: Install Discourse on Ubuntu 18.04 Bionic Beaver

Now that Docker engine is installed and running, proceed to deploy Discourse on Ubuntu 18.04 Bionic Beaver.

1.Create a /var/discourse folder:

sudo mkdir /var/discourse

2.Clone the Official Discourse Docker Image into created directory.

sudo git clone https://github.com/discourse/discourse_docker.git /var/discourse

3. Bootstrap Discourse

Run the command below to launch Discourse setup tool.

sudo su -
cd /var/discourse

Run:

./discourse-setup

Provide Discourse domain name, admin email address, smtp email server, smtp port, smtp user name and password and optional email address for Let’s Encrypt.

Hostname for your Discourse? [discourse.example.com]: forum.example.com
Email address for admin account(s)?: [email protected],
SMTP server address? [smtp.example.com]:
SMTP port? [587]: 465
SMTP user name? [[email protected]]:
SMTP password? [pa$$word]: SMTPpassword
Optional email address for setting up Let's Encrypt? (ENTER to skip) [[email protected]]: [email protected]

This will setup Discourse and generate app.yml.

Step 5: Start Discourse

Once bootstrapping is complete, you should be able to access Discourse in your web browser using the domain name configured forum.example.com.

Click on the “Register” button to register a new account to get started.

Provide username and password for Admin account the click “Register“.

You should receive an email address with instructions on how to activate your account.

Rebuilding Discourse

Each time you make changes to containers/app.yml, you have to rebuild your Discourse application by running:

./launcher rebuild app

That’s all. Enjoy your forum powered by Discourse.