Install a LAMP Stack on CentOS 7

Introduction

LAMP Stack,Install a LAMP is a aggregate of working device and software program which enables you to host web sites and web apps on your server.

The term “LAMP” stands for Linux, Apache, MySQL/MariaDB and PHP.

Apache: Runs the internet server MySQL/MariaDB: Stores internet site information PHP: Processes net content material In this academic, we are able to deploy a LAMP stack on a CentOS 7 server.

LAMP Stack,Install a LAMP Requirements

  • A server running CentOS 7
  • A static IP Address for your server

LAMP Stack,Install Apache Web Server

LAMP Stack,Install a LAMP is a aggregate of working device and software program which enables you to host web sites and web apps on your server. Install a LAMP is a aggregate of working device and software program which enables you to host web sites and web apps on your server. ,You can install Apache easily using the CentOS package manager. To do this, run:

sudo yum install httpd

Once installation has finished, you will need to start Apache service and enable it to start on boot. To do this, run:

sudo systemctl start httpd.service
sudo systemctl enable httpd.service

Next you will need to allow the default Apache port 80 (HTTP) and 443 (HTTPS) using firewalld. You can do this by running the following commands:

sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=443/tcp

Reload the firewall service for the changes to take effect.

sudo firewall-cmd --reload

You can test the Apache service using your browser by visiting http://server-ip-address You will see the default CentOS 7 Apache web page, It should look something like this:

LAMP Stack,Install a LAMP Install MariaDB

MariaDB is a drop-in replacement for MySQL. It is easy to install, offers many speed and performance improvements, and is easy to integrate into most MySQL deployments. MariaDB offers more storage engines than MySQL, including Cassandra, XtraDB and OQGRAPH

You can install it by running the following command:

sudo yum install mariadb-server mariadb

Once the installation is complete, you will need to start MariaDB by running the following command:

sudo systemctl start mariadb

Be sure that MariaDB starts at boot:

sudo systemctl enable mariadb

Now, you will need to secure the MariaDB installation. You can do this by running:

sudo mysql_secure_installation

Answer all the questions shown as below:

  • Enter current password for root (enter for none): currentrootpasswd
  • Set root password? [Y/n]: Press Enter
  • New password: rootsqlpasswd
  • Re-enter new password: rootsqlpasswd
  • Remove anonymous users? [Y/n]: Press Enter
  • Disallow root login remotely? [Y/n]: Press Enter
  • Remove test database and access to it? [Y/n] : Press Enter
  • Reload privilege tables now? [Y/n] : Press Enter

Your MySQL installation should now be secure.

Finally, use the following command to enable the MariaDB service to start on boot:

sudo systemctl enable mariadb.service

Install PHP

PHP is an open source web scripting language which is used to build dynamic web pages.

To install PHP and related modules, use the following command:

sudo yum install php php-mysql php-gd

Once PHP is installed, restart the Apache server: