How to install Discourse Forum in Ubuntu 22.04 LTS Jammy

How to install Discourse Forum in Ubuntu 22.04 LTS Jammy

Discourse is a free and open source forum platform which can be used to build for mailing list, discussion forum, customer support, gaming community, long-form chat room, and much more. It is also considered as the discussion platform for the next decade of the internet. Discourse is released under GNU GPL v2 or later license and is written in Ruby and JavaScript programming language. It is developed and maintained by the Civilized Discourse Construction Kit, Inc. based on United States.

In a Ubuntu 22.04 Jammy LTS server, we can easily install discourse in a production mode and start our own discussion platform. For that, we have listed the easy steps as follows.

Prepare your discourse domain

This is the first step that we need to fulfill before proceeding with the installation processes. We’ll need a domain like linuxrangers.com or a subdomain like discourse.linuxrangers.com or forum.linuxrangers.com as discourse doesn’t work with IP addresses. So, you’ll need a domain and point the DNS RR (Resource Record) to your fresh instance of Ubuntu 22.04 server.

Prepare your email server

Email is a critical service that discourse needs for notifications even on the initial user creation. You will need at least one email account with its configuration and credentials (SMTP) to install the discourse server. You can use your domain’s email configuration. If you need help with an email server, or need support from Linux rangers support team, you can always create a support ticket.

Install Docker

Discourse runs on docker container technology so, we’ll need to install docker in our Ubuntu 22.04 jammy server. To install docker, we’ll first need to make sure to ssh into our Ubuntu server.

$ ssh <username>@<serverip> -p <ssh_port>

Once we are inside the server, we will need to execute the following commands to install docker.

1. Remove old docker packages

$ sudo apt-get remove docker docker-engine docker.io containerd runc

2. Install docker’s prerequisites

$ sudo apt-get update
$ sudo apt-get install ca-certificates curl gnupg lsb-release

3. Install docker’s gpg key

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

4. Add docker’s Ubuntu repository

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

5. Install docker

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

Install Discourse

Now, once docker is up and running, we can clone the discourse repository from github and then perform the installation phase.

$ sudo -s
# git clone https://github.com/discourse/discourse_docker.git /var/discourse
# cd /var/discourse
# chmod 700 containers

Once the cloning is done, we’ll need to execute the discourse installer as follows.

# ./discourse-setup

Once these commands are executed, the installer will start and ask some vital information required for the proper installation of our Discourse instance. The installer will ask things like our discourse domain or subdomain name, email address, email configurations and credentials.

This process once completed will generate an app.yml configuration file and then starts the bootstrap process. The bootstrapping process usually takes between 2-8 minutes to complete. During the configuration, if we need to change any of the settings after bootstrapping, we can run ./discourse-setup again, otherwise your changes will not take effect.

discourse linux rangers boostraped

Once the installation is done, you can open your favorite web browser and open your discourse url. If everything goes as expected, you will see the above welcome screen. Now, you can create your fresh new user account.

Install and activate ufw firewall

As Ubuntu is mostly shipped with ufw preinstalled, we’ll need to activate it and allow http and https. If you don’t have ufw preinstalled, you can install by executing the following command.

$ sudo apt install ufw

Now, in order to activate and allow http and https services.

$ sudo ufw enable
$ sudo ufw allow ssh
$ sudo ufw allow http
$ sudo ufw allow https

Conclusion

These are the easy and straight forward steps on how we can install and start our own modern community forum. Discourse makes life easy to manage and develop a strong community whether it be a gaming community, customers support forum, mailing list or any thing that needs a discussion platform. If you have any questions, suggestions, feedback please don’t hesitate to write them in the comment box below because it will help us to improve or correct our contents. Happy Computing! 🙂

LinuxRangers Favicon
Editorial Staff

Editorial Staff writes and manages Linux articles.

1 thought on “How to install Discourse Forum in Ubuntu 22.04 LTS Jammy”

Leave a Comment

Your email address will not be published. Required fields are marked *