Skip to main content

Installing Discourse on Ubuntu 14.04 LTS Physical Server

Discourse is an Open Source software which can be able to use as a discussion platform, a mailing list or a questions to answers forum. Discourse is very popular and is created by the co founders of stackexchange.com.

The discourse software has the following features


100% Open Source Incorporate Discourse into your site with complete confidence – the code belongs to everyone. Trust System As members become trusted regulars over time, they earn abilities to help maintain their community.
Mobile and Tablet Designed for touch devices from day one. Automatic mobile and touch layouts that scale to fit your device. Community Moderation Flagging system lets the community suppress spam and dangerous content, and amicably resolve disputes on their own.
Optimized for Reading To keep reading, just keep scrolling. When you reach the bottom, suggested topics keep you reading. Likes Express agreement, support, and highlight interesting posts with the prominent ❤ button on every post.
Summarize Topics Use the Summarize button to condense long topics to just the most interesting and popular posts. Inline Context Expand quotes, expand replies, or expand what this was in reply to.
Translations Translations are available for 17 languages and counting. Users can switch to the language of their choice as a preference. Real Time Notifications Know when someone replies to you, quotes you, mentions your @name, sends you a private message, links to your post, edits your post, or recategorizes your topic.
SEO Friendly, human readable URLs and clean HTML. Optimized for Google indexing and searching. Plugins If you need custom functionality unique to your site, take advantage of our plugin support.
Single Sign On Seamlessly integrate Discourse with your existing site's login system with easy, robust single sign on. Overlay Editor Compose with an overlay editor which never interrupts your reading – even if you navigate to a different topic.
Social Login Easily add Google, Facebook, Twitter, Yahoo, GitHub, and other common social logins. Private Spaces Make your entire site private, or just certain categories. Approve all new users, or make your site invite-only.
Blog Integration Use our WordPress plugin to integrate a Discourse community into your blog. Or embed Discourse into static HTML sites. One Click Upgrades Automatic notification of new versions in the dashboard, with a one-click web upgrade process.
Anonymous Posting Enable anonymous posting mode and your users can easily switch to anonymous mode to post about controversial, dangerous, or political issues without fear. User metrics Public user directory that shows read time, posts, likes, and other common metrics. Know who your most avid users are!
Desktop Notifications Integration with desktop notifications built into modern browsers, so you know when new posts arrive on your laptop or desktop. Post Approval For sites with sensitive content, enable approval to have staff approve all posts by new users in a handy queue.
Spam Blocking Comprehensive spam blocking heuristics including new user sandboxing, user flag blocking, and standard nofollow. Built in Akismet spam protection. Analytics Dashboard for staff that shows key stats on users, topics, and all user actions – along with top referring domains and topics.
Automatic URL Embedding URLs to popular websites like Wikipedia and YouTube will include an inline summary. We fully support OpenGraph and oEmbed. Advanced Image Handling Add images through upload, drag and drop, or copy and paste. Large images automatically thumbnailed and lightboxed.
File Attachments Include arbitrary file attachments of any allowed file type or file size in your posts. Link Tracking External links are shown with a visible click counter. Incoming and outgoing links to other topics are displayed next to each post.
Polls Create quick poll topics for the community to vote on. Spoilers Tags that hide potential spoilers, revealing only on click or tap.
Flexible Formatting Mix and match Markdown, BBCode, and HTML formatting in posts. Emoji Just start typing : and you have access to the complete list of standard emoji. Choose from four Emoji sets, or define your own custom Emoji.
Comprehensive API Anything you see on screen, you can also do via an API call. Discourse itself is a JavaScript app that talks to our API. Local Avatars Built-in local avatar generation with no external dependencies. Alternately, select an existing Gravatar, or upload a custom avatar.
Email Invitations Trusted users can invite friends via email to join and reply with a single click. Admins can batch invite users by uploading email addresses. Automatic Drafts We auto-save replies and topics to the server in the background as you type.
Revision History Revision tracking on every edit, with a visual difference highlighter to show changes. Wiki Posts Mark posts as collaboratively editable by any trusted member of the community.
Badges Encourage positive community behaviors through the included set of badges, or add your own custom badges. Email Notifications When you aren't active on the website, your notifications will be automatically sent to you via email.
Email Replies Reply to email notifications to post without visiting the website. Inline Moderation Fast inline controls to split, merge, close, archive, or recategorize topics. Select groups of topics to act on.
Flag Queue Highly visible moderator flag queue with optional email notification. One click to agree, disagree, or defer flags. Complete history. Site-Wide Notifications Pin topics locally or globally. Banner a topic to have it appear as a dismissable banner for all users. Add a permanent alert for urgent situations.
Mailing List Support Opt into a special mode where all messages are sent to you via email, exactly like a mailing list. Start new topics via email. Community Hub Official community support hub at meta.discourse to discuss features, bugs, and support requests.
Private Messaging Send private messages to a single user or to groups of users. Web Backup and Restore Backup and restore all your site data from your browser. Take your data to any host, anywhere, in a few clicks.
Automated Backups Automatically back up your site data every day, either to the local filesystem, or to the cloud. CDN Support Easily plug in any CDN provider to speed up global access to your site.
Here I am going to show you how to install this great software on a bare metal Ubuntu 14.04 LTS physical server.

Server Configuration

  • Enter your hostname discourse.example.com as the name.
  • The default of 1 GB RAM works fine for small Discourse communities. We do recommend 2 GB RAM for medium communities.
  • The default of Ubuntu 14.04 LTS x64 works fine. At minimum, a 64-bit Linux OS with a kernel version of 3.10+ is required.
  • The default of New York is a good choice for most US and European audiences. Or select a region that is geographically closer to your audience.

Access Your Ubuntu Server

Connect to your Server via SSH, or use Putty on Windows if you are accessing from network else go to that server and login:
ssh root@192.168.1.1
Replace 192.168.1.1 with the IP address of your Droplet.

You will be asked for permission to connect, type yes.
Login to root user by typing sudo su and enter the password if asked. Change the password if required by typing passwd for root

Set up Swap (if needed)

  • If you're using the minimum 1 GB install, you must set up a swap file.
  • If you're using 2 GB+ memory, you can probably get by without a swap file.

Install Docker / Git

wget -qO- https://get.docker.com/ | sh

Install Discourse

Create a /var/discourse folder, clone the Official Discourse Docker Image into it, and make a copy of the config file as app.yml:
mkdir /var/discourse
git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
cp samples/standalone.yml containers/app.yml

Edit Discourse Configuration

Edit the Discourse configuration at app.yml:
nano containers/app.yml
We recommend Nano because it works like a typical GUI text editor, just use your arrow keys.
  • Set DISCOURSE_DEVELOPER_EMAILS to your email address.
  • Set DISCOURSE_HOSTNAME to discourse.example.com, this means you want your Discourse available at http://discourse.example.com/. You'll need to update the DNS A record for this domain with the IP address of your server.
  • Place your mail credentials in DISCOURSE_SMTP_ADDRESS, DISCOURSE_SMTP_PORT, DISCOURSE_SMTP_USER_NAME, DISCOURSE_SMTP_PASSWORD. Be sure you remove the comment # character and space from the front of these lines as necessary.
  • If you are using a 1 GB instance, set UNICORN_WORKERS to 2 and db_shared_buffers to 128MB so you have more memory room.

After completing your edits, press CtrlO then Enter to save and CtrlX to exit.

Email Is Important

Email is CRITICAL for account creation and notifications in Discourse. If you do not properly configure email before bootstrapping YOU WILL HAVE A BROKEN SITE!
  • Already have a mail server? Great. Use your existing mail server credentials.
  • No existing mail server, or you don't know what it is? No problem, create a free account on Mandrill (or Mailgun, or Mailjet), and use the credentials provided in the dashboard.
  • For proper email deliverability, you must set the SPF and DKIM records in your DNS. In Mandrill, that's under Sending Domains, View DKIM/SPF setup instructions.

Bootstrap Discourse

Save the app.yml file, and begin bootstrapping Discourse:
./launcher bootstrap app
This command takes about 8 minutes. It is automagically configuring your Discourse environment.
After that completes, start Discourse:
./launcher start app

Congratulations! You now have your own instance of Discourse!
It should be accessible via the domain name discourse.example.com you entered earlier, provided you configured DNS. If not, you can also visit the server IP directly, e.g. http://192.168.1.1. or http://localhost

Register New Account and Become Admin

There is a reminder at the top about DISCOURSE_DEVELOPER_EMAILS; register a new account via one of those email addresses, and your account will automatically be made an Admin.
(If you don't get any email from your install, and are unable to register a new admin account, please see our Email Troubleshooting checklist.)

You should see Staff topics and the Admin Quick Start Guide. It contains the next steps for further configuring and customizing your Discourse install.
(If you are still unable to register a new admin account via email, see Create Admin Account from Console, but please note that you will have a broken site unless you get email working on your instance.)

Post-Install Maintenance

We strongly suggest you:
  • turn on automatic security updates via the dpkg-reconfigure -plow unattended-upgrades command
  • enable stronger passwords via the apt-get install libpam-cracklib package
To upgrade Discourse to the latest version, visit /admin/upgrade and follow the instructions.
The launcher command in the /var/discourse folder can be used for various kinds of maintenance:
Usage: launcher COMMAND CONFIG [--skip-prereqs]
Commands:
    start:      Start/initialize a container
    stop:       Stop a running container
    restart:    Restart a container
    destroy:    Stop and remove a container
    enter:      Use nsenter to enter a container
    ssh:        Start a bash shell in a running container
    logs:       Docker logs for container
    mailtest:   Test the mail settings in a container
    bootstrap:  Bootstrap a container for the config based on a template
    rebuild:    Rebuild a container (destroy old, bootstrap, start new)
    cleanup:    Remove all containers that have stopped for > 24 hours

Options:
    --skip-prereqs   Don't check prerequisites
    --docker-args    Extra arguments to pass when running docker

Add More Discourse Features

Do you want...
If anything needs to be improved in this guide, feel free to ask on meta.discourse.org, or even better, submit a pull request.