How to Install LAMP (Linux, Apache, MariaDB, PHP 7) on CentOS

LAMP is a term that stands for Linux, Apache, MySQL and Perl/PHP/Phyton. It is a free software package used to run a complete application.

 

Components from LAMP :

  • Linux ▪ operating system
  • Apache HTTP Server ▪ web server
  • MariaDB or MySQL system database
  • PHP or Perl or Python ▪ programming language to use

 

The following are easy ways of installing LAMP at CentOS :

  • Login to your VPS/Server CentOS as ▪root or user who has permission to ejectinstall All the stuff. Web Server (For login may be used Putty on Windows or enter terminal in Linux)
  • If you've been on Terminal Linux CentOS, please do a yum function update first to smooth the process installation LAMP by typing the following commands:

sudo yum update

  • When finished with the update, it will display like this :

  • After updating the yum function completed, the following does to install Apache by typing the following command :

sudo yum install httpd

  • When you're done, run. Apache already terinstall by typing the following command :

sudo systemctl start httpd.service

  • After installation if you're done, you can check through the browser by typing your VPS IP address, let's say if your VPS IP is 192.168.1.2, you can type http://192.168.1.2 on your browser
  • If successful it will display the view whatche default page on your browser as follows:

  • Next you do to install MariaDB

MariaDB is a platform database created by MySQL developers. Since MySQL has been acquired by the Oracle, developers have moved on to create new Database platforms that have a lot more than MySQL. MariaDB is a follow-up project created by MySQL developers, so all commands and syntax mySQL are fully compitable with MariaDB.

  • To install MariaDB to CentOS, please type in the following command :

sudo yum install -y MariaDB-server MariaDB-client

  • If successful, it will display as follows:

-y parameters find answers y (yes) to every yes/no question

  • Next, execute MariaDB by typing the following commands:

sudo systemctl start MariaDB

  • Then you can check MariaDB's status by typing the following commands:

sudo systemctl status MariaDB

  • If successful, it will display as follows:

  • Then to secure MySQL, You may type the following command :

sudo mysql_secure_installation

*At this process, type Y for each question

  • If successful, it will display as follows:

  • Next we install PHP on CentOS using the following command :

sudo yum install php php-mysql

  • If successful, it will display as follows:

  • Furthermore, if the installation process is complete, then all you're doing is restarting it on Apache by typing the following command :

sudo systemctl restart httpd.service

  • You have installed it successfully LAMP on your VPS/Server CentOS, and by default your website is on directory /var/www/html


How to Install cPanel/WHM on a VPS or Virtual Data Center
How to Change the Root Password on a Linux Cloud VPS