Wednesday, December 4, 2024

Setup WordPress on CentOS 9 Stream

Share

This is a guide on how to install WordPress on CentOS 9 Stream but it will also work on older versions of CentOS.

WordPress Configuration On CentOS 9 Stream

Prepare the Environment

Install CentOS 9 Stream on your server.

Update the system packages using the package manager:

sudo dnf update

Install LAMP Stack

Install Apache web server:

sudo dnf install httpd

Install MariaDB (MySQL compatible database server):

sudo dnf install mariadb-server

Install PHP and required modules:

sudo dnf install php php-mysqlnd php-gd php-xml php-mbstring

Configure the LAMP Stack:

Start and enable Apache:

sudo systemctl start httpd
sudo systemctl enable httpd

Start and enable MariaDB:

sudo systemctl start mariadb
sudo systemctl enable mariadb

Secure your MariaDB installation by running:

sudo mysql_secure_installation

Create a MySQL Database and User

Log in to the MariaDB server as the root user:

sudo mysql -u root -p

Create a new database:

CREATE DATABASE wordpress;

Create a new user and grant privileges to the database:

CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;

Download and Configure WordPress

Download the latest version of WordPress:

sudo dnf install wget
wget https://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz

Move the extracted files to the Apache web root directory:

sudo mv wordpress/* /var/www/html/

Configure the WordPress site by creating the wp-config.php file:

cd /var/www/html/
sudo mv wp-config-sample.php wp-config.php
sudo vi wp-config.php

Update the database details in wp-config.php to match the database and user you created earlier

Set appropriate ownership and permissions for WordPress files:

sudo chown -R apache:apache /var/www/html/
sudo chmod -R 755 /var/www/html/

Edit the Apache configuration file:

sudo vi /etc/httpd/conf/httpd.conf

Update the DirectoryIndex directive to include index.php:

DirectoryIndex index.php index.html

Save the file and exit.

Restart Apache:

sudo systemctl restart httpd

Complete WordPress Installation

  • Open a web browser and access your server’s IP address or domain name.
  • Follow the WordPress installation wizard, providing the required information such as site title, admin username, password, etc.

That’s it! You should now have WordPress successfully installed on CentOS 9 Stream. Remember to consult the official documentation and adapt the steps as needed based on the specific CentOS version you are using.

Related Articles

Read more

Local News

Simple, privacy focused and free ad network for websites in need of new visitors. Free & easy backlink link building. Surowce do produkcji suplementów diety.