Install LAMP Stack (Linux, Apache, MariaDB, php, phpMyAdmin) on CentOS/RHEL 6 & CentOS/RHEL 7

LAMP stands for Linux, Apache, MySQL & PHP and now it is called Linux, Apache, MySQL, MariaDB, MongoDB, PHP, PERL, PYTHON, PhpMyAdmin. In the real world 60% of websites are serving by LAMP. LAMP is a bunch of open-source software which is developed by different organizations.

1) Update your system upto date

Use the below command’s to keep your system upto date.

[Update your system to latest package]
# yum -y update

2) Insall Apache

Use the below command to install apache web server. The Apache HTTP Server is called Apache, Apache is a Web server application which is suitable for All LINUX and UNIX distribution and also provide support for windows. It is serving .html, .php, .pl, .cgi, etc ,..Apache is developed and maintained by open community of developers under Apache Software Foundation.

[Install Apache]
# yum -y install httpd

[Start, enable & check status of Apache service on systemd system RHEL/CentOS 7]
# systemctl start httpd.service
# systemctl enable httpd.service
# systemctl status httpd.service

[Start, enable & check status of Apache service on SysVinit system RHEL/CentOS 6]
# service httpd start
# chkconfig httpd on
# service httpd status

Open your web browser and navigate to http://localhost/ or http://your-server-ip-address/ or

2a) Enabling public access to web server

By default web server is only accessible in localhost. If you want to access publicly you need to allow http & https in firewall.

[Allow http, https in firewall & reload RHEL/CentOS 7]
# firewall-cmd --permanent --zone=public --add-service=http 
# firewall-cmd --permanent --zone=public --add-service=https
# firewall-cmd --reload

[Allow http, https in firewall & save RHEL/CentOS 6]
# iptables -I INPUT -p tcp --dport 80 -j ACCEPT
# iptables -I INPUT -p tcp --dport 443 -j ACCEPT
# service iptables save

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

Leave a Reply

Your email address will not be published. Required fields are marked *