Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Windows 10 - WSL LAMP Stack Setup

Ref: https://medium.com/@ssharizal/how-to-install-lamp-stack-server-on-windows-subsystem-linux-wsl-windows-10-133419c22473

Install Windows Subsystem (Ubuntu)

Run this command in powershell as administrator

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

Reboot PC Install Ubuntu from Microsoft Store

Open Ubuntu and run below commands:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install lamp-server^

Add below code inside /etc/apache2/apache2.conf:

Servername localhost
AcceptFilter http none

And restart apache server

sudo service apache2 start

And try http://localhost or http://127.0.0.1

Install PHPMyAdmin

sudo service mysql start
sudo mysql
SELECT user, authentication_string, plugin, host FROM mysql.user;
ALTER user 'root'@'localhost' identified with mysql_native_password by 'mypassword';
FLUSH PRIVILEGES;
sudo apt-get install php-mbstring php-gettext phpmyadmin

Setup Apache Hosts File

cd /etc/apache2/sites-available/
sudo nano example1.local.conf

Add below code and save:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName example1.local
        ServerAlias *.example1.local

        DocumentRoot /mnt/e/example1.local

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /mnt/e/example1.local>
                Options Indexes FollowSymlinks MultiViews
                AllowOverride All
#               Order allow,deny
#               Allow from all
                Require all granted
        </Directory>
</VirtualHost>

And run below commands to enable example1.local website:

sudo a2ensite example1.local.conf
sudo service apache2 reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment