We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Install Discourse on Ubuntu 22.04|20.04|18.04

Learn how to – How To Install Discourse on Ubuntu 22.04|20.04|18.04.

This guide will walk you through the installation of Discourse Forum Software on Ubuntu Linux system. Discourse is a free and open source, feature-rich software designed for creating community discussion forums, long-form chat rooms and mailing list for your company’s team, customers e.t.c. It is built using Ruby on Rails and Ember.js, and can be hosted on your own server or as a service through a third-party provider

Discourse is built with:

  • Ruby on Rails – Our back end API is a Rails app. It responds to requests RESTfully in JSON.
  • Ember.js – Our front end is an Ember.js app that communicates with the Rails API.
  • PostgreSQL – Our main data store is in Postgres.
  • Redis – We use Redis as a cache and for transient data.

Some of the features of Discourse include:

  • A responsive design that works well on both desktop and mobile devices
  • A rich text editor that makes it easy to format posts and add media
  • Advanced moderation and spam protection tools
  • Support for multiple languages
  • Customizable email notifications
  • An API that allows developers to build integrations with other systems

Hardware Requirements

Discourse has the following hardware requirements. This may vary depending on the number of users you expect to use the system.

  • Modern single core CPU, dual core recommended
  • 1 GB RAM minimum (with swap)
  • 64 bit Linux compatible with Docker
  • 10 GB disk space minimum

Other Requirements (Compulsary)

Follow steps below to Install Discourse on Ubuntu Linux system.

Step 1: Update Ubuntu Server

We always start our installation by ensuring all system packages are up to date.

sudo apt update
sudo apt upgrade -y

Step 2: Install Docker Engine

Run below commands to install the latest release of Docker which works fine for Discourse.

wget -qO- https://get.docker.com/ | sh

If you would like to use Docker as a non-root user, you should now consider adding your user to the “docker” group with:

sudo usermod -aG docker $USER
newgrp docker

You can query for installed version using the command below.

$ docker version
Client: Docker Engine - Community
 Version:           20.10.22
 API version:       1.41
 Go version:        go1.18.9
 Git commit:        3a2c30b
 Built:             Thu Dec 15 22:28:08 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.22
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.18.9
  Git commit:       42c8b31
  Built:            Thu Dec 15 22:25:58 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.14
  GitCommit:        9ba4b250366a5ddde94bb7c9d1def331423aa323
 runc:
  Version:          1.1.4
  GitCommit:        v1.1.4-0-g5fd4c4d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
...

Docker should be in a running status.

$ systemctl status  docker
 docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2023-01-05 16:15:28 UTC; 38s ago
TriggeredBy: ● docker.socket
       Docs: https://docs.docker.com
   Main PID: 3729 (dockerd)
      Tasks: 7
     Memory: 21.6M
     CGroup: /system.slice/docker.service
             └─3729 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock

Jan 05 16:15:28 server dockerd[3729]: time="2023-01-05T16:15:28.085391080Z" level=warning msg="Your kernel does not support CPU realtime scheduler"
Jan 05 16:15:28 server dockerd[3729]: time="2023-01-05T16:15:28.085602617Z" level=warning msg="Your kernel does not support cgroup blkio weight"
Jan 05 16:15:28 server dockerd[3729]: time="2023-01-05T16:15:28.085800033Z" level=warning msg="Your kernel does not support cgroup blkio weight_device"
Jan 05 16:15:28 server dockerd[3729]: time="2023-01-05T16:15:28.086343753Z" level=info msg="Loading containers: start."
Jan 05 16:15:28 server dockerd[3729]: time="2023-01-05T16:15:28.281407771Z" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to>
Jan 05 16:15:28 server dockerd[3729]: time="2023-01-05T16:15:28.371426726Z" level=info msg="Loading containers: done."
Jan 05 16:15:28 server dockerd[3729]: time="2023-01-05T16:15:28.400215239Z" level=info msg="Docker daemon" commit=42c8b31 graphdriver(s)=overlay2 version=20.10.22
Jan 05 16:15:28 server dockerd[3729]: time="2023-01-05T16:15:28.400833884Z" level=info msg="Daemon has completed initialization"
Jan 05 16:15:28 server systemd[1]: Started Docker Application Container Engine.
Jan 05 16:15:28 server dockerd[3729]: time="2023-01-05T16:15:28.455021718Z" level=info msg="API listen on /run/docker.sock"

Step 3: Configure Mail Server

You need a working email server or choose Recommended Email Providers for Discourse. Configure email server by:

  • Creating an email user account for Discourse
  • Configuring DKIM and SPF for your domain.

Postfix Server can also be used.

Step 4: Install Discourse on Ubuntu Server

Now that Docker engine is installed and running, proceed to deploy Discourse on Ubuntu Linux system.

1.Create a /var/discourse folder:

sudo mkdir /var/discourse

2.Clone the Official Discourse Docker Image into created directory.

sudo git clone https://github.com/discourse/discourse_docker.git /var/discourse

3. Bootstrap Discourse

Run the command below to launch Discourse setup tool.

sudo su -
cd /var/discourse

Run:

./discourse-setup

Provide Discourse domain name, admin email address, smtp email server, smtp port, smtp user name and password and optional email address for Let’s Encrypt.

Hostname for your Discourse? [discourse.example.com]: forum.example.com
Email address for admin account(s)?: admin@example.com,
SMTP server address? [smtp.example.com]:
SMTP port? [587]: 465
SMTP user name? [user@example.com]: 
SMTP password? [pa$$word]: SMTPpassword
Optional email address for setting up Let's Encrypt? (ENTER to skip) [me@example.com]: admin@example.com

This will setup Discourse and generate app.yml.

Step 5: Start Discourse

Once bootstrapping is complete, you should be able to access Discourse in your web browser using the domain name configured forum.example.com.

Click on the “Register” button to register a new account to get started.

Provide username and password for Admin account the click “Register“.

You should receive an email address with instructions on how to activate your account.

Rebuilding Discourse

Each time you make changes to containers/app.yml, you have to rebuild your Discourse application by running:

./launcher rebuild app

That’s all. Enjoy your forum powered by Discourse.

10
622.003,40