How to setup WordPress CMS in Rocky Linux/RHEL
Step 1: Update Your System in Rocky Linux
# yum update
Step 2: Installation process of LAMP(means Linux, Apache, MySql/MariaDB, and PHP. To run WordPress, we need a web server, a database server, and PHP.)
Install Apache Web Server
# yum install httpd
# systemctl start httpd
# systemctl enable httpd
# systemctl status httpd
Install MariaDB or MySql in Rocky Linux
# yum install mysql-server
or
# yum install mariadb-server
# systemctl start mysqld
# systemctl enable mysql
# systemctl status mysql
or
# systemctl start mariadb
# systemctl enable mariadb
# systemctl status mariadb
PHP Installation in Rocky Linux
# yum install php php-mysqlnd php-gd php-xml php-mbstring
# systemctl restart httpd
# systemctl status httpd
# yum install wget
# wget https://wordpress.org/latest.tar.gz
# tar -xzvf latest.tar.gz
# cp -rpf wordpress/* /var/www/html/wordpress/
# cd /var/www/html/wordpress/
# ls
# chown -R apache:apache /var/www/html/wordpress/
# chmod -R 755 /var/www/html/wordpress/
Step 4: Configuration of Database
# mysql -u root -p
# create database wordpress;
# show databases;
# create user 'wordpress'@'localhost' identified by 'Ak123!@#';
# grant all privileges on wordpress.* to 'wordpress'@'localhost';
# flush privileges;
# exit;
# mysql -u wordpress -p
# mv wp-config-sample.php wp-config.php
#vim wp-config.php
#define( 'DB_NAME', 'wordpress' );
#define( 'DB_USER', 'wordpress' );
# cd /etc/httpd/conf.d
# mkdir wordpress.conf
# vim wordpress.conf
<VirtualHost 192.168.1.21:80> or <VirtualHost *:80>
ServerName wordpress
ServerAlias wordpress.com
DocumentRoot /var/www/html/wordpress
ErrorLog /var/log/httpd/wordpress_error.log
CustomLog /var/log/httpd/wordpress_access.log combined
</VirtualHost>
# systemctl reload httpd
Now, open any browser and serach your ip or hostname of server ##http://192.168.1.21/wp-admin/install.php