Beginners Guide to Install Discourse on Ubuntu for Development

This topic is meant for Discourse on a native Ubuntu install. If you are using WSL, you need to use this method:


A post was merged into an existing topic: Beginners Guide to Install Discourse on Windows 10 for Development


I have an issue at the step bellow.

I have this message

root@dsff2:~/discourse# sudo -u postgres createuser -s dada
could not change directory to "/root/discourse": Permission denied

I don’t know wich user I have to use … I have only the root user. I didn’t created any other user.

Have you solved this? I’m getting the same warning and error about nokogiri.

Hi guy i am getting method ‘sub’ for nill class after installing discourse and setting up admin password and email

Have you tried our docker based dev environment:


I’ve created a GNU screen file for Discourse. After running sudo apt install screen to install the program, you can paste the below into a file named ubuntu.screen in your user’s home directory and execute the commands in the file’s comments.

# GNU screen configuration file for Discourse Ubuntu development

# Start up your development instance in detached mode:
#   screen -d -m -c ~/ubuntu.screen

# Start in attached mode:
# screen -m -c ~/ubuntu.screen

# commands that exit hang around until you hit 'k' to kill or 'r' to restart
zombie kr

screen -t rails_s 0 bash -c 'echo Starting rails server...;  cd ~/discourse; bundle exec rails s -b'
screen -t rails_c 1 bash -c 'echo Starting rails console...; cd ~/discourse; bundle exec rails c'
screen -t mail    2 bash -c 'echo Starting mailcatcher...;   cd ~/discourse; mailcatcher --http-ip'

scrollback 50000

Does someone know what is the problem and how to solve it?

Unpacking libjpeg-turbo-progs (1.5.2-0ubuntu5.18.04.1) …
Selecting previously unselected package jhead.
Preparing to unpack …/jhead_1%3a3.00-8~build0.18.04.1_amd64.deb …
Unpacking jhead (1:3.00-8~build0.18.04.1) …
Setting up libjpeg-turbo-progs (1.5.2-0ubuntu5.18.04.1) …
Setting up jhead (1:3.00-8~build0.18.04.1) …
Processing triggers for man-db (2.8.3-2) …

Installing Ruby 2.6.1 …

/dev/fd/63: line 68: rbenv: command not found


For future developers, the solution was to deactivate temporary the Avira antivirus.
Good luck!

Did you modify your path? There is a step where you add to bashrc and source it you might log out and back in or just open a new terminal.

I solved to problem and updated my comment with the solution. Thank you for your help :slight_smile:

1 Like

I’m getting the following error:

It appears to be a postgres connection issue. The log file says that it’s

listening on Unix socket "/var/run/postgresql/.s.PGSQL.5443"

This looks like WSL to me… I think you need to start the postgres service systemctl start postgresql probably. Same goes for starting redis.

1 Like

Both postgres and redis appear to be running from what I can tell.


And when I do redis-cli ping, it returns PONG

Is the socket file there? Maybe you had pg on win10 so it picked a different port?


Sure enough, it’s running on port 5433. Would be better to try to free up 5432, or change the installation somehow to recognize 5433?

Edit: Nevermind, pg is running on 5432. That’s not the problem.

Another Edit: Ok, I did have pg installed on windows previously. Not sure when/why/how…I’m a bit dense sometimes. Thanks for the help!

I’m getting many rspec failures as others have reported above. And attempting to start the rails server also results in errors, and eventually an endless error loop.

Edit: Found the solution discussed under the Windows install guide here:

This install is not for the faint of heart. :smiley:

1 Like

I am running this autospec but its just hanging, is it suppose to do something?

How long have you waited? After it has loaded the app (which might take several seconds), it should start displaying lots of dots (.).


When running bundle exec rails server, I’m left with a bunch of errors…

:confused: - any help?

Unicorn does not work on wsl at the moment, you are going to have to use puma