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
@noxidsoft
Copy link

noxidsoft commented Oct 12, 2020

Thanks for this setup, got it working well. I did have to drop php-gettext as it isn't on current focal/universe, was removed in March 2020. See: https://reposcope.com/package/php-gettext

@aslamdoctor
Copy link
Author

aslamdoctor commented Oct 12, 2020

Thanks for this setup, got it working well. I did have to drop php-gettext as it isn't on current focal/universe, was removed in March 2020. See: https://reposcope.com/package/php-gettext

Great. glad to know it helped and thanks for the info on php-gettext. Actually I moved completely on Linux PopOS desktop so not using WSL anymore.

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