Skip to content

Guide for Installing WordPress on Rocky Linux 9 Using Apache, MariaDB, and PHP8.3 (LAMP Setup)

Guides for setting up the LAMP stack on Rocky Linux 9. Find out how to install WordPress using Apache, MariaDB, and PHP 8.3 through this detailed tutorial.

Installing WordPress on Rocky Linux 9 using Apache, MariaDB, and PHP8.3 (LAMP Setup)
Installing WordPress on Rocky Linux 9 using Apache, MariaDB, and PHP8.3 (LAMP Setup)

Guide for Installing WordPress on Rocky Linux 9 Using Apache, MariaDB, and PHP8.3 (LAMP Setup)

Deploying WordPress on Rocky Linux 9 with Apache, MariaDB, and PHP 8.3 requires a systematic approach. Here is a detailed guide to help you set up this environment:

## Step 1: Install Rocky Linux 9 First, ensure you have Rocky Linux 9 installed on your server or virtual machine.

## Step 2: Update the System Update the system to ensure you have the latest packages.

```bash sudo dnf update -y ```

## Step 3: Install Apache Install the Apache web server.

```bash sudo dnf install -y httpd ```

Start and enable the Apache service.

```bash sudo systemctl start httpd sudo systemctl enable httpd ```

Verify Apache by accessing `http://localhost` in your browser.

## Step 4: Install MariaDB Install MariaDB, a popular MySQL variant.

```bash sudo dnf install -y mariadb-server ```

Start and enable MariaDB.

```bash sudo systemctl start mariadb sudo systemctl enable mariadb ```

Secure MariaDB by running the following command and following the prompts.

```bash sudo mysql_secure_installation ```

## Step 5: Create a Database for WordPress Log into MariaDB as root and create a database for WordPress.

```bash sudo mysql -u root -p CREATE DATABASE wordpress_db; CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'your_password'; GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wordpress_user'@'localhost'; FLUSH PRIVILEGES; EXIT ```

## Step 6: Install PHP 8.3 Install PHP 8.3 along with necessary modules for WordPress.

First, enable the EPEL repository (if not already enabled).

```bash sudo dnf install -y epel-release ```

Then, install PHP 8.3 using the Remi repository:

1. **Enable Remi Repository:** ```bash sudo dnf install -y dnf-utils sudo dnf config-manager --set-enabled remi sudo dnf install -y php83 php83-php-fpm ```

2. **Install PHP Modules:** ```bash sudo dnf install -y php83-php-{mysqlnd,gd,mbstring,soap,xml,xmlrpc,zip} ```

Start and enable PHP-FPM.

```bash sudo systemctl start php83-php-fpm sudo systemctl enable php83-php-fpm ```

## Step 7: Configure Apache for PHP Edit the Apache configuration file to use PHP-FPM.

1. **Create a Virtual Host File:** ```bash sudo nano /etc/httpd/conf.d/wordpress.conf ```

2. **Add the Following Configuration:** ```apache

ErrorLog logs/wordpress-error.log CustomLog logs/wordpress-access.log combined

```

3. **Save and Close the File.**

4. **Restart Apache:** ```bash sudo systemctl restart httpd ```

## Step 8: Install WordPress 1. **Download WordPress:** ```bash wget https://wordpress.org/latest.tar.gz tar -xvf latest.tar.gz ```

2. **Move WordPress to the Document Root:** ```bash sudo mv wordpress /var/www/html/ sudo chown -R apache:apache /var/www/html/wordpress ```

3. **Create a Configuration File:** ```bash sudo cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php ```

4. **Edit the Configuration File:** ```bash sudo nano /var/www/html/wordpress/wp-config.php ```

5. **Update the Database Settings:** ```php define( 'DB_NAME', 'wordpress_db' ); define( 'DB_USER', 'wordpress_user' ); define( 'DB_PASSWORD', 'your_password' ); define( 'DB_HOST', 'localhost' ); ```

6. **Save and Close the File.**

## Step 9: Configure Firewall Ensure that HTTP and HTTPS ports are open.

```bash sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=https sudo firewall-cmd --reload ```

## Step 10: Access WordPress Open a web browser and go to `http://yourdomain.com` to complete the WordPress installation.

With these steps, you should have a fully functional WordPress installation on Rocky Linux 9 with Apache, MariaDB, and PHP 8.3. For blazing-fast and scalable hosting, consider deploying on Shape.Host Cloud VPS.

Technology plays a crucial role in this process as we leverage Rocky Linux 9, Apache, MariaDB, and PHP 8.3 to set up a robust environment for a WordPress installation.

After configuring Apache to use PHP-FPM, we integrate technology to facilitate smooth communication between the web server and PHP-FPM, ensuring optimal performance for our WordPress site.

Read also:

    Latest