Step 1 – Installing Apache
Update the package list for upgrades and new packages:
sudo apt-get update
Now Apache can be installed.
sudo apt-get install apache2
Step 2 – Installing MySql
Install MySql Server
sudo apt-get install mysql-server
After MySql has been installed, you will need to set the root password of the database and secure it using the following command :
You will be presented a screen where MySQL asks whether you would like to activate the VALIDATE PASSWORD PLUGIN. For now, keeping things simple, type no.
In the next type the root password of your choice. Confirm it again.
In the next screen MySql will ask whether to remove anonymous users. Type yes Disallow root login remotely?
Type No Remove test database and access to it?
Type Yes Reload privilege tables now?
After the password has been set you can check the whether MySQL is working correctly by logging into the database with the command :
sudo mysql -u root -p
Password is the same that was set in the previous step.
Step 3 – Installing PHP with Common Extensions
Now install PHP and commonly used PHP extensions by using the following command :
sudo apt-get install php libapache2-mod-php php-mysql php-curl php-gd php-json php-zip php-mbstring
After PHP has been installed, restart Apache.
sudo service apache2 restart