How to Install WordPress on AlmaLinux 8

To install WordPress on AlmaLinux 8, you need to follow the below steps:

  1. Update the system:
    sudo dnf update
  2. Install Apache web server and PHP:
    sudo dnf install httpd php php-mysqlnd php-gd php-json php-mbstring php-xml php-opcache
  3. Start and enable Apache to start at boot time:
    sudo systemctl start httpd
    sudo systemctl enable httpd
  4. Install MariaDB database server:
    sudo dnf install mariadb-server
  5. Start and enable MariaDB to start at boot time:
    sudo systemctl start mariadb
    sudo systemctl enable mariadb
  6. Secure MariaDB installation by running the following command and following the on-screen instructions:
    sudo mysql_secure_installation
  7. Create a database and user for WordPress:
    sudo mysql -u root -p
    CREATE DATABASE wordpress;
    CREATE USER 'wpuser'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
    FLUSH PRIVILEGES;
    exit;
  8. Download and extract WordPress:
    cd /var/www/html
    sudo curl -O https://wordpress.org/latest.tar.gz
    sudo tar -zxvf latest.tar.gz
  9. Copy the WordPress sample configuration file and make changes to it:
    sudo cp /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-config.php
    sudo vi /var/www/html/wordpress/wp-config.php

    Replace the following lines with the database, username, and password that you have created:

    define('DB_NAME', 'wordpress');
    define('DB_USER', 'wpuser');
    define('DB_PASSWORD', 'password');
    define('DB_HOST', 'localhost');
  10. Set proper permissions on the WordPress directory:
    sudo chown -R apache:apache /var/www/html/wordpress
    sudo chmod -R 755 /var/www/html/wordpress
  1. Restart Apache:
    sudo systemctl restart httpd

You should now be able to access your WordPress installation by visiting your server’s IP address or domain name in a web browser.