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
Access your VPS as root
Connect to your server using SSH via the Terminal on Mac or Bitvise SSH Client/PuTTY on Windows.
Replace 220.127.116.11 with your server IP.
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:
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
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 https://download.docker.com/linux/$(. /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] https://download.docker.com/linux/$(. /etc/os-release; echo "$ID") $(lsb_release -cs) stable"
Update apt again.
apt-get install docker-ce -y
apt install git -y
Make a folder called discourse in the /var directory:
Clone the official Discourse Git repository in /var/discourse
git clone https://github.com/discourse/discourse_docker.git /var/discourse
Go into the discourse directory:
Launch the setup tool:
Answer the following questions when prompted:
Hostname for your Discourse? [discourse.anydomain.com]: Email address for admin account(s)? [email@example.com,firstname.lastname@example.org]: SMTP server address? [smtp.anydomain.com]: SMTP port? : SMTP user name? [email@example.com]: SMTP password? [pa$$word]: Let's Encrypt account email? (ENTER to skip) [firstname.lastname@example.org]:
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.