• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Friday, May 9, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System CentOS

Install Discourse on CentOS 7

How VPS by How VPS
October 1, 2019
in CentOS
0
0
SHARES
60
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Requirements
  2. Set up swap file
  3. Install Docker
  4. Install Discourse
  5. Configure Discourse
  6. Bootstrap and start Discourse
  7. Open Discourse in your browser
  8. Troubleshooting
  9. Want to contribute?


Discourse is a new open-source forum solution which is simple, clean, and straightforward. It is implemented with Ruby on Rails, a Postgres database, and a Redis server cache. This tutorial describes how to install Discourse on a Vultr VPS with CentOS 7.

Requirements

  • Vultr VPS with 1GB RAM minimum.
  • CentOS 7 x64 installed on the VPS.

Set up swap file

You must set up swap for a 1GB RAM VPS. If your VPS has more than 1GB RAM, you can skip this step. We will create a 2GB swapfile for 1GB RAM VPS.

  1. Create the swapfile.

    dd if=/dev/zero of=/swapfile bs=1M count=2048
    mkswap /swapfile
    chmod 600 /swapfile
    
  2. Edit fstab to add the swapfile into file systems table.

    Open fstab with vi:

    vi /etc/fstab
    

    Add the following line into the file:

    /swapfile       swap    swap    defaults      0       0
    
  3. Set the swap usage policy. Only use the swapfile when the system memory is low.

    sysctl -w vm.swappiness=10
    echo vm.swappiness = 10 | tee -a /etc/sysctl.conf
    sysctl vm.vfs_cache_pressure=60
    echo vm.vfs_cache_pressure = 60 | tee -a /etc/sysctl.conf
    
  4. Enable the swapfile.

    mount -a
    swapon -a
    
  5. Check the swapfile state.

    swapon -s
    

    If the swapfile has been enabled, you will see the following information.

    Filename                    Type    Size    Used    Priority
    /swapfile                  file     2097148 0       -1
    

Install Docker

Run the command below to install Docker on CentOS 7.

yum install docker

If you have disabled SELinux, you’d better disable it in docker also.

vi /etc/sysconfig/docker

Comment out line 4.

#OPTIONS='--selinux-enabled'

Start the docker service.

systemctl start docker
systemctl enable docker

Please note that if you restart firewalld, you will need restart docker also. Because firewalld will remove the docker chain from iptables when it’s restarted.

Install Discourse

Create a folder named discourse under /var and clone the Discourse repository.

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

Go to the discourse folder.

cd /var/discourse

Copy the Discourse configuration template file into the containers folder.

cp samples/standalone.yml containers/app.yml

Configure Discourse

  1. Open the app.yml with vi.

     vi containers/app.yml
    
  2. If you are using a 1GB VPS, set the db shared buffer as 128MB in app.yml.

    db_shared_buffers: "128MB"
    
  3. Change UNICORN_WORKERS to 2 for a 1GB RAM instance.

    ## With 2GB we recommend 3-4 workers, with 1GB only 2
    UNICORN_WORKERS: 2
    
  4. Set your email address for the admin account. You will need this email to register the admin account on your Discourse forum.

    DISCOURSE_DEVELOPER_EMAILS: '[email protected]'
    
  5. Set the domain name for Discourse. For example, we set it as discourse.example.com, that means it would be accessible at the URL http://discourse.example.com/.

    ## TODO: The domain name this Discourse instance will respond to
    DISCOURSE_HOSTNAME: 'discourse.example.com'
    
  6. Configure your mail server for Discourse.

    If your mail server is on the same server with Discourse, configure it as follows.

    DISCOURSE_SMTP_ADDRESS: smtp.example.com                               # (mandatory)
    DISCOURSE_SMTP_PORT: 587                                                              # (optional)
    DISCOURSE_SMTP_USER_NAME: YOUR_EMAIL_ACCOUNT                # (optional)
    DISCOURSE_SMTP_PASSWORD: YOURPASSWORD                             # (optional)
    DISCOURSE_SMTP_ENABLE_START_TLS: flase                                    # (optional, default true)
    DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: none
    

    If you use a remote SMTP server, please edit the app.yml as follows.

    DISCOURSE_SMTP_ADDRESS: smtp.example.com                               # (mandatory)
    DISCOURSE_SMTP_PORT: 587                                                              # (optional)
    DISCOURSE_SMTP_USER_NAME: [email protected]                          # (optional)
    DISCOURSE_SMTP_PASSWORD: YOURPASSWORD                             # (optional)
    DISCOURSE_SMTP_ENABLE_START_TLS: true                                     # (optional, default true)
    
  7. Save and exit app.yml.

Bootstrap and start Discourse

Run the command below to bootstrap Discourse.

./launcher bootstrap app

After the bootstrapping process has completed, start Discourse.

./launcher start app

Open Discourse in your browser

On your client PC, input the domain name that you configured for Discourse in app.yml. You will see your own instance of Discourse.

Troubleshooting

  • By default, Docker will listen on port 80. If the port 80 has been used by Nginx or Apache already, you need move that service to another port; or change Docker to another port. For example, change “80:80” to “8080:80” in app.yml to make Docker listen on port 8080.
  • On the 1GB RAM VPS, it may fail to update the Discourse to the new version, and you will see a “502 Bad Gateway” when accessing Discourse. The simple solution for this issue is to run ./launcher rebuild app to rebuild your Discourse instance.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
Previous Post

How To Monitor Network Traffic in Real Time on CentOS 6

Next Post

Getting Started with Kubernetes on CentOS 7

Next Post

Getting Started with Kubernetes on CentOS 7

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet