Install Discourse on Rocky Linux

This tutorial will show you how to install Discourse on Rocky Linux. Discourse is an free and open source discussion platform, chatting and mailing list to allow you to collaborate with your team especially in a work environment. Discourse uses Ruby on Rails, Ember.js and PostgreSQL as a backend language, frontend language and database respectively.

Install Discourse on Rocky Linux

Prerequisites

  • A valid domain name or hostname
  • An SMTP mail server set up
  • Root privileges- all commands will be run using root as a user
  • Docker installed

Install Docker on Rocky Linux

Update system packages

 dnf update && dnf upgrade -y

Install required tools

dnf install -y git yum-utils device-mapper-persistent-data lvm2

Set up docker repository

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

Install docker

yum install docker-ce

In case you get an error when running the command yum install docker-ce add the flag below

yum install docker-ce --allowerasing

Start docker

systemctl start docker

Check if docker is running

systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor pre>
   Active: active (running) since Thu 2022-06-30 06:39:03 EAT; 33min ago
     Docs: https://docs.docker.com
 Main PID: 3487 (dockerd)
    Tasks: 11
   Memory: 88.8M
   CGroup: /system.slice/docker.service
           └─3487 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/contai>

Jun 30 06:43:50 discourse.itnixpro.com dockerd[3487]: time="2022-06-30T06:43:50>
Jun 30 06:43:53 discourse.itnixpro.com dockerd[3487]: time="2022-06-30T06:43:53>
Jun 30 06:43:55 discourse.itnixpro.com dockerd[3487]: time="2022-06-30T06:43:55>
Jun 30 06:43:58 discourse.itnixpro.com dockerd[3487]: time="2022-06-30T06:43:58>
Jun 30 06:44:01 discourse.itnixpro.com dockerd[3487]: time="2022-06-30T06:44:01>
Jun 30 06:44:03 discourse.itnixpro.com dockerd[3487]: time="2022-06-30T06:44:03>
Jun 30 06:44:06 discourse.itnixpro.com dockerd[3487]: time="2022-06-30T06:44:06>
Jun 30 06:44:20 discourse.itnixpro.com dockerd[3487]: time="2022-06-30T06:44:20>
Jun 30 06:44:23 discourse.itnixpro.com dockerd[3487]: time="2022-06-30T06:44:23>
Jun 30 06:44:27 discourse.itnixpro.com dockerd[3487]: time="2022-06-30T06:44:27>

Configure SELinux policy

Check the current mode

setstatus

If SELinux policy is enforced as it is in Rocky Linux by default, set the current mode to permissive to disable it at system reboot.

sudo setenforce 0

To disable the mode completely, use the command

sudo sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config

Then reboot the system

reboot

Install Discourse on Rocky Linux

Create a folder to store Discourse files.

mkdir -p /opt/discourse/

Clone the discourse repository to the directory above:

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

Navigate to the same directory

cd /opt/discourse/ 

Run Discourse setup to start installation

./discourse-setup

The setup will request you to enter correct configurations for Discourse. First enter a valid domain i.e. discourse.itnixpro.com

./discourse-setup
Ports 80 and 443 are free for use
'samples/standalone.yml' -> 'containers/app.yml'
Found 3GB of memory and 1 physical CPU cores
setting db_shared_buffers = 768MB
setting UNICORN_WORKERS = 2
containers/app.yml memory parameters updated.

Hostname for your Discourse? [discourse.example.com]: discourse.itnixpro.com

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

I have skipped inputting 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]: [email protected]
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 the configuration 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     : [email protected]
Notification email: [email protected]
Maxmind license: (unset)

Once installation completes, an app.yaml configuration will be created.

In case you make changes to this file /opt/discourse/containers/app.yml which stores the configurations, ensure you rebuild the app to apply changes.

 ./launcher rebuild app

Connection through firewall

Rocky Linux has a firewall running by default. Thus, allow connection through firewall for http and https before proceeding.

sudo firewall-cmd --permanent --add-service={http,https}

Reload the firewall

sudo firewall-cmd --reload

Access Discourse Web Interface

Type the URL http(s)://discourse.itnixpro.com in your browser. Register an admin account.

Install Discourse on Rocky Linux
Register

Click on Register and enter the admin account details.

Install Discourse on Rocky Linux
Register an admin account

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

Install Discourse on Rocky Linux
Confirm your email

That is it! You have managed to install Discourse in Rocky Linux .

Upgrade Discourse

To upgrade Discourse, navigate to Discourse directory

cd /opt/discourse/

Download the latest version and rebuild the app to apply changes

git pull
./launcher rebuild app

How to uninstall Discourse from Rocky Linux

Check the container ID by running the command:

docker ps
CONTAINER ID   IMAGE                              COMMAND                  CREATED          STATUS          PORTS     NAMES
f99383e9fd7a   discourse/base:2.0.20220621-0049   "/bin/bash -c '/usr/…"   28 minutes ago   Up 28 minutes             confident_kare

Next, stop the container using the ID above.

docker stop container f99383e9fd7a   

Now, delete the container using the same ID

docker container rm CONTAINER f99383e9fd7a   

Conclusion

You have come to the end of this tutorial. Now that you have managed to install Discourse in Rocky Linux, 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