Go to https://learn.microsoft.com/en-us/windows/wsl/install-manual and follow the instructions
- Download Ubuntu 22.04 LTS from the Microsoft Store by going to https://apps.microsoft.com/detail/9PN20MSR04DW?hl=en-us&gl=US
- Launch Ubuntu 22.04 LTS
- Create a username and password
- Run
sudo apt-get update && sudo apt-get upgrade -y
- Run
sudo visudo
- Go to the end of the file and add the following line:
ALL ALL = (root) NOPASSWD: /usr/sbin/service <your_username> ALL=(ALL) NOPASSWD: ALL
- Save and exit by pressing
Ctrl + X
, thenY
, thenEnter
(Nano Editor)
- Run
sudo apt-get install network-manager libnss3-tools jq xsel build-essential libssl-dev zip unzip dnsmasq nginx mysql-server php-fpm php-cli php-mysql php-sqlite3 php-intl php-zip php-xml php-curl php-mbstring redis-server php-redis php-pear php-dev pkg-config libz-dev libzip-dev libmemcached-dev libmemcached11 libmemcachedutil2 libmagickwand-dev imagemagick memcached -y
- Verify PHP is installed by running
php -v
You should see PHP Version.
- Run
sudo service mysql start
- To change the root password run
sudo mysql
- Run
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
- Replace
password
with your password. - Run
FLUSH PRIVILEGES;
- Run
exit;
- Run
- Restart MySQL by running
sudo service mysql restart
-
Node.js LTS version:
-
Using Ubuntu
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - &&\ sudo apt-get install -y nodejs
-
Run
node -v
to verify NodeJS is installed
-
cd ~
to go to your home directory -
Run
wget https://getcomposer.org/installer
-
Run
php installer
-
Run
sudo mv composer.phar /usr/local/bin/composer
Add composer to your path
-
Run
composer --version
to verify composer is installed -
Add this to the end of your
~/.bashrc
file by runningnano ~/.bashrc
and adding this to the end of the file:
export PATH="$HOME/.config/composer/vendor/bin:$PATH"
save and exit by pressing
Ctrl + X
, thenY
, thenEnter
(Nano Editor) -
Run
source ~/.bashrc
to reload your bashrc file
-
Install Required Packages
- Run
sudo apt-get install network-manager libnss3-tools jq xsel -y
- Run
-
Install Valet via Composer
- Run
composer global require cpriego/valet-linux
- Run
-
Run
valet install
-
Go to your web root directory e.g.
cd /var/www
-
Run
valet park
to register your current working directory as a path that Valet should search for sites
-
To test if Valet is working create a new directory in your web root directory
mkdir info
-
If permission denied run (Not Recommended)
sudo chmod -R 777 /var/www
OR (Recommended)
sudo chown -R $USER:$USER /var/www
and create directory again
-
Run
cd /var/www/info
-
Run
echo "<?php phpinfo();" > index.php
-
On Windows you must add host
127.0.0.1 info.test
toC:\Windows\System32\drivers\etc\hosts
file -
You can use Hosts File Editor to edit hosts file
-
Open your browser and go to http://info.test
-
Auto Valet start
-
Run
nano ~/.bashrc
- Go to the end of the file and add the following line:
if ! ps -C nginx >/dev/null; then sudo service mysql start # start mysql if not running valet start # start valet fi
- Go to the end of the file and add the following line:
- Run
composer global require laravel/installer
- Run
laravel --version
to verify Laravel Installer is installed
- Install VSCode
- Install VSCode Remote WSL Extension
- Open WSL Terminal
- Go to your project folder
- Run
code .
to open VSCode