This tutorial explains how you can install and configure LAMP and phpMyAdmin on CentOS 5.11 and CentOS 6.7, 32 and 64 Bit OS versions.
First of all we will update system:
1 |
yum update -y |
Install EPEL repository for your Linux version.
If you are running an CentOS 5 version:
1 |
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm && rpm -Uvh epel-release-latest-5.noarch.rpm |
If you are running an CentOS 6 version:
1 |
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm && rpm -Uvh epel-release-latest-6.noarch.rpm |
We will install Apache, MySQL, PHP and phpMyAdmin:
1 |
yum install httpd mysql mysql-server php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml phpmyadmin -y |
Edit /etc/httpd/conf.d/phpMyAdmin.conf file. Use a # and comment all lines in <Directory “/usr/share/phpMyAdmin/”> … </Directory> section:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#<Directory /usr/share/phpMyAdmin/> # <IfModule mod_authz_core.c> # # Apache 2.4 # <RequireAny> # Require ip 127.0.0.1 # Require ip ::1 # </RequireAny> # </IfModule> # <IfModule !mod_authz_core.c> # # Apache 2.2 # Order Deny,Allow # Deny from All # Allow from 127.0.0.1 # Allow from ::1 # </IfModule> #</Directory> |
Edit /usr/share/phpmyadmin/config.inc.php file and replace ‘cookie’ with ‘http’:
1 |
$cfg['Servers'][$i]['auth_type'] = 'http'; |
Restart Apache and MySQL services:
1 2 |
service httpd start service mysqld start |
Improve MySQL Installation Security:
1 |
mysql_secure_installation |
And follow these steps:
1 2 3 4 5 6 7 8 |
Enter current password for root (enter for none): # press Enter Set root password? [Y/n] # press Enter New password: # Type an root password here Re-enter new password: # Confirm the password 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 |
Type following commands to start Apache and MySQL automatically on every reboot:
1 2 |
chkconfig httpd on chkconfig mysqld on |
Now you can access phpMyAdmin in browser using following url: http://serverIP/phpmyadmin (change serverIP with your server IP).