To install WordPress on Rocky Linux 9, follow these steps:
- Update System Packages:
sudo dnf update -y
- Install Apache:
sudo dnf install httpd -y
sudo systemctl start httpd
sudo systemctl enable httpd
- Install MariaDB:
sudo dnf install mariadb-server mariadb -y
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
- Install PHP:
sudo dnf install php php-mysqlnd php-fpm -y
sudo systemctl restart httpd
- Download WordPress:
cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xzvf latest.tar.gz
sudo chown -R apache:apache wordpress
sudo chmod -R 755 wordpress
- Create WordPress Database:
sudo mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
- Configure Apache:
sudo vi /etc/httpd/conf.d/wordpress.conf
Add the following:
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/wordpress
ServerName example.com
<Directory /var/www/html/wordpress/>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/wordpress_error.log
CustomLog /var/log/httpd/wordpress_access.log combined
</VirtualHost>
sudo systemctl restart httpd
- Finalize Installation:
Open your browser and navigate tohttp://your_server_IP/wordpress
to complete the WordPress setup.
For more details, refer to the full guide on GeeksforGeeks.