How to install a Discourse Forum
Tags: discourse
Published: 2023-04-26 05:11:51

---
title: How to install a Discourse Forum
description: Looking to create an engaged Community? Learn how to install a Discourse Forum on your own self-hosted server.
edition: 26 April 2023
created: 20230426
canonical_url: https://cleavr.io/cleavr-slice/how-to-install-a-discourse-forum
tags: discourse
---

If you're looking for a versatile and feature-rich community forum software, then [Discourse](https://www.discourse.org/) is a top choice. As an open-source platform, Discourse offers modern and responsive forum functionality that allows you to engage with your community or customers effectively. In this step-by-step guide, we will walk youthrough the process of installing Discourse for production use, so you can create a powerful and interactive community platform.

**Prerequisites**

Before installing Discourse, make sure you have the following
prerequisites in place:

1. A server or virtual machine running a compatible operating system,
   such as Ubuntu 22.04 or later, with sufficient resources (CPU,
   RAM, storage) to support a production-grade forum.

2. A domain name registered and configured to point to the IP address
   of your server. This is necessary for accessing your Discourse
   forum over the internet.

3. Ports 80 and 443 open on your server's firewall. Port 80 is used
   for HTTP traffic, while port 443 is used for HTTPS traffic. These
   ports need to be open to allow incoming web traffic to your
   Discourse instance.

4. An email server set up and configured to send emails for Discourse
   to function properly. Discourse relies on email notifications for
   user registration, password reset, and other important
   functionalities. So, having a functional email server is a
   prerequisite for installing Discourse.

Now, let's get started with the installation process.

## Step 1: Provision Your Server

The recommended server specs for running Discourse may vary depending on
the size of your community and the expected usage patterns. However, as
a general guideline, the Discourse team recommends the following minimum
server specifications for a production Discourse installation:

- CPU: Dual-core or higher, clocked at 2.0 GHz or higher
- RAM: 2 GB or higher
- Storage: 10 GB or higher of free disk space
- Operating System: Ubuntu 22.04 LTS or later, or another officially
  supported Linux distribution
- Database: PostgreSQL 13 or later
- Web Server: Nginx

In my case, I have used [Cleavr](https://cleavr.io/) to provision a plain [server](https://docs.cleavr.io/provision/). With [Cleavr](https://cleavr.io/), you can easily deploy and manage web applications, including Discourse, on your own server or a cloud provider of your choice. [Cleavr](https://cleavr.io/) provides a user-friendly interface, advanced server management features, and seamless integration with popular web servers, databases, and email services, making it an excellent choice for installing and managing Discourse for production use.


## Step 2: Install Discourse

Login to your server using [SSH](https://docs.cleavr.io/ssh-keys) and pull the official [Discourse github repository](https://github.com/discourse/discourse_docker) and start discourse setup. Run the following commands:

```
sudo mkdir /var/discourse
sudo git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
sudo ./discourse-setup
```

## Step 3: Configure Email

To enable notifications, password resets, and system alerts on
Discourse, configuring an email SMTP server is necessary. It is recommended to use established email service providers like SendGrid, Mailgun, or Amazon SES. Detailed setup instructions are available from the service providers or seek help from a professional.

Once you have obtained the API keys or SMTP credentials from your email service provider, you can proceed with the Discourse installation process and input the necessary information when prompted. This will allow your Discourse forum to send emails and provide a smooth experience for your forum users.

![email setup](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jndwzyygn7fxs8j91xi3.png)

Please note that using personal SMTP servers, such as those provided by Gmail, is not recommended for Discourse installations. It is against Gmail's terms of service to use their SMTP servers for mass mailing, which includes sending automated emails from a forum.

## Step 4: Access Discourse

Once the installation is complete, you can access your
Discourse forum by navigating to your domain name in your web browser. Discourse provides a web-based setup wizard to further configure your forum, including setting up categories, creating an admin account, and customizing your forum's appearance.

Upon successfully setting up your Discourse domain, you will be greeted with a congratulatory message to acknowledge the successful installation.

![Installation](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ne7o9eexdwhhxs383h99.png) 

Once you have completed the registration process and confirmed your admin email, you will receive a notification that your forum is now ready for use.

![Forum](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/umyh45ualuhfwjuiflcw.png)

## Step 5: Secure Your Discourse Instance

After installation, it's important to secure your Discourse instance to protect against potential security risks. Some recommended security
measures include:

- Enable HTTPS using a valid SSL certificate.
- Regularly update Discourse and its plugins to the latest versions.
- Configure strong and unique passwords for all user accounts.
- Set up firewall rules to allow only necessary incoming and outgoing
  traffic.
- Disable unnecessary services and features in Discourse that you don't use.

In conclusion, installing Discourse for production use
involves setting up a [Docker](https://www.docker.com/) container(handled automatically during discourse setup), configuring email, and securing your instance. By following the steps outlined in this guide, you can have a powerful and customizable community forum up and running in no time. Happy forum-ing!

- [Rabin Dhamala](https://github.com/rabinkmc)