Skip to content

Instantly share code, notes, and snippets.

@aslamdoctor
Last active December 7, 2023 13:46
  • Star 25 You must be signed in to star a gist
  • Fork 16 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save aslamdoctor/7b0afd6ade8b832a0f6e616523586277 to your computer and use it in GitHub Desktop.
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
Copy link

ghost commented Jun 1, 2021

Hi . I know it late. but i want to said thanks you for short but detail guide :). I love you
And of course is working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment