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!
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- https://raw.githubusercontent.com/discourse/install-rails/master/linux)
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"?
failed
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!
- Clone the Discourse repo
git clone https://github.com/discourse/discourse.git ~/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
Error:
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.0See 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!