How to Install WordPress on CentOS 7
WordPress is a popular content management system that allows you to create and manage websites with ease. In this guide, we will walk you through the steps to install WordPress on a CentOS 7 server.
Prerequisites
Before we begin, you need to make sure you have the following prerequisites:
- A CentOS 7 server with root access
- Apache web server installed
- MySQL or MariaDB database server installed
- PHP installed
Step 1: Install Apache
To install Apache on CentOS 7, run the following commands:
sudo yum install httpd
sudo systemctl start httpd
sudo systemctl enable httpd
Step 2: Install MySQL/MariaDB
You can choose to install MySQL or MariaDB as the database server. Here is how you can install MariaDB:
sudo yum install mariadb-server
sudo systemctl start mariadb
sudo systemctl enable mariadb
sudo mysql_secure_installation
Step 3: Install PHP
To install PHP on CentOS 7, run the following commands:
sudo yum install php php-mysql
sudo systemctl restart httpd
Step 4: Download and Install WordPress
Now, we will download and install WordPress on CentOS 7:
cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xzvf latest.tar.gz
sudo mv wordpress/* .
sudo chown -R apache:apache /var/www/html
Step 5: Configure WordPress
Create a MySQL 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;
Rename the WordPress configuration file:
cp wp-config-sample.php wp-config.php
Step 6: Complete the Installation
Go to your server’s IP address in a web browser to complete the WordPress installation.
Follow the on-screen instructions to set up your WordPress site.
Conclusion
By following these steps, you can easily install WordPress on a CentOS 7 server. Enjoy building your website with WordPress!