Development environment: Windows (WSL2)
This course sets up a Rails development environment on Windows using WSL2, which runs a real Linux kernel in a lightweight virtual machine next to Windows. It covers installing WSL2, Ubuntu and the compiler toolchain, working in the bash shell, and handling the boundary between Windows and Linux. Ruby is installed with rbenv, and PostgreSQL runs as a Linux service inside WSL2. VS Code connects to Linux through the Remote-WSL extension. The last lesson creates a Rails app on PostgreSQL and opens it in a Windows browser at localhost:3000.
What you'll learn
- ✓Why Rails projects live in the Linux filesystem under ~/code and never under /mnt/c
- ✓Installing WSL2, Ubuntu, Windows Terminal and the build-essential toolchain
- ✓Using bash across the Windows boundary, checking PATH with which, and setting Git line endings
- ✓Installing Ruby with rbenv and ruby-build, with versions pinned per project
- ✓Running PostgreSQL inside WSL2 with or without systemd and creating a database role
- ✓Editing through VS Code with the WSL extension and running a first Rails app
WSL2: real Linux inside Windows
Here is a fact that changes how you should think about your Windows machine: almost every Rails application in the world runs on Linux in production. When you deploy to a VPS, to Heroku, to Fly.io, or to a Kubernetes cluster, your code runs on a Linux machine: not Windows.
Read the full lesson free →Curriculum
7 lessonsWSL2: real Linux inside Windows
How WSL2 runs a real Linux kernel beside Windows, and why Rails projects belong in the Linux filesystem.
Installing WSL2, Ubuntu and build tools
Installing WSL2 and Ubuntu with one command, adding Windows Terminal, and installing build tools through apt.
The shell inside WSL2: bash, zsh and the Windows boundary
Configuring bash, crossing between Linux and Windows, avoiding Windows PATH leaks, and setting Git line endings.
Installing Ruby with rbenv on WSL2
Installing rbenv and ruby-build, compiling Ruby, adding Bundler and Rails, and pinning Ruby versions per project.
PostgreSQL inside WSL2
Installing PostgreSQL in Ubuntu, starting it with or without systemd, and creating a superuser role for Rails.
VS code and the remote-WSL bridge
Connecting VS Code on Windows to Linux with the WSL extension, with files and terminal running inside Ubuntu.
Putting it all together: your first Rails app on WSL2
Creating a Rails app with PostgreSQL, serving it to the Windows browser, adding a page and using the console.