Installation and Configuration of LAMP on CentOS 7
Lamp is an abbreviation of Linux, Apache, MySQL and PHP. Linux is an operating system, here we are using operating system for this lab scenario is CentOS Linux 7 (Redhat Linux 7). Apache is a web server also called HTTP server that is a open source, Apache is developed by open community of developers. Here we are installing mariadb server for database that is fork of MySQL relational database, mariadb is a open source software that have a General Public License. PHP is Hypertext preprocessor, php is a opensource scripting language that is use for web development. PHP files contains CSS, HTML, java script and php code.
This lab is perform on domain authenticated CentOS Linux 7 machine. Domain user "administrator" is use for the complete installation and configuration of LAMP server.
Login with the domain administrator, to verify this is domain administrator type the below mention command.
id administrator
To clean all the repositories on Redhat/CentOS Linux base operating system type the below mention command. Use sudo to perform administrative task with root privilidges.
To update the machine type the below mention command. It is not necessary to update the entire operating system before install and configure LAMP server but it is a good practice because due to update Redhat/CentOS Linux base operating system goes to latest kernel and resolve almost all vulnerabilities that is also called patching.
The update process has been completed successfully as shown in below mention image.
Install Apache Web Server:
To install Apache web server on CentOS Linux 7 machine type the below mention command.
sudo yum install httpd -y
The Apache web server on CentOS Linux 7 machine has been successfully install as shown in below mention image.
To start and enable Apache web service on CentOS and RedHat Linux base operating system type the below mention command.
sudo systemctl start httpd.service
sudo systemctl enable httpd.service
To check the status of Apache web service on CentOS/Redhat Linux 7 operating system type the below mention command.
sudo systemctl status httpd.service
To allow the web page behind the firewall on port 80, type the below mention command. In CentOS/Redhat Linux 7 machine firewalld daemon is use as firewall.
sudo firewall-cmd --permanent --add-port=80/tcp
After allow port through firewall should reload the firewall by type the below mention command.
sudo firewall-cmd --reload
To open Apache web page on web browser use IP or full qualified domain name or hostname. Here we are use IP.
Install MySQL Server (MariaDB):
MariaDB is fork of MySQL Server that is use as a database for the application data store. To install MariaDB server on CentOS Linux 7 machine type the below mention command.
sudo yum install mariadb-server mariadb -y
The installation of MariaDB Server on CentOS Linux 7 machine has been completed successfully as shown in below mention image.
To start and enable mariadb service on CentOS and Redhat Linux 7 machine type the below mention command.
sudo systemctl start mariadb
sudo systemctl enable mariadb
To secure the SQL Server (MariaDB), type the blow mention command.
sudo mysql_secure_installation
For proper authentication set root password by press key "y".
To remove anonymous user press "y", disallow root login remotely press "y", to remove test database press "y" and to ensure all the changes effect immediately press "y".
Installation of PHP:
For the installation of PHP, first install the yum-util to enable the EPEL (Extra Packages for Enterprise Linux) repository.
sudo yum install yum-utils -y
To enable the epel repository type the below mention command.
sudo yum install epel-release
Then install remi repository type the below mention command.
sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Here we install php by use of remi repository, therefore first enable the PHP type the below mention command.
sudo yum-config-manager --enable remi-php73
To install the PHP and require PHP modules type the below mention command.
sudo yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysqlnd
Installation of PHP and its modules has been installed successfully as shown in below mention image.
After installation of PHP, check the php version type the below mention command.
After installation of PHP need to restart Apache web service.
sudo systemctl restart httpd.service
Then check the status of Apache web service type the below mention command.
sudo systemctl status httpd.service
Create a info.php file in default location of Apache web server directory to verify PHP is install successfully.
vi /var/www/html/info.php
Add the below mention line.
To check the info.php page on web browser, type the below mention URL. Modify the URL as per the environment.
http://192.168.10.226/info.php
Thanks for read this Article
Comments
Post a Comment