Issues while installing Discourse on WSL

Hello! I’m trying to get a local instance of Discourse on my Windows 11 machine to work on development using WSL.

Let me first just say that I’m both new to Discourse, Ubuntu and WSL. So the errors clearly are coming from my end. Please help me! :frowning_with_open_mouth:

Install Discourse on Windows 10

This above is the guide that I followed.

I’m in my fourth try and I keep on encountering the same errors. I will provide a detailed rundown of the installation process.

First, I made sure to have Windows Subsystem for Linux 2. The guide suggests Ubuntu 18.04, so I tried that one. After that didn’t work, I tried 22.04 but still no result. In this rundown, I will be using 18.04 to showcase the errors.

The first step is to install the packages using this command:

bash <(wget -qO-

This works fine. The only thing that looks a little odd is this:

createuser: could not connect to database template1: could not connect to server: No such file or directory
        Is the server running locally and accepting
        connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

Before setting up the database you have to start PostgreSQL service & Redis server manually using following commands

sudo service postgresql start
redis-server --daemonize yes

First command works like a charm, second one already has an issue:

redis-server --daemonize yes

Command ‘redis-server’ not found, but can be installed with:

sudo apt install redis-server

That’s fine. I run

sudo apt install redis-server

and try again.
This time, it works great!

  1. Clone the Discourse repo
git clone ~/discourse

No issues here.
Setting up the database with:

sudo -u postgres createuser -s "$USER"

4. Here is the vital part

cd ~/discourse
source ~/.bashrc
bundle install


Command ‘bundle’ not found, but can be installed with:

sudo apt install ruby-bundler

Let’s run it. And after installation, again run

bundle install

inside the Discourse directory.

Error: You must use Bundler 2 or greater with this lockfile.

After that, when trying to install Bundler:

ERROR: Error installing bundler: There are no versions of bundler (= 2.4.17) compatible with your Ruby & RubyGems bundler requires Ruby version >= 2.6.0. The current ruby version is 2.5.0.

Ok, maybe I need to update my Ruby using rbenv:

rbenv install 2.6.0
ruby-build: definition not found: 2.6.0

See all available versions with `rbenv install --list’.

If the version you need is missing, try upgrading ruby-build.

When checking rbenv install --list, it cuts off at 2.5.0 and I can’t seem to update rbenv.

Can somebody give me a hint of what I may be doing wrong? I can’t seem to go any further than step 4.

Thank you very much, in advance!

1 Like

I just ran in the same issue. Here is what I did (maybe too overkill but I’m not an expert ^^)

  1. Install rbenv and ruby-build :
git clone ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
git clone ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
  1. Install a new version of ruby :
rbenv install 3.2.2
rbenv global 3.2.2
  1. Install the correct bundler version
    gem install bundler:2.4.13

  2. As I had some permissions issues using “bundle install”, I needed to temporary fix that with :
    sudo chmod -R 777 /home/boris/.bundle

  3. bundle install

Hope it helps


Thank you! It helped a lot.

Now, I’m running into another error when running

bundle exec rake db:create

Discourse requires Redis 6.2.0 or up

Hmm, let’s check with

redis-server -v

Redis server v=7.0.12 sha=00000000:0 malloc=jemalloc-5.2.1 bits=64 build=b56540d7933227fd

It should work right? Sorry for the inconveniences.

Ahah it seems that we ran into the same issues.

  1. Add the depot that contains the last versions
sudo add-apt-repository ppa:redislabs/redis
sudo apt-get update
  1. Install the new Redis version
sudo apt-get install redis
  1. restart redis
    sudo service redis-server restart