How To Install Apache, MySQL, & PHP on Windows Subsystem for Linux (WSL)

preview_player
Показать описание
View on website:

In this video, part 2 of the series of setting up a development environment on Windows Subsytem for Linux (WSL), I show you how to install a LAMP server. This means installing Apache, MySQL, & PHP.

It's easy to do and I'll put the commands here.

Before getting started, update and upgrade the software you have on your Linux installation.

Run:
sudo apt update [press enter]
sudo apt upgrade [press enter]

How to Install Apache2 on WSL
First, we will install Apache.

Run:
sudo apt install apache2
Press y, then enter to agree to disk space usage

Then, start apache and install it as a system service

Run:
sudo service apache2 start [press enter]
sudo systemctl enable apache2 [press enter]

How to install MySQL on WSL

Run:
sudo apt install mysql-server [press enter]
press y, then enter to agree to disk space usage

Secure MySQL installation on WSL

Run:
sudo mysql_secure_installation [press enter]

Follow the prompts.

Set MySQL Root Password on WSL

Run:
sudo mysql [press enter]

Type:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'yourpasswordhere'; [press enter]

Replace 'yourpasswordhere' with your actual password.

Type:
FLUSH PRIVILEGES; [press enter]
exit; [press enter]

How to Install PHP on WSL

Run:
sudo apt install php libapache2-mod-php php-mysql [press enter]

Restart webserver

Run:
sudo service apache2 [restart]

Your web files will be located in /var/www/html

Test PHP is working

(replace [ with less than sign, youtube won't allow me to type the less than sign)
[?php

phpinfo();

In the next videos we will cover installing phpmyadmin, ssl (so we can use https://) and setting up apache virtual hosts.
Рекомендации по теме
visit shbcf.ru