How to install phpMyAdmin on Rocky Linux

3 years ago 430

Databases are considerably easier to negociate from wrong a GUI. If you've migrated your servers from CentOS to Rocky Linux, you mightiness privation to instal phpMyAdmin. Jack Wallen shows you how.

database head  working

Image: iStock/GaudiLab

If you're a database administrator, and you person to negociate either MySQL oregon MariaDB connected your information halfway servers, you cognize the payment of having a bully GUI to marque the task a spot much efficient. And if your servers person migrated from CentOS to Rocky Linux, you mightiness beryllium a spot disquieted astir getting specified a GUI up and running. Fret not. There's ever phpMyAdmin.

The occupation with phpMyAdmin is that the installation connected Rocky Linux (and astir RHEL clones) isn't astir arsenic straightforward arsenic it is with Ubuntu. But I'm going to assistance you retired with that. Once you've walked done this tutorial, you'll person phpMyAdmin up and moving successful minutes.

Are you ready?

SEE: Kubernetes: A cheat expanse (free PDF) (TechRepublic)

What you'll request

To get phpMyAdmin installed, you'll request a moving lawsuit of Rocky Linux and a idiosyncratic with sudo privileges. That's it. Let's get to work.

How to instal Apache and MySQL

Before you instal the web and database server, marque definite to update Rocky Linux with:

sudo dnf update -y

After the update completes, reboot (if the kernel is updated) and past instal the webserver with:

sudo dnf instal httpd -y

Start and alteration the webserver with:

sudo systemctl commencement httpd sudo systemctl alteration httpd

Next, we request to let HTTP services done the firewall with the pursuing commands:

sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=https sudo firewall-cmd --reload

Now, we tin instal the database with:

sudo dnf instal mysql-server mysql -y

Start and alteration MySQL:

sudo systemctl commencement mysqld sudo systemctl alteration mysqld

Secure the database installation with:

mysql_secure_installation

How to instal PHP

We present request to instal PHP, which is done successful a overmuch antithetic mode than it is connected Ubuntu. First, let's reset the php module with:

sudo dnf module reset php

Now, we tin alteration PHP 7.4 with:

sudo dnf module alteration php:7.4

Now we tin instal PHP and the assorted modules required for phpMyAdmin with:

sudo dnf instal php php-common php-opcache php-cli php-gd php-curl php-mysqlnd php-xml -y

How to download and unpack phpMyAdmin

Next, we'll download the phpMyAdmin record with the command:

wget https://files.phpmyadmin.net/phpMyAdmin/5.1.1/phpMyAdmin-5.1.1-all-languages.zip

Make definite to cheque the official download page to guarantee you're downloading the astir caller version.

Unpack the record with:

unzip phpMyAdmin-*-all-languages.zip

If unzip isn't installed, instal it with:

sudo dnf instal unzip -y

Move and rename the recently created directory with:

sudo mv phpMyAdmin-*-all-languages /usr/share/phpmyadmin

How to configure phpMyAdmin

For our adjacent trick, we'll configure phpMyAdmin. Change into the phpmyadmin directory with:

cd /usr/share/phpmyadmin

Copy the illustration configuration record with the command:

sudo mv config.sample.inc.php config.inc.php

Now, we request to make a 32-bit concealed drawstring with:

openssl rand -base64 32

Copy the resultant string.

Open the phpMyAdmin configuration record with the command:

sudo nano config.inc.php

In that file, look for the line:

$cfg['blowfish_secret'] = '';

Paste the 32-bit concealed drawstring betwixt the 2 azygous quotes.

Scroll down to the Directories for saving/loading files from sever conception and adhd the pursuing line:

$cfg['TempDir'] = '/tmp';

Save and adjacent the file. 

Create a caller tmp directory and springiness the everything the indispensable permissions/ownership with the pursuing commands:

sudo mkdir /usr/share/phpmyadmin/tmp sudo chown -R apache:apache /usr/share/phpmyadmin sudo chmod 777 /usr/share/phpmyadmin/tmp

How to make an Apache config record

Our adjacent measurement is to make an Apache config record with the command:

sudo nano /etc/httpd/conf.d/phpmyadmin.conf

In that file, paste the following:

Alias /phpmyadmin /usr/share/phpmyadmin<Directory /usr/share/phpmyadmin/> AddDefaultCharset UTF-8 <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> Require each granted </RequireAny> </IfModule> </Directory> <Directory /usr/share/phpmyadmin/setup/> <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> Require each granted </RequireAny> </IfModule> </Directory>

Save and adjacent the file.

How to acceptable the SELinux policies

In bid for SELinux to let postulation to the alternate determination (/usr/share/phpmyadmin), we request to marque it aware. To bash that, contented the command:

sudo chcon -Rv --type=httpd_sys_content_t /usr/share/phpmyadmin/*

Restart Apache with the command:

sudo systemctl restart httpd

How to entree the phpMyAdmin web interface

Everything should present beryllium acceptable to go. Open a web browser and constituent it to http://SERVER/phpmyadmin (Where SERVER is the IP code of your hosting server) and you should beryllium prompted for the login credentials. 

Congratulations, you've conscionable installed phpMyAdmin connected Rocky Linux, for easier MySQL database administration.

Data Center Trends Newsletter

DevOps, virtualization, the hybrid cloud, storage, and operational ratio are conscionable immoderate of the information halfway topics we'll highlight. Delivered Mondays and Wednesdays

Sign up today

Also see

Read Entire Article