How to Install LAMP Stack Server on Windows Subsystem Linux (WSL Windows 10)

Now with windows 10 (anniversary edition), you can install the windows subsystem for Linux, which provides an environment for a Linux userspace to operate.

Windows Subsystem Linux

Requirements:

windows 10 (64 bit) anniversary edition or later
install windows subsystem linux

Guide to installing WSL -> Link

Installing a LAMP stack:

Step One: Update System

Update the system:

sudo apt-get update && sudo apt-get upgrade

Step Two: Start bash.exe type:

sudo apt-get install lamp-server^

remember the caret (^) at the end of the command.

add these 2 lines in /etc/apache2/apache2.conf :

Servername localhost
AcceptFilter http none

then you can start apache :

/etc/init.d/apache2 start

Step Three: Test Web Server, PHP and MySQL

Test Apache: Open Web Browser and type this URL:

http://127.0.0.1 or http://localhost

Test PHP: Create below file (info.php) and place it in /var/www/html

<?php
phpinfo();
?>

Open Web Browser and type this URL:

http://127.0.0.1/info.php or http://localhost/info.php

Test MySQL: Type below command in bash prompt

service mysql start
mysql -uroot -ppassword
Like what you read? Give Syed Sharizal a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.