Skip to main content

Command Palette

Search for a command to run...

Set Up Laravel & Node.js Development Environment on Windows with WSL 2 (Ubuntu 24)

Install Laravel Valet on Windows Subsystem for Linux (Ubuntu 2)

Updated
2 min read
Set Up Laravel & Node.js Development Environment on Windows with WSL 2 (Ubuntu 24)

In this guide, we'll walk through setting up a robust Laravel and Node.js development environment similar to Laravel Valet on Windows with WSL 2 Linux distro Ubuntu 24.

Prerequisites

Before starting the setup, ensure you have admin access and that Ubuntu 24 is installed on your machine, either natively or on Windows with WSL 2.

This is how you can check which Ubuntu release version you are running:

lsb_release -a

Install Dependencies

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install curl libnss3-tools jq xsel openssl ca-certificates

Install PHP and Composer

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php-cli php-curl php-mbstring php-xml php-zip php-common composer

Install Valet Linux Plus

Valet Linux Plus is Laravel Valet like development environment for Linux, run the following command to install it:

composer global require genesisweb/valet-linux-plus

Add Composer Path

export PATH="$PATH:$HOME/.config/composer/vendor/bin" >> ~/.bashrc
source ~/.bashrc

Install Laravel Development Environment

Now just one command will install all the tools for Laravel dev environment e.g. Nginx, PHP, MySQL, Redis, Dnsmasq, Mailpit using Valet Linux Plus.

valet install

How to Use Valet Linux Plus

Now you have successfully installed Laravel Valet like dev environment on Linux Ubuntu 24. Valet Linux Plus has many features e.g. serving websites, SSL, proxy, handling database, PHP versions, isolated PHP versions.

Install nvm (Node.js Version Manager)

Run the follow command to install nvm on your machine running Ubuntu 24.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash

How to Use nvm

nvm -h # how to use nvm
nvm install --lts # install latest lts version
nvm install 20.1.0 # install specific version

More from this blog

Sohaib Ilyas

15 posts

Web Developer / Laravel / Vuejs / Social Media APIs