Update all packages
Once you are logged in to the server run the following command to make sure that all installed packages are up to date
yum -y update
Install LAMP stack
As mention in the requirements section of the tutorial, a LAMP stack (Apache, MySQL/MariaDB and PHP) is required to run phpMyAdmin no the server. We will start with installing Apache web server
yum -y install httpd
After the installation is completed, start the web server and enable it to start upon server boot
systemctl enable httpd
Next, install PHP along with the required PHP extensions
yum -y install php php-common php-mbstring php-gd
And finally, complete the LAMP installation by installing MariaDB database server
yum -y mariadb mariadb-server
Start the service and set it to start on reboot
systemctl start mariadb systemctl enable mariadb
Run the ‘mysql_secure_installation’ post installation script provided by MariaDB to strengthen the security of the database server and set a root password. You can use the following options:
mysql_secure_installation
Set root password? [Y/n] Y Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y
Install phpMyAdmin
phpMyAdmin is not available in the official CentOS 7 repositories, so we will have to enable the EPEL repository by executing the following command
yum -y install epel-release
Once the EPEL repository is enabled we can proceed with the phpMyAdmin installation
yum -y install phpmyadmin
The package manager will install phpMyAdmin and all necessary dependencies and the installation of phpMyAdmin is completed. You can now access the application and start working on your databases at http://IP_Address/phpmyadmin .
By default phpMyAdmin is only accessible from the localhost. If you want it to be accessible from everywhere or a certain IP address, open its included Apache configuration file and add/edit the following lines accordingly:
/etc/httpd/conf.d/phpMyAdmin.conf
deberas de agregar manualmente las lineas en negrito exactamente como esta en el siguiente ejemplo(agregalas a mano ya que puede darte error)
<Directory/usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModulemod_authz_core.c>
# Apache 2.4
<RequireAny>
#ADD following line:
Require all granted
Require ip 127.0.0.1
Require ip ::1
</RequireAny></IfModule><IfModule !mod_authz_core.c>
# Apache 2.2
#CHANGE following 2 lines:
Order Allow,Deny
Allow from All
Allow from 127.0.0.1
Allow from ::1
</IfModule></Directory>
desactivamos firewall e iptables
systemctl stop iptables systemctl disable iptables systemctl mask iptables
Disable Firewalld
To disable firewalld, run the following command as root:
systemctl disable firewalld
Stop Firewalld
To stop firewalld, run the following command as root:
systemctl stop firewalld
reboot