# Install Discourse on Ubuntu or Debian for Development

**URL:** https://meta.discourse.org/t/install-discourse-on-ubuntu-or-debian-for-development/14727
**Category:** Developer Guides
**Tags:** dev-install, how-to
**Created:** [April 12, 2014, 10:22pm UTC](https://meta.discourse.org/t/install-discourse-on-ubuntu-or-debian-for-development/14727 "2014-04-12T22:22:07Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [April 12, 2014, 10:22pm UTC](https://meta.discourse.org/t/install-discourse-on-ubuntu-or-debian-for-development/14727/1 "2014-04-12T22:22:07Z")

</div>

> ⚠ This guide covers installation instructions in a development environment. For a production guide see: [Install Discourse in production with the official supported instructions](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:

- [Git](http://git-scm.com/)
- [rbenv](https://github.com/sstephenson/rbenv) or [asdf](https://asdf-vm.com/guide/getting-started.html)
- [ruby-build](https://github.com/sstephenson/ruby-build)
- [Ruby](https://www.ruby-lang.org/) (latest stable)
- [Rails](http://rubyonrails.org/)
- [PostgreSQL](http://www.postgresql.org/)
- [SQLite](https://sqlite.org/)
- [Redis](http://redis.io/)
- [Node.js](https://nodejs.org/en)
- [pnpm](https://pnpm.io/)
- [libvips](https://github.com/libvips/libvips/wiki#building-and-installing)
- [MailHog](https://github.com/mailhog/MailHog)\*\*
- [ImageMagick](http://www.imagemagick.org/)\*\*

_\*\* optional_

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

## Clone Discourse

Clone the Discourse repository in `~/discourse` folder:

```sh
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** :

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

```

[/details]

## Bootstrap Discourse

Switch to your Discourse folder:

```sh
 cd ~/discourse

```

Install the needed gems

```sh
source ~/.bashrc
bundle install

```

Install the JS dependencies

```sh
pnpm install

```

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

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

```

Start rails and the frontend bundler:

```sh
bin/dev

```

If the images are not appearing, use this command instead:  
(_you can also specify an IP if you are working on a remote server_)

```sh
DISCOURSE_HOSTNAME=localhost UNICORN_LISTENER=localhost:3000 bin/dev

```

You should now be able to navigate to [http://localhost:3000](http://localhost:3000) to see your local Discourse installation.

## Create New Admin

To create a new admin, run the following command:

```sh
bin/rails admin:create

```

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

## Configure Mail

Run MailHog:

```sh
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](https://meta.discourse.org/t/beginners-guide-to-creating-discourse-plugins/30515).

* * *

_Last Reviewed by @blake on 2023-04-03T06:00:00Z_

* * *

This document is version controlled - suggest changes [on github](https://github.com/discourse/discourse/blob/main/docs/developer-guides/docs/02-development-environments/05-ubuntu-debian-setup.md).

---

_[View the full topic](https://meta.discourse.org/t/install-discourse-on-ubuntu-or-debian-for-development/14727)._
