How To Install WordPress With Apache On CentOS 7.
In this tutorial, we will explain how to install WordPress on CentOS 7. At the time of writing this article, the latest version of WordPress is version 5.0.3.
WordPress is the most popular open-source blogging and CMS platform worldwide, powering a quarter of all websites on the Internet today. It is based on PHP and MySQL and packs a ton of features that can be extended with free and premium plugins and themes. WordPress is the simplest way to create your online store, website, or blog.
Creating MySQL Database
WordPress stores its data and configuration in a MySQL database. If you already don’t have MySQL or MariaDB installed on your CentOS server you can install by following one of the guides below:
Install MySQL on CentOS 7 .
Install MariaDB on CentOS 7 .
Login to the MySQL shell by executing the following command:
From within the MySQL shell, run the following SQL statement to create a new database named wordpress:
Next, create a MySQL user account named wordpressuser and grant the necessary permissions to the user by running the following command:
Once done, exit the mysql console by typing:
The following command will download the latest version of WordPress from the WordPress download page with wget and extract the archive to the domain’s document root directory:
Set the correct permissions so that the web server can have full access to the site’s files and directories:
By now, you should already have Apache with SSL certificate installed on your system, if not check the prerequisites for this tutorial.
Open your text editor and edit the domain’s Apache virtual hosts configuration :
Don’t forget to replace example.com with your WordPress domain and set the correct path to the SSL certificate files.
The configuration will tell Apache to redirects HTTP to HTTPS and www to non-www version of your domain.
Restart the Apache service for the changes to take effect:
Completing the WordPress Installation
Now that WordPress is downloaded and the Apache server is configured, you can finish the installation through the web interface.
In the next step, you’ll need to enter a name for your WordPress site and choose a username (for security purposes do not use “admin” ).
The installer will automatically generate a strong password for you. Do not forget to save this password. You can also set the password by yourself.
Enter your email address and select whether you want to discourage search engines from indexing the site (not recommended).
Click Install WordPress and once the installation is completed you will be taken to a page informing you that WordPress has been installed.
To access your WordPress login page click on the Log in button.
Enter your username and password.
You will be redirected to the WordPress administration dashboard.
From here, you can start customizing your WordPress installation by installing new themes and plugins.
Congratulations, you have successfully installed WordPress with Apache on your CentOS 7 server. First Steps With WordPress is a good starting place to learn more about how to get started with WordPress.