Linux Tutorials Others

Install LAMP Server with phpMyAdmin on CentOS 7 / RHEL 7


LAMP is a combination of operating system and open-source software stack. The acronym of LAMP is derived from first letters of Linux, Apache HTTP Server, MySQL/MariaDB database, and PHP/Perl/Python.

In this tutorial, let us see how to setup LAMP server on CentOS / RHEL 7.

Setup Hostname and point it to your server ip

edit your hostname at

vi /etc/hostname


point your hostname to your ip address

vi /etc/hosts

guess_linux_lamp_phpmyadmin4 guess_linux_lamp_phpmyadmin5

reboot the server


in my case my site is registered through godaddy so i need to add an A Record to my dns follow the below steps

guess_linux_lamp_phpmyadmin7 guess_linux_lamp_phpmyadmin8 guess_linux_lamp_phpmyadmin9 guess_linux_lamp_phpmyadmin10

test the ping result


Installing LAMP with phpMyAdmin all together

but before and EPEL to your repo

yum install epel-release

yum update
yum install httpd mariadb-server mariadb php php-mysql php-gd php-pear phpmyadmin

guess_linux_lamp_phpmyadmin12 guess_linux_lamp_phpmyadmin13 guess_linux_lamp_phpmyadmin14 guess_linux_lamp_phpmyadmin15 guess_linux_lamp_phpmyadmin16

Configuring LAMP Server

1)  for MariaDB

start and enable mariadb

systemctl start mariadb
systemctl enable mariadb


set password for mariadb


guess_linux_lamp_phpmyadmin19 guess_linux_lamp_phpmyadmin20 guess_linux_lamp_phpmyadmin21

2) php is already installed and configured autometically

3) Configure phpMyAdmin

By default, phpMyAdmin can only be accessed from the localhost itself. To make it to accessible globally, do the following steps.

edit the following configuration

vi /etc/httpd/conf.d/phpMyAdmin.conf


comment line no 17, 18 and add Require all granted after line no 18

<IfModule mod_authz_core.c>
# Apache 2.4
# Require ip
# Require ip ::1
Require all granted


Restart all the lamp service and enable it

systemctl start httpd
systemctl enable httpd
systemctl restart mariadb



Create a sample index.php” file in Apache document root folder and append the lines as shown below:

vi /var/www/html/index.php

Add the following lines.



and open your ip or hostname in browser her mine is and hostname

Testing phpMyAdmin

open http://hostname/phpmyadmin i.e or http://your-ip/phpmyadmin

guess_linux_lamp_phpmyadmin26 guess_linux_lamp_phpmyadmin27 guess_linux_lamp_phpmyadmin28 guess_linux_lamp_phpmyadmin29

Thank you.


Leave a Comment