Install Discourse on Windows 10 for development

:information_source: This tutorial has been tested on Windows 10 and 11.
So you want to set up a development environment for Discourse on Windows 10 (or windows 11)? You can do it easily using Windows Subsystem for Linux feature. It is faster too :star_struck:.

This setup requires the WSL 2 installation. It is only available in Windows 10 builds 18917 or higher. We’ll assume that you already installed Windows Subsystem for Linux 2 (Ubuntu) on your Windows 10 system. WARNING: Install Ubuntu 18.04, and not 20.04 since some installations will fail on 20.04. For more information see June 30th, 2020 notes at the bottom of this post.

Let’s begin!

Installing Discourse

  1. Initially follow the steps from the topic Beginners Guide to Install Discourse on Ubuntu for Development until the step Clone Discourse.
  1. 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
    
  2. Then go through all the remaining steps of the Ubuntu guide.

Creating a Command to Start Discourse

Now your development environment is almost ready. The only problem is every time when you open Ubuntu on Windows you have to start the PostgreSQL service & Redis server manually. Don’t worry we can have a workaround for this by creating a custom command :wink:

cd ~

Create a new file using the command nano start-discourse and paste the content below then save and exit.

#!/bin/bash

# to start PostgreSQL
sudo service postgresql start

# to start Redis server
redis-server --daemonize yes

Now modify the CHMOD using below command

chmod +x start-discourse

And copy the file to your bin folder

sudo cp start-discourse /usr/bin/

It’s done. Now, whenever you open the Ubuntu bash just run the command below and start developing :+1:

start-discourse

Alternatively, if you are using Windows 10 enterprise, pro, or education edition then you can create a Linux virtual machine in hyper-v to set up the Discourse dev environment.

Notes About Windows Environment

As of June 30, 2020:
As of July 1, 2020

Last Reviewed by @SaraDev on 2022-06-16T02:00:00Z


This document is version controlled - suggest changes on github.

Last edited by @JammyDodger 2024-05-25T08:49:57Z

Check documentPerform check on document:
50 Likes