Tutorial

How To Install Discourse on Ubuntu 16.04

Published on December 2, 2016
How To Install Discourse on Ubuntu 16.04
Not using Ubuntu 16.04?Choose a different version or distribution.
Ubuntu 16.04

An Article from Discourse

Introduction

Discourse is an open-source discussion platform. It can be used as a mailing list, a discussion forum, or a long-form chat room. In this tutorial, we’ll install Discourse in an isolated environment using Docker, a containerization application.

Prerequisites

Before we get started, there are a few things we need to set up first:

Note: Discourse requires a swap file if you are using 1 GB of RAM. Although swap is generally recommended for systems utilizing traditional spinning hard drives, using swap with SSDs can cause issues with hardware degradation over time. Due to this consideration, we do not recommend enabling swap on DigitalOcean or any other provider that utilizes SSD storage. Doing so can impact the reliability of the underlying hardware for you and your neighbors. Hence, we recommend a minimum of 2 GB of RAM to run Discourse on a DigitalOcean Droplet. Refer to How To Add Swap Space on Ubuntu 16.04 for details on using swap.

Step 1 — Downloading Discourse

With all the prerequisites out of the way, you can go straight to installing Discourse.

You will need to be root through the rest of the setup and bootstrap process, so first, switch to a root shell.

  1. sudo -s

Next, create the /var/discourse directory, where all the Discourse-related files will reside.

  1. mkdir /var/discourse

Finally, clone the official Discourse Docker Image into /var/discourse.

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

With the files we need in place, we can move on to configuration and bootstrapping.

Step 2 — Configuring and Bootstrapping Discourse

Move to the /var/discourse directory, where the Discourse files are.

  1. cd /var/discourse

From here, you can launch the included setup script.

  1. ./discourse-setup

You will be asked the following questions:

  • Hostname for your Discourse?

    Enter the hostname you’d like to use for Discourse, e.g. discourse.example.com, replacing example.com with your domain name. You do need to use a domain name because an IP address won’t work when sending email.

  • Email address for admin account?

    Choose the email address that you want to use for the Discourse admin account. It can be totally unrelated to your Discourse domain and can be any email address you find convenient.

    Note that this email address will be made the Discourse admin by default when the first user registers with that email. You’ll also need this email address later when you set up Discourse from its web control panel.

  • SMTP server address?

  • SMTP user name?

  • SMTP port?

  • SMTP password?

    Enter your SMTP server details for these questions. If you’re using SparkPost, the SMTP server address will be smtp.sparkpostmail.com, the user name will be SMTP_Injection, the port will be 587, and the password will be the API key.

Finally, you will be asked to confirm all the settings you just entered. After you confirm your settings, the script will generate a configuration file called app.yml and then the bootstrap process will start.

Note: If you need to change or fix these settings after bootstrapping, edit your /containers/app.yml file and run ./launcher rebuild app. Otherwise, your changes will not take effect.

Bootstrapping takes between 2-8 minutes, after which your instance will be running! Let’s move on to creating an administrator account.

Step 3 — Registering an Admin Account

Visit your Discourse domain in your favorite web browser to view the Discourse web page.

congratulations

If you receive a 502 Bad Gateway error, try waiting a minute or two and then refreshing; Discourse may not have finished starting yet.

When the page loads, click the blue Register button. You’ll see a form entitled Register Admin Account with the following fields:

  • Email: Choose the email address you provided earlier from the pull-down menu.
  • Username: Choose a username.
  • Password: Choose a strong password.

Then click the blue Register button on the form to submit it. You’ll see a dialog that says Confirm your Email. Check your inbox for the confirmation email. If you didn’t receive it, try clicking the Resend Activation Email button. If you’re still unable to register a new admin account, please see the Discourse email troubleshooting checklist.

After registering your admin account, the setup wizard will launch and guide you through Discourse’s basic configuration. You can walk through it now or click Maybe Later to skip.

wizard

After completing or skipping the setup wizard, you’ll see some topics and the Admin Quick Start Guide (labeled READ ME FIRST), which contains tips for further customizing your Discourse installation.

homepage

You’re all set! If you need to upgrade Discourse in the future, you can do it from the command line by pulling the latest version of the code from the Git repo and rebuliding the app, like this:

  1. cd /var/discourse
  2. git pull
  3. ./launcher rebuild app

You can also update it in your browser by visiting http://discourse.example.com/admin/upgrade, clicking Upgrade to the Latest Version, and following the instructions.

upgrade

Conclusion

You can now start managing your Discourse forum and let users sign up. Learn more about Discourse’s features on the Discourse About page.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us


About the authors

Default avatar

staff technical writer

hi! i write do.co/docs now, but i used to be the senior tech editor publishing tutorials here in the community.


Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
10 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

I’m trying to update SMTP setting but ./launcher rebuild app returns

Your Docker installation is not using a supported storage driver.  If we were to proceed you may have a broken install.
aufs is the recommended storage driver, although zfs/btrfs and overlay may work as well.
Other storage drivers are known to be problematic.
You can tell what filesystem you are using by running "docker info" and looking at the 'Storage Driver' line.

If you wish to continue anyway using your existing unsupported storage driver,
read the source code of launcher and figure out how to bypass this check.

what shall I do? my Storage Driver is devicemapper (I followed your tutorial throughout and didn’t add or tweak anything on my own)

another question, how can I make sure my ssl certs will be updated when the time comes? they were installed automatically.

Thanks!

I tried the same instructions twice and stuck at the admin verification email. Earlier I tried twice with the one-click install as well. In both the cases I am stuck at the admin verification email. Discourse is not able to send the verification email appears to be the issue. There is definitely something missing here which most of the howto install Discourse on DigitalOcean guides are missing. There are 2 possibilities as mentioned below:

  1. SMTP ports are blocked by DigitalOcean
  2. MTA (mail transfer agent) needs to be installed along with Discourse

Can someone mention precise installation steps.

Installing Discourse on Ubuntu 16.04 involves a series of steps that include setting up prerequisites, installing Docker, and then configuring Discourse. Here’s a step-by-step guide to help you with the installation process:

  1. Prerequisites:

    • Make sure you have a clean installation of Ubuntu 16.04 with SSH access.
    • Ensure that your server meets the minimum requirements for Discourse: at least 1GB RAM, a dual-core CPU, and sufficient disk space.
  2. Update Ubuntu:

    • Log in to your server via SSH and update the package list by running:

      sqlCopy code sudo apt-get update sudo apt-get upgrade

  3. Install Docker:

    • Discourse runs in a Docker container. Install Docker using the official Docker script:

      arduinoCopy code curl -sSL https://get.docker.com/ | sh

  4. Install Git:

    • Install Git, which is required to download the Discourse repository:

      arduinoCopy code sudo apt-get install git

  5. Clone Discourse Repository:

    • Clone the Discourse repository to your server’s /var/discourse directory:

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

  6. Configure Discourse:

    • Go to the Discourse directory:

      bashCopy code cd /var/discourse

This comment has been deleted

    Installing Discourse on Ubuntu 16.04 requires a few steps. Discourse is a modern forum software, and it’s recommended to install it on a server that meets the system requirements for optimal performance. Here’s a step-by-step guide to installing Discourse on Ubuntu 16.04:

    Before you begin, ensure that you have root or sudo privileges on your Ubuntu server.

    Step 1: Update System Packages Open a terminal and update your system packages to the latest version:

    Thanks a lot for this tutorial. I have a question: if I shut the droplet down, what should I’ll do to start Discourse ? Thanks a lot 🙂

    Is it possible to only use the admit email for admin purposes and have access to all the user emails to create a newsletter, send out blog posts? I want my discourse to be on a subdomain and the main page to be the regular domain where a blog and a job board exists.

    After the install how does one go about maintaining the app? I gathered that you just use the app itself. However I’m used to checking all my code into Git and maintaining it that way. I’m not sure how I’m supposed to think about this project. Can anyone help me figure that out?

    One more note. This tutorial requires access to SparkPost account. For me it took 2 days including hosting mail for my domain on Zoho to receive verification e-mail from SparkPost. And domain is still in manual verification process so I can’t proceed with tutorial.

    Just a quick note for somebody who expect to do this in 2 hours as I did :)

    It seems like 2Gb droplet is not enough for this tutorial

    WARNING: Discourse requires at least 2GB of swap when running with 2GB of RAM
    or less. This system does not appear to have sufficient swap space.
    

    Try DigitalOcean for free

    Click below to sign up and get $200 of credit to try our products over 60 days!

    Sign up

    Join the Tech Talk
    Success! Thank you! Please check your email for further details.

    Please complete your information!

    Get our biweekly newsletter

    Sign up for Infrastructure as a Newsletter.

    Hollie's Hub for Good

    Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

    Become a contributor

    Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

    Welcome to the developer cloud

    DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

    Learn more
    DigitalOcean Cloud Control Panel