# Guide to Setting Up Discourse Development Environment - Windows 11

**URL:** <https://meta.discourse.org/t/guide-to-setting-up-discourse-development-environment-windows-11/282227>\
**Category:** Self-hosting\
**Tags:** dev-install\
**Created:** [October 14, 2023, 10:38am UTC](https://meta.discourse.org/t/guide-to-setting-up-discourse-development-environment-windows-11/282227 "2023-10-14T10:38:25Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![AliBenBongo](https://avatars.discourse-cdn.com/v4/letter/a/da6949/32.png) [@AliBenBongo](https://meta.discourse.org/u/AliBenBongo)\
**Post date:** [October 14, 2023, 10:38am UTC](https://meta.discourse.org/t/guide-to-setting-up-discourse-development-environment-windows-11/282227/1 "2023-10-14T10:38:25Z")

</div>

Hi Everyone,

After spending some time attempting to get a working development environment up and running under Windows 11 / WSL2 I thought I would share the steps that I have followed.

This is my first post here so I hope that this is of use to somebody 🙂 I am a Systems Administrator used to working with Windows so this has been an interesting journey learning Linux / Ruby / Discourse etc.

A few things seem to have changed since the guide for Windows 10 was written and I ran into a few issues along the way (and from reading the comments, I wasn’t the only one!)

I can confirm that the following instructions worked on my Windows 11 Pro 22H2 install & also on my Windows Insider build of the upcoming Windows 11 23H2 Release Preview.

I’ll try to keep the instructions as short and straightforward as possible 🙂

**Initial Preparation**

1. Check for any WSL updates and install them if applicable. From a Windows Powershell window use this command:-

`wsl.exe --update`

1. Install Ubuntu on WSL2 using this command:-

`wsl.exe --install -d Ubuntu`

1. Follow the onscreen prompts to create the username and password

2. Once you’re in the Ubuntu terminal, check for and install all applicable updates

`sudo apt update && sudo apt upgrade -y`

1. Now that everything is updated we can proceed 🙂

**WSL Modifications**

1. Before cloning Discourse, run the following command to open the /etc/wsl.conf file:-

`sudo nano /etc/wsl.conf`

1. At the bottom of the existing file, add the following , press Ctrl + X to save the changes and press “Y” when prompted.

```plaintext
[automount]
enabled = true
root = /mnt/
options = "metadata,umask=22,fmask=11"

```

1. Completely close the WSL terminal and relaunch it for these changes to properly apply.

2. Now copy and paste the following one-line installation script to set up the development environment. Depending on the speed of your computer and/or internet connection this might take a bit of time to complete, so go and grab a coffee or something!

```plaintext
bash <(wget -qO- https://raw.githubusercontent.com/discourse/install-rails/master/linux)

```

1. Start the PostgreSQL service:-

```plaintext
sudo service postgresql start

```

1. Because we’re running in WSL2 I got a warning message about the VM running out of memory, which can be solved by running the following

```plaintext
sudo sysctl vm.overcommit_memory=1

```

1. Run the following so that the redis-server automatically restarts:-

```plaintext
redis-server --daemonize yes

```

1. Clone Discourse into the home folder:-

```plaintext
git clone https://github.com/discourse/discourse.git ~/discourse

```

1. Change to the newly-created Discourse folder:-

```plaintext
cd ~/discourse

```

1. Run the following commands (I did them one line at a time)(Unsure whether this is necessary or if they can be copied and pasted in one go)

```plaintext
source ~/.bashrc

bundle install

yarn install

```

1. Setup the environment:-

```plaintext
RAILS_ENV=development bundle exec rake db:create db:migrate

```

1. Start Discourse

```plaintext
DISCOURSE_HOSTNAME=localhost UNICORN_LISTENER=localhost:3000 bin/ember-cli -u

```

1. Open a separate terminal , change into the Discourse directory using _cd ~/discourse_ and run **rails admin:create** - follow the instructions to set up your Admin user account.

2. Go to [http://localhost:4200](http://localhost:4200) in a web browser and Discourse should all be up and running 🙂

---

_[View the full topic](https://meta.discourse.org/t/guide-to-setting-up-discourse-development-environment-windows-11/282227)._
