How to Setup LAMP Stack on Centos 7 - Right Way

Today I am going to follow up the procedures to setup standard LAMP stack on CentOS 7.
For the latest version of phpMyAdmin:

1rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
2yum -y install epel-release

For MariaDB:

1yum -y install mariadb-server mariadb
2systemctl enable --now mariadb
3mysql_secure_installation

For Apache:

1yum -y install httpd
2systemctl enable --now httpd

For PHP:

1rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm
2yum -y install yum-utils
3yum update -y
4yum-config-manager --enable remi-php73
5yum -y install php php-opcache
6systemctl restart httpd

For making PHP work with MySQL:

1yum -y install php-mysqlnd php-pdo
2yum -y install php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap curl curl-devel
3systemctl restart httpd

For phpMyAdmin:

1yum -y install phpMyAdmin
2vim /etc/httpd/conf.d/phpMyAdmin.conf

For remote access to DB:

 1[...]
 2
 3Alias /phpMyAdmin /usr/share/phpMyAdmin
 4Alias /phpmyadmin /usr/share/phpMyAdmin
 5
 6<Directory /usr/share/phpMyAdmin/>
 7  AddDefaultCharset UTF-8
 8
 9  <IfModule mod_authz_core.c>
10    # Apache 2.4
11    # <RequireAny>
12    # Require ip 127.0.0.1
13    # Require ip ::1
14    # </RequireAny>
15    Require all granted
16  </IfModule>
17
18  <IfModule !mod_authz_core.c>
19    # Apache 2.2
20    Order Deny,Allow
21    Deny from All
22    Allow from 127.0.0.1
23    Allow from ::1
24  </IfModule>
25</Directory>
26
27<Directory /usr/share/phpMyAdmin/>
28  Options none
29  AllowOverride Limit
30  Require all granted
31</Directory>
32
33[...]

Finally, you did it!
Happy coding, Gents. ๐Ÿ™‚

comments powered by Disqus