Manual WordPress Deployment on Rocky Linux 8.9 with LAMP Stack

Environment Setup

Rocky Linux 8.9 is used as the depolyment environment. Install Apache, MariaDB, and PHP manually. Disable SELinux and firewalld for testing purposes:

# Set SELinux to permissive mode temporarily
setenforce 0
# Disable firewalld
systemctl stop firewalld
systemctl disable firewalld

Apache Configuration

Installation

yum install httpd -y

Virtual Host Setup

Create a dedicated user:

useradd wpuser
mkdir -p /home/wpuser/www/html
chown wpuser:wpuser -R /home/wpuser/www/html
chmod 755 -R /home/wpuser/www/html

Create /etc/httpd/conf.d/wp.conf with:

<VirtualHost *:80>
    ServerAdmin admin@example.com
    ServerName example.com
    DocumentRoot /home/wpuser/www/html
    <Directory "/home/wpuser/www/html/">
        Options FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog /var/log/httpd/wp_error.log
    CustomLog /var/log/httpd/wp_access.log combined
</VirtualHost>

Modify /etc/httpd/conf/httpd.conf:

User wpuser
Group wpuser

Enable and start the service:

systemctl enable httpd --now

MariaDB Configuraton

Repository Setup

Create /etc/yum.repos.d/mariadb.repo:

[mariadb]
name = MariaDB
baseurl = https://mirrors.aliyun.com/mariadb/yum/10.6/rhel/$releasever/$basearch
gpgkey = https://mirrors.aliyun.com/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck = 1
module_hotfixes = 1

Installation

yum makecache
yum install MariaDB-server MariaDB-client -y

Database Initializasion

Start and enable MariaDB:

systemctl enable mariadb --now

Set root password:

mysql -u root
ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING PASSWORD('your_db_root_pass');

Create WordPress database and user:

CREATE DATABASE wpdb;
GRANT ALL PRIVILEGES ON wpdb.* TO 'wpuser'@'localhost' IDENTIFIED BY 'your_db_user_pass';
FLUSH PRIVILEGES;

PHP Installation

Repository Configuration

yum install epel-release -y
rpm -ivh https://rpms.remirepo.net/enterprise/remi-release-8.9.rpm

Install PHP 8.3

yum install php83-php php83-php-mysqlnd php83-php-pecl-zip php83-php-gd php83-php-intl -y

Modify /etc/opt/remi/php83/php-fpm.d/www.conf:

user = wpuser
group = wpuser
listen.acl_users = wpuser

Enable and start PHP-FPM:

systemctl enable php83-php-fpm --now

Verify PHP execution by creating /home/wpuser/www/html/phpinfo.php:

<?php phpinfo(); ?>

WordPress Deployment

Download and Extract

wget https://cn.wordpress.org/latest-zh_CN.zip -P /home/wpuser/www/html
unzip latest-zh_CN.zip -d /home/wpuser/www/html
mv /home/wpuser/www/html/wordpress/* /home/wpuser/www/html/

Configuration

Create wp-config.php:

cd /home/wpuser/www/html
cp wp-config-sample.php wp-config.php

Edit wp-config.php with database credentials:

define( 'DB_NAME', 'wpdb' );
define( 'DB_USER', 'wpuser' );
define( 'DB_PASSWORD', 'your_db_user_pass' );
define( 'DB_HOST', 'localhost' );

Generate and replace security keys at WordPress Salt Generator.

Initialization

Access http://your_server_ip/ in a web browser to complete installation.

Tags: WordPress Rocky Linux LAMP Stack apache MariaDB

Posted on Wed, 20 May 2026 01:59:38 +0000 by fragger