To install Apache use this command:
sudo yum install httpd
Once you have installed apache it will start. To start Apache server use this command:
systemctl start httpd
You can enable Apache automatically starting at boot time with this command:
systemctl enable httpd
INFO: it is a good idea to check the status of the server after starting Apache with this command:
systemctl status httpd
Apache is ready. The next is installing MySQL (MariaDB). You can install MySQL via this command:
sudo yum install mariadb-server mariadb
After processing you should start the server with this command:
sudo systemctl start mariadb
Now you have installed MySQL (MariaDB) in your Debian 9. But we recommend you to run the following command to set a new root password, “remove anonymous users”, “disallow root login remotely”, “remove test database and access to it”, “reload privilege tables”:
TIP: After running this command the system will ask you “Enter current password for root (enter for none):” here just press enter because you still haven’t any password set. Then you will see “Set root password? [Y/n]” type “y” to set password. In the next line there will be “New password:” line here you should create some password for your server and “Re-enter new password” in the next line. Now you have a new password. On the other questions that you can see above you can answer yes “y”.
Now let’s start installing PHP. It is simple - just run this command:
yum install php php-mysql
INFO: “php -mysql” for including support package for the MySQL.
After installation PHP it is a good idea to restart the server. To do this use the following command:
systemctl restart httpd.service
By using this command you will install PHP 5 but if you want to install PHP 7 check this: That is all!!!