Ubuntu 18.04 in Azure – Pt. 2: LAMP

Now that we’re sufficiently protected from all the bad h4x0r5 in the world, it’s time to install Apache, MySQL, and PHP for our upcoming (and obviously already completed) WordPress install.

sudo apt install apache2 -y
sudo ufw allow in “Apache Full”

Be sure, at this point, to create a firewall rule in Azure> Networking to enable inbound communication on 80 and 443.

Once Apache is installed and allowed to communicate, it is time to install MySQL.

sudo apt install mysql-server -y
sudo mysql_secure_installation
VALIDATE PASSWORD PLUGIN=Y
Create applicable password as prompted.
Press Y and <enter> for remaining prompts.
sudo mysql
mysql> ALTER user ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘<new very secure password>’
mysql> FLUSH PRIVILEGES
mysql> exit

Last but not least, time to install PHP.

sudo apt install php libapache2-mod-php php-mysql
Move index.php to the first position after DirectoryIndex within /etc/apache2/mods-enabled/dir.conf
<IfModule mod_dir.c>
DirectoryIndex
index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>

sudo systemctl restart apache2

FIN. I love LAMP.

Image result for I love LAMP

Leave a Reply

Your email address will not be published. Required fields are marked *