This guide covers installation instructions in a 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.
|Crostini (Linux on ChromeOS)|
|Ubuntu 22.04 or later|
As regular user run this script in terminal, to setup Rails development environment:-
bash <(wget -qO- https://raw.githubusercontent.com/discourse/install-rails/main/linux)
This will install the following new packages on your system:
In case you have any of this package pre-installed and don’t want to run the 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 the Discourse repository in
git clone https://github.com/discourse/discourse.git ~/discourse
~ indicates home folder, so Discourse source code will be available in your home folder.
Already completed by the install script
Create role with the same name as your Linux system username:
cd /tmp && sudo -u postgres createuser -s "$USER"
Switch to your Discourse folder:
Install the needed gems
source ~/.bashrc bundle install
Install the JS dependencies
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
Start rails and ember server:
If the images are not appearing, use this command instead:
(you can also specify an IP if you are working on a remote server)
DISCOURSE_HOSTNAME=localhost UNICORN_LISTENER=localhost:3000 bin/ember-cli -u
You should now be able to navigate to http://localhost:4200 to see your local Discourse installation.
To create a new admin, run the following command:
Follow the prompts, and a new admin account will be created.
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-04-03T06:00:00Z