LAMP (Apache, MySQL, PhpMyAdmin) Install on CentOS 7

This guide will show you how to install a basic LAMP stack setup on CentOS 7. LAMP stands for Linux, Apache, MySQL, PhpMyAdmin and provides the basic tools needed to host web files on your server. There's also alternative web servers to use such as Nginx, but require additional configuration. This guide is being done as root user.

Before we get started lets install nano, wget, and unzip. nano is an easy to use linux text editor, wget is required to download files, and unzip is needed to unzip archived files. We'll also update all of the already installed packages afterwards.

yum install nano wget unzip -y
yum update -y

Now lets go ahead and install the web server.
yum install httpd -y

Once it's installed lets start the web server. CentOS 7 does not use the same service commands as CentOS 6, you'll need to execute systemctl commands to manage service status.
systemctl start httpd.service

We should also set it so the web server starts at boot.
systemctl enable httpd.service

Now lets install the MySQL server. By default CentOS 7 uses MariaDB instead of the regular MySQL packages.
yum install mariadb mariadb-server -y

Start the MySQL server now.
systemctl start mariadb

Now that MySQL is running we can run the installation script to change some basic settings.
mysql_secure_installation

The MySQL installation script will first ask you to enter the current root password, leave this blank and press enter. Next it will ask you if you want to set a root password, enter Y for yes then enter a root password for the MySQL server to use. Next you can set it to remove anonymous users (default yes), disallow root login remotely (default yes), and remove the test database. Next you can reload privileges and exit.

Once you're done with the MySQL installation script we can set the MySQL server to start at boot.
systemctl enable mariadb.service

Now the web server and MySQL server are installed, lets go ahead and install PHP and a few required modules such as the MySQL extension, GD extension, and Mcrypt for PhpMyAdmin.
yum install php php-mysql php-gd php-mcrypt -y

Now restart the web server.
systemctl restart httpd.service

Now we can download and setup PhpMyAdmin on the web server. First lets navigate to the web directory on your server and download the PhpMyAdmin archive. We'll use version 4.2.12 for this.
cd /var/www/html
wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/4.2.12/phpMyAdmin-4.2.12-english.zip/download

Once you've downloaded it, lets unzip the archive and rename the unzipped folder.
unzip download
mv phpMy* phpmyadmin

Navigate in the new directory now and lets rename the configuration file.
mv config.sample.inc.php config.inc.php

Everything is now ready!

Additional Tips:
1) You may need to add rules to your firewall service to allow traffic to your web server and more, add the following rules to fix this.
firewall-cmd --zone=public --add-port=2888/tcp --permanent
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=3306/tcp --permanent
2) You may want to disable SELinux, as it may cause permission issues for certain applications running on your web server. You can do this by running "setenforce 0" in SSH.