How to Install Discourse on Ubuntu 18.04

Introduction

Before we begin talking about how to install Discourse on Ubuntu 18.04, let’s briefly understand - What is Discourse?

Discourse is a versatile online platform for interactive discussions and community engagement. With user-friendly features and a modern interface, it fosters meaningful conversations. It promotes collaboration, knowledge sharing, and problem-solving among participants.

Discourse enhances user experience and encourages active participation in diverse topics. Join Discourse to connect, learn, and exchange ideas with like-minded individuals in a vibrant virtual community.

In this tutorial, you will install Discourse in an independent environment with the help of a containerization application named Docker. Also, we will answer some FAQs regarding the Docker Compose installation.

Advantages of Discourse

  1. Engaging Interface: Discourse's modern design encourages active participation and enjoyable user experiences.
  2. Collaboration: It fosters meaningful discussions and problem-solving among community members.
  3. User-Friendly: The platform is intuitive and easy to navigate for seamless interactions.
  4. Knowledge Sharing: Discourse promotes the exchange of valuable information and insights among participants.
  5. Versatility: From casual chats to professional forums, it accommodates diverse topics and interests.

Prerequisites to Install Discourse on Ubuntu 18.04

Before getting started, you would need the following:

  • An Ubuntu 20.04 server having at least 2GB of RAM, a sudo non-root user, and a firewall.
  • Docker, already installed on the server. You can follow the steps mentioned here, to accomplish this.
  • Domain or a sub-domain with an available A record pointed at your server’s IP address. This tutorial will use discourse.your_domain.
  • SMTP mail server. You can choose to make a free account on Mailgun, if you don't want to run your own mail server.

Step 1 - Download Discourse

1) You need to create a /var/discourse directory, where all the Discourse related files will be located.

sudo mkdir /var/discourse

2) Now, you've to clone the official Discourse Docker Image into /var/discourse.

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

Once the Discourse Docker image is in place, you can proceed to the installation process.

Step 2 - Install and Configure Discourse

1) Navigate to the /var/discourse directory with the help of the following command:

cd /var/discourse

2) After that, launch the included setup script.

sudo ./discourse-setup

3) This will be followed by the installation script asking a few questions.

  • A Hostname for your Discourse?

Enter discourse.your_domain, or the hostname you’ve chosen.

  • Email address for the admin account?

You can put in an email address of your choice here.

ℹ️
This email address will be the Discourse administrator default which you'll have to reuse for setting up Discourse.
  • SMTP server address?
  • SMTP user name?
  • SMTP port?
  • SMTP password?

You have to put in your SMTP details as the answer to the above questions. For Mailgun, the SMTP server address will be smtp.mailgun.org. The username and password can be found under Mailgun's Domains tab.

4) Finally, the installation script will ask you to confirm the details and on the confirmation, it will generate a configuration file: app.yml. The installation will proceed automatically post this.

ℹ️
If you have to alter or rectify these settings after installation, edit your /containers/app.yml file and run ./launcher rebuild app. Otherwise, your changes would be unaffected.

The installation will take somewhere around 2-8 minutes, post which, you can open a web browser and create an administrator account.

Step 3 - Register the Administrator account

1) After that, visit discourse.your_domain on your web browser, you will see the Discourse 'Congrats' splash screen.

Discourse Splash Screen

In case you come across a Bad Gateway error, wait for a couple of minutes and then refresh the page. This might be because the installation hasn't been completed.

Once the page loads, click the Register button which would give way to a form titled Register Admin Account with the following fields:

  • Email: Choose the email you provided initially from the pull-down menu.
  • Username: Choose a username.
  • Password: Choose an apt password

2) After that, click the Register button, to reveal a dialog box that says Confirm Email address. Check your inbox for the activation mail. If you fail to find it, try hitting the Resend Activation Email button. In case you are still not able to receive one, visit the Discourse email troubleshooting checklist.

3) Post-registration, you'll be guided through basic Discourse configuration by the setup wizard. You can choose to skip it by clicking Maybe Later.

Discourse Welcome Screen

4) On completing or skipping the setup wizard you'll see certain headings and Discourse’s Admin Quick Start Guide. The Quick Start Guide is labeled as Read Me First. It contains tips for you to customize your installation.

Discourse’s Admin Quick Start Guide

5) Discourse is now ready to be used on your system. For installing the latest version, you have to use the following command by getting the latest version details from the Git repo and rebuilding the app.

cd /var/discourse
sudo git pull
sudo ./launcher rebuild app

6) You can alternatively choose to visit http://discourse.your_domain/admin/upgrade, click on Upgrade to the latest version, and follow the given instructions.

Discourse Upgrade Screen

FAQs to Install Discourse on Ubuntu 18.04

What are the system requirements for Discourse on Ubuntu 18.04?

The recommended system requirements include a 64-bit processor, 2GB RAM, and 10GB free disk space.

Does Discourse require any dependencies to be installed?

Yes, Discourse relies on Docker and Docker Compose, which need to be installed before the setup.

Can I host Discourse on a virtual private server (VPS)?

Yes, you can host Discourse on a VPS, ensuring it meets the system requirements.

What are the recommended web servers for Discourse on Ubuntu 18.04?

Discourse runs on Nginx, which is recommended for optimal performance.

Can I customize the appearance and functionality of my Discourse forum?

Yes, Discourse offers a wide range of customization options to tailor your forum according to your preferences.

How can I update Discourse to the latest version on Ubuntu 18.04?

You can follow the official Discourse guide to update your installation using the command-line interface.

Can I migrate an existing Discourse installation to a new server?

Yes, you can migrate an existing Discourse installation to a new server. The process typically involves transferring the Discourse files and database, updating DNS settings (if necessary), and configuring the new server to match the original setup.

Conclusion

We hope this detailed tutorial helped you understand how to install Discourse on Ubuntu 18.04 server. To learn more about Discourse installation on Ubuntu 18.04 server, check out the official Discourse documentation.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.