Skip to content

Latest commit

 

History

History
152 lines (104 loc) · 3.63 KB

05-ubuntu-debian-setup.md

File metadata and controls

152 lines (104 loc) · 3.63 KB
title short_title id
Install Discourse on Ubuntu or Debian for Development
Ubuntu/Debian setup
ubuntu-debian-setup

⚠️ This guide covers installation instructions in a development environment. For a production guide see: https://meta.discourse.org/t/how-to-install-discourse-in-production/142537


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!

Requirements

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

Current compatibility:

OS Compatibility
Debian 11
Crostini (Linux on ChromeOS)
Ubuntu 22.04 or later

Install Discourse Dependencies

You will need the following packages on your system:

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 https://github.com/discourse/discourse.git ~/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:

cd /tmp && sudo -u postgres createuser -s "$USER"

[/details]

Bootstrap Discourse

Switch to your Discourse folder:

 cd ~/discourse

Install the needed gems

source ~/.bashrc
bundle install

Install the JS dependencies

pnpm 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

Start rails and ember server:

bin/ember-cli -u

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.

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:

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 [date=2023-04-03 timezone="America/Boise"]