A LAMP stack contains several components: Linux, Apache, MySQL, and PHP. The Linux portion of the stack is taken care of when your new server is launched.


To install Apache, type sudo yum install httpd from a command prompt.

You will then see a report showing the version of Apache to be installed, a list of any dependencies needed for installation, and the amount of disk space that will be used in the installation.

Type y to proceed with the installation.

If you have not previously confirmed the CentOS Signing Key, you will be
prompted to do so. Type y to confirm and proceed.

The software will then begin installing. Installation may take a few
minutes. When the software has successfully been installed, you will see a status message that shows all software that was successfully installed.

To start Apache, type sudo service httpd start.

To set Apache to run upon boot, type sudo systemctl enable httpd.service.

The Apache Web service should now be up and running. To test whether Apache is running, open a Web browser and type your server’s IP address into the address bar, as follows:

http://your server’s IP address

If the Apache Web service is running properly, you should see a page similar to the following:


To install PHP, type: sudo yum install php php-mysql

Confirm the packages to be installed, and enter y to continue.

The software will then begin to be installed. That may take a few minutes.
Upon completion, a confirmation screen will be shown.

To confirm the PHP CLI is in place, type: php -v


To install MariaDB, type: sudo yum install mariadb-server mariadb

Confirm the packages to be installed.

Once done, a confirmation screen will be shown.

To launch the MariaDB service, type: sudo systemctl start mariadb

At this point, MySQL will be running but will not secured with a login
password. To set a password and perform basic configuration, run: sudo mysql_secure_installation

For the current password prompt, hit enter to enter a blank password. This will work because no password was configured by default.

For the current password prompt, hit enter to enter a blank password as
none was configured by default. When prompted for “Set root password?”, type Y. Enter the desired password at the “New Password:” and “Re-enter New Password:” prompts.

When prompted to “Remove anonymous users”, type Y to remove the default anonymous login.

When prompted for “Disallow root login remotely”, select ‘Y’ if you wish to
restrict the root login to be used only from the server itself. That is
highly recommended to prevent issues with password cracking attempts
against the root user. For remote access to the DBs, that should normally
be handled under different usernames that you configure.

For “Remove test database and access to it?”, select ‘Y’ if you wish to
remove that. Removing that is highly recommended.

Finally, when prompted for “Reload privilege tables now?”, enter ‘Y’ again
to update MySQL to the new settings selected. That should result in a
final confirmation screen of:

The MySQL installation can be tested with:

mysqladmin -uroot -p processlist

When prompted for a password, enter the root user MySQL password selected
while running “mysql_secure_installation” above. The output from that
should look like:

Further Documentation

To further configure the software to your specific projects, the
documentation for each package can be consulted.


The Apache Getting Started Guide is at:


PHP documentation can be found at:


The PHP Getting Started Guide is at:


MySQL documentation is at: