Discourse

How To Install Discourse on CentOS: A Step-by-Step Guide

Welcome to the Greenhost.cloud blog! In today’s post, we’ll be walking you through the process of installing Discourse, an open-source discussion platform, on a CentOS server. Discourse is a powerful tool for building online communities and forums, and with the right setup, you can have it running in no time. Whether you’re looking to foster user engagement or create a dedicated space for discussions, this guide will help you get started.

Prerequisites

Before we dive into the installation process, here are a few prerequisites you need to check:

  1. CentOS Server: Ensure you have a CentOS server (CentOS 7 or 8 is recommended) with root access. You can use a cloud provider like Greenhost to set up your server.
  2. Domain Name: You should have a domain name that points to your server’s IP address.
  3. Basic Knowledge: Familiarity with the command line and Linux terminal commands will be helpful.
  4. Software Requirements: Ensure you have the following software installed on your server:
  • Git
  • Docker
  • Docker Compose

Step 1: Update Your System

First, log in to your CentOS server via SSH and update your system packages:

sudo yum update -y

Step 2: Install Required Packages

Make sure you have curl and git installed:

sudo yum install curl git -y

Step 3: Install Docker

Discourse runs on Docker, so let’s install it:

  1. Add the Docker repository:
   sudo yum install -y yum-utils
   sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
  1. Install Docker:
   sudo yum install docker-ce -y
  1. Start and enable Docker:
   sudo systemctl start docker
   sudo systemctl enable docker
  1. Verify Docker installation:
   sudo docker --version

Step 4: Install Docker Compose

Next, install Docker Compose, which is used to manage multi-container Docker applications:

sudo curl -L "https://github.com/docker/compose/releases/download/$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d '\"' -f 2)/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Make it executable:

sudo chmod +x /usr/local/bin/docker-compose

Verify the installation:

docker-compose --version

Step 5: Create a Discourse Directory

Create a directory for Discourse and navigate into it:

mkdir ~/discourse
cd ~/discourse

Step 6: Clone the Discourse Docker Repository

Now, let’s clone the Discourse Docker repository:

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

Step 7: Configure Discourse

Before starting Discourse, you need to configure it:

  1. Copy the sample configuration:
   cp samples/standalone.yml containers/app.yml
  1. Edit the app.yml file:
   nano containers/app.yml

Update the following lines with your domain name and email settings:

   DISCOURSE_HOSTNAME: 'yourdomain.com'
   DISCOURSE_DEVELOPER_EMAILS: '[email protected]'

Make sure to replace yourdomain.com and [email protected] with your actual domain and email.

Step 8: Bootstrap Discourse

Now it’s time to bootstrap Discourse:

sudo ./launcher bootstrap app

This command will take some time as it downloads all necessary images and sets up the environment.

Step 9: Start Discourse

Once the bootstrap process is complete, start Discourse with the following command:

sudo ./launcher start app

Step 10: Complete the Installation

Finally, navigate to your domain name in a web browser:

http://yourdomain.com

You’ll be greeted by the Discourse setup wizard. Follow the prompts to complete your installation, set up your admin account, and configure your forum.

Conclusion

Congratulations! You’ve successfully installed Discourse on your CentOS server. With your new platform up and running, you can begin engaging with your community and facilitating discussions. If you encounter any issues during the installation process or have questions about configuring Discourse, feel free to reach out to us at Greenhost.cloud.

For more tutorials and insights, stay tuned to our blog. Happy discussing!