ManagedCloud Servers

High performance handled and monitored by us 24/7/365. A complete solution to provide you with our in house expertise 24/7 tailored to your specific needs. We'll setup a bespoke server for your site using the latest tehnologies so you can get the most out of your hardware and get your website loading quickly and reliably. Find out more..

cPanelCloud Servers

Recommended - High performance cloud servers with no technical knowledge required. If you're hosting multiple websites already and you're looking to consolidate, or if you're looking to isolate yourself from the shared hosting environment but you don't have the time or knoweldge to manage a server, then the Managed cPanel Servers are for you. Find out more..

UnmanagedCloud Servers

Our unmanaged range gives you complete control at rock bottom prices and our cloud platform boasts super fast multipath 40Gb/s network, the latest Intel Xeon V3 CPUs and enterprise grade redundant SSDs. If you're a sysadmin look no further, we offer some of the best specification to price ratio servers available. Find out more..

Want your very own server? Get our 1GB memory, Xeon V4, 20GB SSD VPS for £10.00 / month.

View Plans

Install Discourse Community Forum on CentOS 7

Discourse is a free and open source community forum. Unlike other discussion forums, Discourse has a modern look and feel, it is also responsive. Discourse comes with many features such as community moderation, summarize topics and inline context. Discourse is available in more than 25 languages.

Discourse also features real time notifications, an overlay editor, desktop notifications, file attachments and much more. You can also configure Discourse for social logins and single sign on. It is SEO friendly and comes with many plugins to extend its features. Discourse is used by many prominent companies for community forums like New Relic, Twitter developers forum etc.

In this tutorial we will be installing Discourse community forum on CentOS 7 using Docker.


To install Discourse Community Forum you will need a server or VPS with at least 1 GB RAM which is enough to serve small to moderate forum. To follow this tutorial you will need a minimal CentOS 7 installation with sudo or root access on it. If you are logged in as non root user run sudo -i to switch to the root account. Additionally, you will also need a domain name or subdomain pointed towards your server.

Installing Discourse

Before installing any package it is recommended that you update the packages and repository using the following command.

yum -y update

Now you will need to install git. Run the following command to do so.

yum -y install git

Discourse needs a 2GB Swap file if you have a VPS with 2GB RAM or less. You can skip this step if you have more than 2 GB RAM. Run the following command to check if you already have a swap file created.

swapon -s

If you do not have a swap created, the command will not print any output. Now create a swap file of 2GB in root directory using following command.

dd if=/dev/zero of=/swapfile count=2048 bs=1MiB

It will take few seconds to create the swap file. You will get following output.

[root@liptan-pc ~]# dd if=/dev/zero of=/swapfile count=2048 bs=1MiB
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB) copied, 29.8985 s, 71.8 MB/s

Once done, modify the file permissions so that the swap file is only readable to the root account using following command.

chmod 600 /swapfile

Now tell the system to set up the swap space using following command.

mkswap /swapfile

You should get following output.

[root@liptan-pc ~]# mkswap /swapfile
Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=b26c5ac6-6c5a-4a0b-9776-aaf3fd72f18b

Now make the swap file permanent by editing /etc/fstab file in your favorite editor.

nano /etc/fstab

If you don't have nano install, run yum -y install nano to install nano editor. Now add the following line at the end of the file.

/swapfile   swap    swap    sw  0   0

If you don't make the swap file permanent then your system will not use the swap file after reboot. Now tell the system to use the swap file using the following command.

swapon /swapfile

Now you can check if the swap file is mounted is created or not using following command.

swapon -s

You will get following output.

[root@liptan-pc ~]# swapon -s
Filename                                Type            Size    Used    Priority
/swapfile                               file    2097148 0       -1

Change the swappiness value of your system to 10 using the following command.

sysctl vm.swappiness=10

The swappiness value tells the system how often the system swaps data from memory to swap space. The above swappiness setting also restores if not made permanent. Edit /etc/sysctl.conf file using your favorite editor.

nano /etc/sysctl.conf

Now add the following line at the end of the file.

vm.swappiness = 10

Another configuration you might want to change is the cache pressure. Run the following command to change the cache pressure to optimal value.

sysctl vm.vfs_cache_pressure=50

The above swappiness setting also restores if not made permanent. Edit /etc/sysctl.conf file using your favorite editor.

nano /etc/sysctl.conf

Add the following line to the end of file.

vm.vfs_cache_pressure = 50

You can now check if your swap file is used as memory using the following command.

free -m

The output should include the swap memory as shown in the following output.

[root@liptan-pc ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:            991          70          69          12         852         743
Swap:          2047           0        2047

As we have the swap file created, we can proceed to the next step of installation.

Install Docker using following command.

wget -qO- | sh

If you do not have wget installed, you can install it using yum -y install wget. The above command will detect your operating system and download and install the latest version of Docker in your system. Before using Docker, you will need to log out from current session and log back in again.

Now start the docker service and enable it to start at boot time using following command.

systemctl start docker systemctl enable docker

Once the docker is running, make a new directory for Discourse docker files using the following command.

mkdir /var/discourse

Now clone the Docker image of Discourse application using following command.

git clone /var/discourse

Now switch to the newly created directory using following command.

cd /var/discourse

Now you will need to copy the template of configuration file so that we can use it. Run the following command for same.

cp samples/standalone.yml containers/app.yml

Now edit the configuration file using your favorite text editor.

nano containers/app.yml

Find the following line.

  #db_shared_buffers: "256MB"

Uncomment it and change its value to 128MB if you have 1GB actual memory or 256MB if you have 2GB actual memory in your system.

Next find the following line.


Uncomment it and change the value of unicorn workers to 2 if you have 1GB actual memory or 3 or 4 if you have 2GB or more actual memory in your system.

Next, find the following line.


Change the value of discourse hostname to your domain name or subdomain.

Now find the following line.


Change the email address to the admin email address. You can use more than one email address separated by comma. These email addresses will be made administrator upon initial signup. Next find the following lines.

## TODO: The SMTP mail server used to validate new accounts and send notifications
  DISCOURSE_SMTP_ADDRESS:         # required
  #DISCOURSE_SMTP_PORT: 587                        # (optional, default 587)
  #DISCOURSE_SMTP_USER_NAME:      # required
  #DISCOURSE_SMTP_PASSWORD: pa$$word               # required, WARNING the char '#' in pw can cause problems!
  #DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

It is very important to provide the email configuration, otherwise your site may break. Users are also sent an email before creation of a new account. Provide the address to the SMTP server in DISCOURSE_SMTP_ADDRESS. Uncomment the line and change the port to the value on which your SMTP server is listening to. In most cases SMTP runs on either port 587 or 465 or 25. Next uncomment the lines for SMTP username and password and provide the appropriate values in it. You should also uncomment the DISCOURSE_SMTP_ENABLE_START_TLSline and leave the the value true if your SMTP server can be connected using TLS. If the SMTP server is running on unsecured connection than change its value to false. Generally an SMTP server is listening to port 587 or 465 connects on secured connection wheres 25 connects on unsecured connection.

If you do not have mail server, you can create your own mail server using the instruction on How to setup an email server on CentOS 7.

Once all the above inputs are provided, save the file and exit the editor.

Now run the following command to bootstrap Discourse.

./launcher bootstrap app

The above process can take upto few minutes. Once the bootstrap process is completed, run the following command to start the Discourse application.

./launcher start app

The Discourse application will be successfully deployed on your server. You can access the application on the domain name you have provided in configuration. You will see following screen.

Click on the Register button. In the next interface, select the email address which you have provided in configuration file. Provide an username and strong password.

Click on the Register button again. The system will now send you an confirmation email. Once you confirm your email address. You fourm will start and you will see the following interface.

You can login by clicking Login button in the right corner. You will see the administrator interface once logged in. You can now configure the forum how you like it.


In this tutorial we have learned how to install Discourse community forum on CentOS 7 server. You can now successfully deploy the application and use it to power your own community.

Want your very own server? Get our 1GB memory, Xeon V4, 20GB SSD VPS for £10.00 / month.

View Plans