Discourse is a new social discussion CMS and one of the best choices right now to start a forum. The catch? It’s written in Ruby and installing it requires a lot of server administration knowledge. If you have some time, this guide may help you to finally get started with installing and running your own Discourse forum!

Warning: This guide is far from complete, I recommend you to browse through the resources first and if you run into any problems use the table of contents below to quickly search a solution for your problem


Optional: Create New Discourse User

It might be a good idea to create a new user for your discourse installation – however during my tests on CentOS I found it particularly troubling to resolve the path issues, permission issues and dependencies when doing that, so it might be a good idea to install it as a root user and make sure you don’t permit root logins via SSH.

1. sudo adduser discourse -G wheel then directly after that while logged in as a root user enter passwd discourse to set a password for this user

2. Enter sudo su - discourse to switch to this account

Dependencies (Run First)

sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
sudo yum install -y git make gcc-c++sudo yum groupinstall development-tools development-libs

Just to be sure:

sudo yum install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config

Installing PostGres SQL (DO THIS FIRST!)

WARNING: WHM Users should run /scripts/installpostgres

curl -O http://yum.postgresql.org/9.1/redhat/rhel-6-x86_64/pgdg-centos91-9.1-4.noarch.rpm
rpm -ivh pgdg-centos91-9.1-4.noarch.rpm
yum install postgresql91-server
yum install postgresql91-contrib.x86_64
yum install postgresql91-devel.x86_64
service postgresql-9.1 initdb
service postgresql-9.1 start
su postgres


Installing Ruby Part 1

4. \curl -s -S -L https://get.rvm.io | bash -s stable

5. You should see a green text saying “Installation of RVM in /home/discourse/.rvm/ is almost complete

6. IMPORTANT – follow this closely if you are having trouble with the paths


cat ~/.bash_profile >> ~/.profile
rm ~/.bash_profile

Optional: When using “discourse user” instead of root

8. If you get an error – check this file /home/discourse/.rvm/log/xxx/update_system.log

9. Because of the error “this user is not in the sudoers file” we must now modify the sudoers file:

10. Enter pico /etc/sudoers

11. Hit CTRL + W (make sure to use pico!) and search for ALL=(ALL) and then just below the root user add the discourse user:

Adding user to sudoers file

12. Hit CTRL + O to save the file (using pico!)

Installing Ruby Part 2

13. Enter rvm requirements

You should now see green text saying Installing required packages: libyaml-devel, libffi-devel

14. Now we’re ready to install ruby after resolving all those annoying dependencies. All you have to do is enter rvm install 2.0.0

Installing ruby

15. Enter rvm use 2.0.0 --default

Using Ruby 2.0

16. Enter gem install bundler

You should get the response 1 gem installed

Clone Discourse Using Git Repo

Important: If you’re installing as “root” user, modify the paths to match your installation directory!

17. Finally, we’re ready to use git to clone the Discourse git repo!

18. Enter sudo install -d -m 755 -o discourse -g discourse /var/www/discourse to create a folder for the discourse install

19. Enter

git clone git://github.com/discourse/discourse.git /var/www/discourse

20. Enter git checkout latest-release

21. Enter bundle install --deployment --without test

22. CD into the config dir located at cd /var/www/discourse/config or cd /var/www/discourse/config Enter all of the commands below:

cp database.yml.production-sample database.yml
cp redis.yml.sample redis.yml
cp discourse.pill.sample discourse.pill
cp environments/production.rb.sample environments/production.rb

Problems With Gem?

23. Run the following command: gem update --system 2.0.3

IMPORTANT: Finally, cd back into the discourse directory – this is important because the gem file is located there

24. After resolving those dependencies, let’s go on and run this gem install debug_inspector -v '0.0.2' .

25. Let’s see if we can update the gem module now: Enter gem update --system

Finally: Preparing Discourse

bundle install
rake db:migrate
rake db:test:prepare
bundle exec rspec
bundle exec rails server -d
bundle exec sidekiq ... -L log/sidekiq.log

26. Ok, finally enter bundle install which will hopefully not run into any other dependency errors (If you do, you need to Google them)

Problems With PG?

gem install pg -- --with-pgsql-lib=/usr/pgsql-9.1/lib --with-pg-config=/usr/pgsql-9.1/bin/pg_config

Problems With Make? Try This

rvm get head
rvm requirements run
rvm remove 1.9.3
rvm use 1.9.3 --install --default
gem install rails

Problems With bundle update binding_of_caller?

Enter bundle update binding_of_caller

Resources And Sources