How to Install Discourse on Debian 9-10 and Configuration SMTP


Discourse is the 100% open source discussion platform built for the next decade of the Internet. Use it as a mailing list, discussion forum, long-form chat room, and more!

In this tutorial, we will learn how to install and configure Discourse forum on Debian 9 server and Configuration SMTP with Sendinblue to receive activation email admin.

Create a new VPS

I recommend that you use VPS capacity at least 2GB RAM to avoid some errors during the installation.

Access your VPS as root

Connect to your server using SSH via the Terminal on Mac or Bitvise SSH Client/PuTTY on Windows.

Replace with your server IP.

Setup swap

Create an empty swap file:

install -o root -g root -m 0600 /dev/null /swapfile

Write out a 2GB file named swapfile:

dd if=/dev/zero of=/swapfile bs=1k count=2048k

Tell Linux that this is the swap file:

mkswap /swapfile

Activate it:

swapon /swapfile

Add it to the system table so that it is available after reboot:

echo "/swapfile swap swap auto 0 0" | tee -a /etc/fstab

Set the swappiness so that it is only used as an emergency buffer:

sysctl -w vm.swappiness=10

Install Docker CE

Update apt.

apt-get update

Install packages to allow apt to use a repository over HTTPS.

apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y

Add Docker’s official GPG key.

curl -fsSL$(. /etc/os-release; echo "$ID")/gpg | sudo apt-key add -

Verify that key fingerprint is equal to: 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88

apt-key fingerprint 0EBFCD88

Use the following command to set up the stable repository.

add-apt-repository "deb [arch=amd64]$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable"

Update apt again.

apt-get update

Install Docker.

apt-get install docker-ce -y

Install Git.

apt install git -y

Make a folder called discourse in the /var directory:

mkdir /var/discourse

Clone the official Discourse Git repository in /var/discourse

git clone /var/discourse

Go into the discourse directory:

cd /var/discourse

Launch the setup tool:


Answer the following questions when prompted:

Hostname for your Discourse? []: 
Email address for admin account(s)? [,]: 
SMTP server address? []: 
SMTP port? [587]: 
SMTP user name? []: 
SMTP password? [pa$$word]: 
Let's Encrypt account email? (ENTER to skip) []:

I use SMTP Service from Sendinblue (You can also choose the SMTP service from other providers)
Create Account Sendinblue, login and go to “SMTP & API” –> “SMTP” tab

This will generate an app.yml configuration file on your behalf, and then kick off bootstrap. If you need to change these settings after bootstrapping, you can run ./discourse-setup again (it will read your old values from the file) or edit containers/app.yml with Nano and then run ./launcher rebuild app for your changes to take effect.

You might also like
Notify of

Inline Feedbacks
View all comments