In this actice, We’ll install Discourse Forum on Ubuntu server. Also, we will provide you with some useful information about its usage. Let’s get started!
Discourse is a free and open-source Internet forum software. Features include support for categorization and tagging of discussions, configurable access control as well as usability improvements recently popularized by large social networks, such as live updates, expanding link previews, infinite scrolling, and real-time notifications. It is written in Ember.js and Ruby on Rails, and uses PostgreSQL for database back-end. It is a modern forum solution that powers discussions on thousands of sites to drive user engagement. You can create customizable questions and ideas, and integrate it with popular services.
Before we start with the installation there are a few requirements that need to be fulfilled:
Fresh install of Ubuntu server.
User privileges: root or non-root user with sudo privileges
DNS: Pointed A record of domain or subdomain to your server IP address
Email Relay: SMTP mail server. If you don't have mail server, you can use Gmail SMTP server.
Step 1. Update the System
Fresh installation of Ubuntu 20.04 requires the latest software updates. Execute the following command to update the system to its latest version:
sudo apt update -y && sudo apt upgrade -y
Step 2. Install Docker Container
As we mentioned before we will install Discourse in an isolated docker environment. Docker by default is available in Ubuntu 20.04 and we just need to execute the following commands to install it:
sudo apt-get install docker.io -y
Once, the installation is complete start the docker service:
sudo systemctl start docker
After starting the service, you need to enable it with the following command:
sudo systemctl enable docker
To check that the service is up and running, in the terminal execute the command below:
sudo systemctl status docker
You should see the following output:
root@vps:~# 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 2021-10-28 17:52:17 UTC; 1h 14min ago TriggeredBy: ● docker.socket Docs: https://docs.docker.com Main PID: 63601 (dockerd) Tasks: 32 Memory: 1.8G CGroup: /system.slice/docker.service ├─ 63601 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock ├─274057 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 443 -container-ip 172.17.0.2 -container-port 443 └─274071 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 80 -container-ip 172.17.0.2 -container-port 80 Oct 28 19:03:56 vps.example.com dockerd: time="2021-10-28T19:03:56.213105991Z" level=info msg="ignoring event" container=1baae1c7e1acfab1fd0bc326a021964b0b02257932a70e5a6100e7ff520e318c> Oct 28 19:03:58 vps.example.com dockerd: time="2021-10-28T19:03:58Z" level=warning msg="file does not exist: /proc/sys/net/ipv6/conf/all/disable_ipv6 : stat /proc/sys/net/ipv6/conf/all> Oct 28 19:04:31 vps.example.com dockerd: time="2021-10-28T19:04:31.892373712Z" level=info msg="ignoring event" container=1baae1c7e1acfab1fd0bc326a021964b0b02257932a70e5a6100e7ff520e318c>
Step 3. Download and Install Discourse
Before we download the installation file for Discourse we will make a separate director for it:
sudo mkdir /var/www/discourse/
Clone the discourse with the command bellow:
sudo git clone https://github.com/discourse/discourse_docker.git /var/www/discourse/
Go into the newly created directory and execute the command for installing Discourse
cd /var/www/discourse/ ./discourse-setup
After executing the command for discourse setup, there will be a couple of inputs that need to be entered such as hostname, email address for 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.yourdomain.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.yourdomain.com SMTP port? : SMTP user name? [firstname.lastname@example.org]: email@example.com SMTP password? [pa$word]: yourstrongpassword 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.yourdomain.com Email : firstname.lastname@example.org SMTP address : smtp.yourdomain.com SMTP port : 587 SMTP username : email@example.com SMTP password : yourstrongpassword Let's Encrypt : firstname.lastname@example.org ENTER to continue, 'n' to try again, Ctrl+C to exit:
Hit “Enter” to approve them and allow some time for the installation to complete.
Once the installation is completed you can check that the docker container is running properly:
root@vps:~# docker ps
You should see the following output:
#root@vps:~# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 1baae1c7e1ac local_discourse/app "/sbin/boot" 47 minutes ago Up 16 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp app
Step 4. Access The Web Interface
Access the discourse in the browser: https://discourse.yourdomain.com
Now, you need to click on the “Register” button and another form will open for Email, Username and Password.
The final step is to check your mailbox to confirm your administrator account creation.
Congratulations! You successfully installed Discourse on Ubuntu Server.
You can now start managing your Discourse forum and let users sign up. You can learn more about Discourse’s features on the official Discourse About page.