We're here to assist with any of your needs, don't hestitate to reach out.
WordPress is a popular website and blogging platform that allows users to create and manage their own websites with ease. In this tutorial, we will guide you through the process of installing WordPress on CentOS 8.
Before installing any new software, it is always a good idea to update the system to ensure that you have the latest packages and security patches. Open a terminal and run the following commands:
sudo dnf update -y
sudo reboot
WordPress requires a web server to host your website. Apache is a popular and widely used web server. Install Apache by running the following command in the terminal:
sudo dnf install httpd -y
Start Apache and enable it to automatically start on system boot by running the following commands:
sudo systemctl start httpd
sudo systemctl enable httpd
WordPress also requires a database server to store its data. MariaDB is a popular and open-source database server. Install MariaDB by running the following command in the terminal:
sudo dnf install mariadb-server -y
Start MariaDB and enable it to automatically start on system boot by running the following commands:
sudo systemctl start mariadb
sudo systemctl enable mariadb
Secure the MariaDB installation by running the following command:
sudo mysql_secure_installation
Create a database for WordPress and a user that has access to the database. Open the MariaDB shell with the following command:
sudo mysql
Once you are in the MariaDB shell, create the database and user with the following commands:
CREATE DATABASE wordpress;
GRANT ALL ON wordpress.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
WordPress is built using PHP, so we need to install PHP and some required extensions. Run the following command to install PHP and the necessary extensions:
sudo dnf install php php-mysqlnd php-json php-gd php-xml php-mbstring php-fpm -y
Configure Apache to use PHP-FPM by editing the Apache configuration file /etc/httpd/conf/httpd.conf
. Open the file in a text editor and add the following lines:
SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost/"
Save the file and close the text editor.
Restart Apache to apply the changes by running the following command:
sudo systemctl restart httpd
Download the latest version of WordPress from the official website. Extract the downloaded file to the Apache document root directory /var/www/html/
. You can do this by running the following commands:
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xf latest.tar.gz
sudo cp -r wordpress/* /var/www/html/
Configure WordPress by creating a configuration file. Rename the sample configuration file /var/www/html/wp-config-sample.php
to /var/www/html/wp-config.php
by running the following command:
sudo mv /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
Edit the configuration file /var/www/html/wp-config.php
and update the following lines with your database details:
define('DB_NAME', 'wordpress');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'localhost');
Save the file and close the text editor.
Set the correct permissions for the WordPress files and directories by running the following commands:
sudo chown -R apache:apache /var/www/html/
sudo chmod -R 755 /var/www/html/
Now that WordPress is installed and configured, you can access it by opening your web browser and navigating to http://your_server_IP_address
. You will see the WordPress installation wizard where you can set up your website.
Congratulations! You have successfully installed WordPress on CentOS 8.
What our customers say about us
Create your free account today.