WordPress is a free and open source blogging application and dynamic CMS (content management system) developed using MySQL and PHP.
It has a huge number of third-party plugins and themes. WordPress is currently one of the most popular blogging platforms available on the web and is used by millions of people around the world.
In this guide, we will explain how to install the popular content management system WordPress using LAMP (Linux, Apache, MySQL/MariaDB, PHP) on RHEL based distributions such as CentOS Stream, Fedora, Rocky Linux and AlmaLinux.
Installing EPEL and the Remi repository
The installation we will be doing will be done on Rocky Linux, but the same instructions also work on RHEL, CentOS Stream, Rocky Linux, and AlmaLinux distributions.
First, install and enable the EPEL and Remi repository using the following commands.
------------------- On RHEL 9 Based Distributions ------------------- # dnf install # dnf install
-------------------On RHEL 8 Based Distributions ------------------- # dnf install # dnf install
-------------------On Fedora 36/35 ------------------- # dnf install # dnf install
Since we are going to use PHP 8, we will need to reset PHP to default and enable the PHP 8 version using the following commands.
# yum install dnf-utils # dnf module list php # dnf module reset php # dnf module enable php:remi-8.0


Installing the LAMP stack for WordPress
We are now ready to install all the required packages related to our LAMP stack with the following command.
# yum install httpd mariadb mariadb-server php-gd php-soap php-intl php-mysqlnd php-pdo php-pecl-zip php-fpm php-opcache php-curl php-zip php-xmlrpc wget


Now that the installation is complete, we need to start and secure our MariaDB installation.
# systemctl start mariadb # mysql_secure_installation


Follow the on-screen instructions to answer questions related to the security of your MariaDB server.
We will then configure MariaDB to start automatically on system boot:
# systemctl enable mariadb
Next, we'll do the same for the Apache web server:
# systemctl start httpd # systemctl enable httpd
Creating a WordPress MySQL Database
Our WordPress will require a database and a database user. To create it, just use the following commands. Feel free to change the database name, user and password to suit your preferences:
# mysql -u root -p Enter password: ## Create database ##CREATE DATABASE wordpress; ## Creating new user ##CREATE USER [email protected] IDENTIFIED BY "secure_password"; ## Grant privileges to database ##GRANT ALL ON wordpress.* TO [email protected]; ## FLUSH privileges ##FLUSH PRIVILEGES; ## Exit ##exit
Preparing to Install WordPress
We are now ready to download the latest WordPress archive using the following wget command:
# cd /tmp & wget
Then unzip the archive to our web directory:
# tar -xvzf latest.tar.gz -C /var/www/html
The above will create the following directory which will contain our WordPress script:
/var/www/html/wordpress
Now change the owner of this directory to the "apache" user and set the appropriate permissions:
# chown -R apache:apache /var/www/html/wordpress # chmod -R 775 /var/www/html/wordpress
Then set up an SELinux context for the directory and its contents.
# dnf install policycoreutils-python-utils # semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/wordpress(/.*)?" # restorecon -Rv /var/www/html/wordpress
Creating an Apache Virtual Host for WordPress
We will create a separate virtual host for our WordPress installation. Open /etc/httpd/conf/httpd.conf with your favorite text editor:
# vi /etc/httpd/conf/httpd.conf
And add the following code at the bottom of the file and replace the marked text with information specific to your installation:
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/wordpress/ ServerName tecminttest.com ServerAlias www.tecminttest.com <Directory "/var/www/html/wordpress"> Options Indexes FollowSymLinks AllowOverride all Require all granted </Directory> ErrorLog /var/log/httpd/tecminttest_error.log CustomLog /var/log/httpd/tecminttest_access.log common </VirtualHost>
Save changes and restart Apache:
# systemctl restart httpd
Installing WordPress on a website
We are now ready to start our WordPress installation. To start the installation, you can access either your server's IP address at either when installing locally you can use either if you're using a real domain you can use a domain instead. You should see the following page:


When you click the "Let's Go" button, you will be redirected to the next installation page, where you will need to enter the database details we created earlier.


Once you've entered your details, click the submit button. WordPress will try to create its own configuration file named wp-config.php. If everything is in order, you should see the following page:


After you click the "Start Installation" button, you will be prompted to enter some details about your website: site name, username, password, and email address.


When you fill in all the required information, complete the installation by clicking the button below. Your installation is now complete. Your homepage should look something like the image below:


And the WordPress dashboard looks like this:


Now you can start managing your WordPress site.
Publication author
Инструкции,Обзоры,Программы,CMS,RHEL,wordpress
#install #WordPress #LAMP #RHEL #based #distributions
