Install Discourse on Debian 11

This article has been created to show you how to install Discourse on Debian 11. Discourse is an open-source discussion forum and mailing list allowing you to collaborate with your team in a work environment. Discourse was written in Ruby on Rails as a backend language, Ember.js as a frontend, and uses PostgreSQL for data storage.

Cool features of Discourse include but not limited to two-factor authentication, social login, spam blocking, single sign on, emojis.

Install Discourse on Debian 11

Prerequisites

  • A valid domain name or hostname
  • An SMTP mail server set up
  • Root privileges
  • Docker installed

Install Docker on Debian 11

Update system packages first

 sudo apt update

Install required packages:

 sudo apt install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

Create a folder to store GPG keys

 sudo mkdir -p /etc/apt/keyrings

Setup a stable repository:

 curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
 echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update the system packages once more:

sudo apt update

Install docker

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

Install Discourse on Debian 11

Create a folder to store Discourse files.

mkdir -p /var/discourse/

Clone the discourse repository:

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

Go to the directory created above:

cd /var/discourse/ 

Run Discourse setup to install it.

./discourse-setup

The setup will prompt you to enter correct configurations. To begin with, enter a valid domain i.e. discourse.itnixpro.com

./discourse-setup
Does this look right?

Hostname          : discourse.itnixpro.com
Email             : [email protected]
SMTP address      : smtp.gmail.com
SMTP port         : 587
SMTP username     : [email protected]
SMTP password     : ITn1xPr0@2O22
Notification email: [email protected]
Maxmind license: (unset)

Next setup details for Let’s Encrypt. Provide an email address for admin account, SMTP address, SMTP port, SMTP username, SMTP password and email address for notification and Let’s Encrypt (optional) and press enter.

I will not enter notification email, Let’s Encrypt email and Maxmind license key

Checking your domain name . . .
Connection to discourse.itnixpro.com succeeded.
Email address for admin account(s)? [[email protected],[email protected]]: [email protected]
SMTP server address? [smtp.example.com]: smtp.gmail.com
SMTP port? [587]: 587
SMTP user name? [[email protected]]: [email protected]
SMTP password? [pa$$word]: ITn1xPr0@2O22
notification email address? [[email protected]]: 
Optional email address for Let's Encrypt warnings? (ENTER to skip) [[email protected]]: 
Optional Maxmind License key (ENTER to continue without MAXMIND GeoLite2 geolocation database) [1234567890123456]: 

Confirm that the details you have entered are correct and press enter to continue.

Does this look right?

Hostname          : discourse.itnixpro.com
Email             : [email protected]
SMTP address      : smtp.gmail.com
SMTP port         : 587
SMTP username     : [email protected]
SMTP password     : ITn1xPr0@2O22
Notification email: [email protected]
Maxmind license: (unset)

Wait for installation to complete. An app.yml configuration file will be generated.

Remember to rebuild your app every time you edit the file /var/discourse/containers/app.yml using the command:

 ./launcher rebuild app

Access Discourse Web Interface

In your browser, type the URL or http://your.host.name i.e http://discourse.itnixpro.com. You will be asked to register an admin account.

Install Discourse on Debian 11
Register

Click on Register and enter the admin account details on the next page.

Install Discourse on Debian 11
Register an admin account

Check the email you provided and follow the instructions to activate your account

Install Discourse on Debian 11
Confirm your email

From there, you can set up few things and continue to use Discourse. That is it! You have managed to install Discourse in Debian 11.

Upgrade Discourse

To upgrade Discourse, move to Discourse directory

cd /var/discourse/

Get the latest version and rebuild the app to apply changes

git pull
./launcher rebuild app

How to uninstall Discourse from Debian 11

First check the container ID by running the command:

docker ps
CONTAINER ID   IMAGE                 COMMAND        CREATED          STATUS          PORTS                                                                      NAMES
e32f658cac7f   local_discourse/app   "/sbin/boot"   53 minutes ago   Up 53 minutes   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   app

Next, stop the container using the ID above.

docker stop container e32f658cac7f   

Finally, delete the container using the same ID

docker container rm CONTAINER e32f658cac7f   

Conclusion

You have been able to install Discourse on Debian 11. Find out more features and how to use Discourse from the Discourse official website.

Similar interesting tutorials

Install Mattermost on Ubuntu 22.04

Install LAMP Stack on OpenSUSE

Install PHP 8 on OpenSUSE

Install MS Teams App on OpenSUSE

Android Developer | Linux | Technical Writer | Backend Developer

Leave a Comment