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.
Now lets go ahead and install the web server.
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.
We should also set it so the web server starts at boot.
Now lets install the MySQL server. By default CentOS 7 uses MariaDB instead of the regular MySQL packages.
Start the MySQL server now.
Now that MySQL is running we can run the installation script to change some basic settings.
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.
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.
Now restart the web server.
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.
Once you've downloaded it, lets unzip the archive and rename the unzipped folder.
Navigate in the new directory now and lets rename the configuration file.
Everything is now ready!
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.
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.