Install Discourse on Ubuntu or Debian for Development

:warning: This guide covers installation instructions in development environment. For a production guide see: Install Discourse in production with the official, supported instructions

So you want to set up Discourse on Ubuntu or Debian to hack on and develop with?

We’ll assume that you work locally and don’t have Ruby/Rails/Postgres/Redis installed on your Ubuntu or Debian system. Let’s begin!


We suggest having at least 4 GB RAM and 2 CPU cores.

Current compatibility:

OS Compatibility
Debian 11 :white_check_mark:
Ubuntu 18 :x:
Ubuntu 20 :x:
Ubuntu 22 :x:

Install Discourse Dependencies

As regular user run this script in terminal, to setup Rails development environment:-

bash <(wget -qO-

This will install following new packages on your system:

In case you have any of this package pre-installed and don’t want to run entire script, see the script and pick the packages you don’t have currently installed. The script is fine-tuned for Discourse, and includes all the packages required for Discourse installation.

Now that we have installed Discourse dependencies, let’s move on to install Discourse itself.

Clone Discourse

Clone the Discourse repository in ~/discourse folder:

git clone ~/discourse

~ indicates home folder, so Discourse source code will be available in your home folder.

Setup Database

Create role with the same name as your Linux system username:

sudo -u postgres createuser -s "$USER"

Bootstrap Discourse

Switch to your Discourse folder:

 cd ~/discourse

Install the needed gems

source ~/.bashrc
bundle install

Install the JS dependencies

yarn install

Now that you have successfully installed gems, run these commands:

bin/rails db:create 
bin/rails db:migrate
RAILS_ENV=test bin/rails db:create db:migrate

Try running the specs (optional):

bin/rspec spec/

All the tests should pass.

Start rails and ember server:

bin/ember-cli -u

You should now be able to navigate to http://localhost:4200 to see your local Discourse installation.

Create New Admin

To create a new admin, run the following command:

bin/rails admin:create

Follow the prompts, and a new admin account will be created.

Configure Mail

Run MailHog:


Congratulations! You are now the admin of your own Discourse installation!

Happy hacking! And to get started with that, see Beginner’s Guide to Creating Discourse Plugins.

Last Reviewed by @blake on 2023-03-22T06:00:00Z


Please add a deprecation notice on this guide.

Hi, what issue did you encounter?
I reviewed the guide recently, created several development instances and added some information accordingly to the results:

I can’t give an authoritative answer.
But it seems, that only works for Debian 11 and is also some time behind GitHub - discourse/discourse_docker: A Docker image for Discourse.

See also Error installing `bullseye-backports` when trying to install for Development

1 Like

I encountered this error when installing on Ubuntu 22 but not on Ubuntu 18 or 20.

Asking for a deprecated tag needs more than a “it seems” :slight_smile:

discourse_docker/install-imagemagick at main · discourse/discourse_docker · GitHub was updated 1 day after my last review so I might try a dev install on at least Ubuntu 18 and 20 and see how it goes.

Just tried it again on a fresh ubuntu20.04 wsl box:

E: The value 'bullseye-backports' is invalid for APT::Default-Release as such a release is not available in the sources

I can confirm the script no longer works for Ubuntu 18, 20 and 22.
I’ll see what can be done about this.


I installed a development instance on Debian 11 without any issues and updated the guide accordingly.