Setting up LAMP server on Windows 10 WSL2
With the inclusion of Linux WSL2 (Windows Subsystem for Linux 2) into windows 10, it has become even easier use your windows system as development station with native Linux tools. One very prominent of these is setting up of LAMP (Linux Apache MySQL PHP) server. Instead of installing other software to help develop on windows, it is certainly advisable to prepare your windows workstation as a LAMP development platform using WSL2.
Here, I am going to explain the process step by step.
First, we have to activate WSL2 on windows 10. Next, we will install apache server.
sudo install apache2
After that, we will install PHP
sudo install php
Then install MariaDB
sudo install mariabd-server
Start the apache server and MySQL server (MariaDB) now
sudo service apache2 start
sudo service mysql start
Then, we will install phpmyadmin for management of database from our windows browser.
sudo install phpmyadmin
Remember to setup the password during installation of phpmyadmin.
Now, we need to set password for root user of MySQL. For that, we will issue the following commands:
UPDATE mysql.user set password=password('newpassword'), plugin='mysql_native_password' where user='root';
Now, you should be able to see the apache page by pointing your windows browser to 127.0.0.1.