Discourse is an open-source platform used for discussions forum, chat rooms, or as a mailing list management software. It is a modern forum solution that powers discussions on thousands of sites to drive user engagement. Discourse was written in Ruby on Rails as a backend language, Ember.js as a frontend, and uses PostgreSQL for data storage.
In this context, we shall look into how to install Discourse on Ubuntu 20.04 LTS.
Steps to Install Discourse on Ubuntu 20.04 LTS Focal Fossa
1. Perform System Update
To begin, ensure that all your system packages are up-to-date by running the following apt commands in the terminal.
$ sudo apt update
$sudo apt upgrade
Next, install net-tools with the below command:
$ sudo apt install net-tools
2. Install Docker
Now we install the latest version of Docker to your system using the following command below:
$ sudo apt install docker.io
Once the Docker is installed, start the Docker service and enable it to start at reboot with the following command:
$ sudo systemctl start docker
$ sudo systemctl enable docker
3. Install Discourse on the system
By default, Discourse is not available Ubuntu 20.04 base repository. Now run the following command below to download the latest version of Discourse from the GitHub repository:
$ sudo mkdir /var/www/discourse/
$ git clone https://github.com/discourse/discourse_docker.git /opt/discourse
Next, change the directory to /opt/discourse and run the Discourse setup script:
$ cd /opt/discourse
The Discourse installation script will ask the following questions:
Ports 80 and 443 are free for use
'samples/standalone.yml' -> 'containers/app.yml'
Found 16GB of memory and 4 physical CPU cores
setting db_shared_buffers = 1024MB
setting UNICORN_WORKERS = 6
containers/app.yml memory parameters updated.
Hostname for your Discourse? [discourse.linuxapt.com]: discourse.linuxapt.com
Next, you will be asked to provide an email address for the admin account, SMTP server, SMTP username, SMTP password, and email address for Let’s Encrypt as shown below:
Checking your domain name . . .
Connection to discourse.linuxapt.com succeeded.
Email address for admin account(s)? [email@example.com,firstname.lastname@example.org]: email@example.com
SMTP server address? [smtp.example.com]: smtp.gmail.com
SMTP port? :
SMTP user name? [firstname.lastname@example.org]: email@example.com
SMTP password? [pa$$word]: m3ilan4m4ri4
Optional email address for Let's Encrypt warnings? (ENTER to skip) [firstname.lastname@example.org]: email@example.com
Once you enter these values, there will be another window to check them again:
Does this look right?
Hostname : discourse.linuxapt.com
Email : firstname.lastname@example.org
SMTP address : smtp.gmail.com
SMTP port : 587
SMTP username : email@example.com
SMTP password : asdfgsd
Let's Encrypt : firstname.lastname@example.org
ENTER to continue, 'n' to try again, Ctrl+C to exit:
How to access Discourse Web Interface ?
Once successfully installed, open your web browser and access the Discourse using the URL http://discourse.linuxapt.com. You will be redirected to the Discourse registration page.
How to uninstall Discourse from Ubuntu Linux system ?
To uninstall discourse, you will have to completely wipe out the docker container in which discourse is installed.
1. Stop docker container
First step is to stop the running discourse container.
The following command will give you a list of all the containers that are up and running:
$ docker ps
In our case, only one container is running which is a discourse container. To stop it, run the following command:
$ Docker stop CONTAINER ID
Copy the container ID and place it in the command and run. This will stop the container
2. Delete the container
Now that the container has stopped, we can easily remove it with the help of the following command:
$ Docker container rm CONTAINER ID
After this, discourse from your system will be successfully uninstalled.