Installing phpMyAdmin and WordPress on Rocky Linux

This guide walks through installing phpMyAdmin and WordPress on Rocky Linux, giving you a database you can manage from the browser and a working WordPress site on top of it. Adjust the paths, IP addresses, and database names to match your own setup as you go.

It assumes you’ve already got a LAMP stack (Linux, Apache, MySQL/MariaDB, PHP) installed on the machine, along with a user that has sudo access. If you haven’t set that up yet, do that first, since everything below builds on it.

Step 1: Install phpMyAdmin

Install phpMyAdmin from the REMI repository:

sudo dnf --enablerepo=remi install phpmyadmin -y

Step 2: Allow Access to phpMyAdmin

By default phpMyAdmin only allows connections from the server itself. To reach it from another machine on your network, edit its Apache config:

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

Find the <Directory /usr/share/phpMyAdmin/> block, comment out the Require local line, and add Require ip lines for the addresses you want to allow. For example, to permit the local machine plus one LAN address:

<Directory /usr/share/phpMyAdmin/>
    AddDefaultCharset UTF-8
    Require all granted
    Require ip 127.0.0.1
    Require ip ::1
    Require ip 192.168.1.44
    # Require local
</Directory>

Only open this up to addresses you trust, since phpMyAdmin is a direct door into your database. Then restart Apache so the change takes effect:

sudo systemctl restart httpd

Step 3: Log In and Create a Database

Open phpMyAdmin in a browser by going to your server’s address followed by /phpmyadmin, for example localhost/phpmyadmin or 192.168.1.44/phpmyadmin. Log in as root using the password you set during mysql_secure_installation.

Once in, create a new database for WordPress and a dedicated user with access to it. Using a separate user rather than root for the site is the safer approach, and you’ll need the database name, username, and password in a moment.

Step 4: Download and Place WordPress

Download the latest WordPress, unzip it, and move it into a directory under Apache’s web root. Here we’ll use /var/www/html/mysite, so swap that name for whatever you’d like your site’s folder to be called:

cd ~/
wget https://wordpress.org/latest.zip
unzip latest.zip
sudo mv wordpress /var/www/html/mysite

Then hand ownership of the files to the Apache user so the web server can read and write them:

sudo chown -R apache: /var/www/html/mysite/

Step 5: Connect WordPress to the Database

WordPress ships with a sample config file. Copy it to the real filename and open it for editing:

cd /var/www/html/mysite/
sudo cp wp-config-sample.php wp-config.php
sudo nano wp-config.php

Fill in the database name, username, and password you created in Step 3. While you’re in there, replace the placeholder authentication salts with a fresh set from the official WordPress salt generator, since those keys harden your site’s login cookies. Save and exit.

Step 6: Create the Uploads Directory

Create the uploads folder WordPress uses for media, then re-apply ownership so the new directory belongs to Apache too:

sudo mkdir /var/www/html/mysite/wp-content/uploads
sudo chown -R apache: /var/www/html/mysite/

Step 7: Finish the Setup in the Browser

Visit your site in a browser, for example localhost/mysite or 192.168.1.44/mysite, and follow the on-screen installer to set your site title, admin username, and password. Once that’s done, you can log in to the dashboard at /wp-admin, for example localhost/mysite/wp-admin, and start building the site.

Related guides


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *