Linux Tutorials Others

Install LAMP Server with phpMyAdmin on CentOS 7 / RHEL 7

main_image_lamp

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

guess_linux_lamp_phpmyadmin1guess_linux_lamp_phpmyadmin2

point your hostname to your ip address

vi /etc/hosts

guess_linux_lamp_phpmyadmin4 guess_linux_lamp_phpmyadmin5

reboot the server

guess_linux_lamp_phpmyadmin6

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

guess_linux_lamp_phpmyadmin11

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

guess_linux_lamp_phpmyadmin18

set password for mariadb

mysql_secure_installation

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

guess_linux_lamp_phpmyadmin22

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

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

guess_linux_lamp_phpmyadmin23

Restart all the lamp service and enable it

systemctl start httpd
systemctl enable httpd
systemctl restart mariadb

guess_linux_lamp_phpmyadmin24

Testing

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.

<?php
phpinfo();
?>

guess_linux_lamp_phpmyadmin25

and open your ip or hostname in browser her mine is 139.59.23.34 and hostname lamp.guesslinux.com

Testing phpMyAdmin

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

guess_linux_lamp_phpmyadmin26 guess_linux_lamp_phpmyadmin27 guess_linux_lamp_phpmyadmin28 guess_linux_lamp_phpmyadmin29

Thank you.

2 Comments

Leave a Comment