Black Friday Hosting Deals: 69% Off + Free Migration: Grab the Deal Grab It Now!
If you work with MySQL or MariaDB databases, it is an essential application. A parameter that makes operation easier is that it enables you to work through a web interface with your databases, where you can perform tasks such as queries, table management, and even back up your data.
Here are the eight steps to easily install phpMyAdmin on CentOS 7.
Before installing anything new, it's a good idea to update your existing packages. Open your terminal and run:
sudo yum update -y
By making sure all of your installed packages are up to date, this tool helps prevent conflicts during installation.
To utilize phpMyAdmin, you need to activate the EPEL. Install it with:
sudo yum install epel-release -y
The EPEL repository contains additional packages not found in the CentOS base repository, including phpMyAdmin.
phpMyAdmin requires a web server to function. Apache is a popular choice and is available in the CentOS repositories. Install Apache using:
sudo yum install httpd -y
After installation, start and enable Apache to run on boot:
sudo systemctl start httpd
sudo systemctl enable httpd
You can verify that Apache is running by visiting your server’s IP address in a web browser. You should see the Apache test page.
phpMyAdmin also requires PHP, the scripting language it’s built with. Install PHP and a few necessary extensions:
sudo yum install php php-mbstring php-zip php-gd php-json php-xml -y
Once PHP is installed, restart Apache to load the new PHP modules:
sudo systemctl restart httpd
If you don’t already have a MySQL or MariaDB server installed, you’ll need to set one up. Install MariaDB (a popular MySQL fork) using:
sudo yum install mariadb-server mariadb -y
Start and enable MariaDB:
sudo systemctl start mariadb
sudo systemctl enable mariadb
Secure your installation by running:
sudo mysql_secure_installation
Follow the prompts to set the root password and remove insecure defaults.
Now you’re ready to install phpMyAdmin. Simply run:
sudo yum install phpmyadmin -y
For security purposes, you might want to limit access to phpMyAdmin to particular IP addresses. Edit the configuration file:
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf
Look or the lines that start with Require and update them according to your network setup. For example, to allow access from a specific IP address, replace Require local with:
apache
Require ip your.ip.address.here
If you want to allow access from any IP address (not recommended for security reasons), you can use:
apache
Require all granted
After making changes, save and close the file (Ctrl+X to exit, Y to confirm changes).
For the changes to take effect, restart Apache:
sudo systemctl restart httpd
Now–you should be able to access phpMyAdmin by navigating to:
http://your-server-ip/phpmyadmin in your web browser.
Security: phpMyAdmin should be protected with additional security measures, such as using HTTPS and strong passwords. Consider setting up a firewall or VPN to restrict access further.
Firewall Settings: Assuming that your firewall is activated, confirm that HTTP and HTTPS traffic is permitted. To accomplish this, use:
sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=https sudo firewall-cmd --reload |
SELinux:It may be necessary for you to setup SELinux if you're using it in order for phpMyAdmin to work correctly. To set the relevant policies, use the setsebool command.
Setting up phpMyAdmin on CentOS 7 is very simple if the following procedures are followed. That’s it. Congratulations! Once you have phpMyAdmin installed, managing your databases will be doubly easier using this web interface. Security is always important when database management tools are accessed over the web.
Let’s talk about the future, and make it happen!
By continuing to use and navigate this website, you are agreeing to the use of cookies.
Find out more