How to Install LAMP stack on CentOS 7
LAMP is a very common example of a web service stack, named as an acronym of the names of its original four open-source components: The Linux operating system, the Apache HTTP Server, the MySQL relational database management system, and the PHP programming language. The most effective way to develop a simple to the complex enterprise-level web application is by using a LAMP as it holds customization, flexibility, and cost-effective, powerful security features. All the components in the LAMP stack are open source software that is readily available in free.
Step 1: Installation Of Apache
Run the below yum command to install Apache.
yum install -y httpd
Next, Start and enable Apache by running the following command.
systemctl start httpd.service systemctl enable httpd.service
Check the status of Apache.
systemctl status httpd.service
Check whether the service is running by going to your server’s public IP address. The browser should display the test CentOS 7 Apache web page.
Step 2: Installation Of Mariadb
Install MariaDB with the command.
yum install mariadb-server mariadb -y
Start and enable MariaDB using the command.
systemctl start mariadb systemctl start mariadb
Run MySQL Security Script.
Press Enter and create a new password for the mariadb. Press Enter for all other options.
Step 3: Installing PHP
Install the MySQL extension along with PHP, again using the yum package installer, with the command.
yum install php php-mysql -y
To have your Apache webserver start co-working with PHP, restart the server.
systemctl restart httpd.service
Test PHP Processing.
Use a basic PHP script to make an info.php file, with the command.
<?php phpinfo (); ?>
Check whether PHP is working by visiting the following URL.
We hope this article helped you learn how to install LAMP stack. The main usage is creating web applications. It has to include an operating system, a web server, a database, and a programming language. TheStack is one of the best web hosting providers that offer premium shared web hosting, cheap dedicated server hosting, VPS server, WordPress hosting, server management and monitoring and DevOps support services. Be assured with our services and reach out to our team of experts to know more.