How to setup WordPress CMS in Rocky Linux/RHEL

Update your Linux System

# yum update

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

# yum install mysql-server
# systemctl start mysqld
# systemctl enable mysql 
# systemctl status mysql
        or
# yum install mariadb-server 
# systemctl start mariadb 
# systemctl enable mariadb 
# systemctl status mariadb

PHP Installation

# yum install php php-mysqlnd php-gd php-xml php-mbstring

Insatll wordpress

# yum install wget
# wget https://wordpress.org/latest.tar.gz
# tar -xzvf latest.tar.gz
# mv wordpress/ /var/www/html/ 
# cd /var/www/html/wordpress/
# ls
# chown -R apache:apache /var/www/html/wordpress/ 
# chmod -R 755 /var/www/html/wordpress/

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
# cd /var/www/html/wordpress/
# mv wp-config-sample.php wp-config.php
# vim wp-config.php
# define( 'DB_NAME', 'wordpress' ); 
# define( 'DB_USER', 'wordpress' );
# define( 'DB_PASSWORD', 'Ak123!@#' );

Configure Apache virtual host

# cd /etc/httpd/conf.d 
# vim wordpress.conf

<VirtualHost *:8085>

ServerAdmin admin@local.bitscentric.com 
DocumentRoot /var/www/html/wordpress/
ServerName local.bitscentric.com
ServerAlias www.local.bitscentric.com
ErrorLog /var/log/httpd/wordpress_error.log
CustomLog /var/log/httpd/wordpress_access.log combined

<Directory /var/www/html/wordpress/> 
Options FollowSymLinks
AllowOverride All
Require all granted 
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d
</Directory>
</VirtualHost>

How to change the default port number 80 to 8085

# cd /etc/httpd/conf 
# vim httpd.conf
Listen 8085
# systemctl reload httpd

Now, open any browser and serach your ip or hostname of server.

#http://192.168.1.21/wp-admin/install.php

Configure admin of wordpress

Login id created

Login wordpress

After login wordpress

Create a blog page

Leave a Reply

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