This tutorial is a part of series of articles on WordPress:
- Understanding WordPress
- Installing and Setting up WordPress on Virtono
- Installing WordPress Manually
- Navigating in WordPress Dashboard
- Publishing Content
- Installing WordPress Plugins
- Installing WordPress Themes
- Optimizing WordPress Performance
- Keeping WordPress Secure
We will be using a bare Centos Server to install WordPress manually, if you wish to do it with less hassle you can refer the previous article in this series.
Before you begin with this guide, there are a few steps that need to be completed first.
You will need a CentOS 7 server installed and configured with a non-root user that has
Additionally, you’ll need to have a LAMP (Linux, Apache, MySQL, and PHP) stack installed on your CentOS 7 server. If you don’t have these components already installed or configured, you can follow the steps below and if you have them installed you can move ahead to installing WordPress.
Installing LAMP : You can use this tutorial to do so.
When you are finished with these steps, you can continue with the installation of WordPress.
Installing WordPress On CentOS
STEP 1 – Create a MySQL Data source and User for WordPress
WordPress runs on the relational database to control information for the site and its users. We’ve MariaDB (a fork of MySQL) installed already, that may provide these features, but we need to make a database and a consumer for WordPress to work with.
To begin with, log into MySQL’s root (administrative) account simply by issuing this command:
mysql -u root -p
You’ll be prompted for the password that you set for the main account when you installed MySQL. Once that password is submitted, you will be provided a MySQL command prompt.
First, we’ll create a new database that WordPress can control. You can call this whatever you desire, but I am calling it wordpress because of this example.
CREATE DATABASE wordpress;
Note: Every MySQL declaration or command must result in a semi-colon (;), therefore check to ensure that this can be present in case you are encountering any issues.
Next, we will create a fresh MySQL user accounts that we will use exclusively to use on WordPress’s new database. Creating one-function databases and accounts may be beneficial, as it permits better control of permissions and additional security needs.
I will call the new account wordpressuser and will assign it a password of password. You should use a different account, as these examples aren’t very secure.
CREATE User wordpressuser@localhost IDENTIFIED BY ‘password’;
At this time, you have a data source and user account that are each specifically designed for WordPress. However, the user has no usage of the database. We have to link both components collectively by granting our user access to the database.
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY ‘password’;
Now that an individual has usage of the database, we have to flush the privileges so that MySQL is aware of the recent privilege adjustments that we’ve made:
Once these instructions have almost all been executed, we can exit out from the MySQL control prompt by typing:
You should now be back again to your regular SSH command prompt.
STEP 2 – Install WordPress
Before we download WordPress, presently there is one PHP module that people need to install to ensure that it works correctly. Without this module, WordPress will never be able to resize pictures to create thumbnails. We are able to get that package straight from CentOS’s default repositories using yum:
Now we need to restart Apache in order that it recognizes the brand new module:
sudo service httpd restart
We are now prepared to download and install WordPress from the project’s site. Luckily, the WordPress group always links the newest stable version of their software program to the same URL, so we are able to obtain the most up-to-date edition of WordPress by typing this:
This will download a compressed archive file that has all of the WordPress files that we need. We can extract the archived files to rebuild the WordPress directory with tar:
tar xzvf latest.tar.gz
You will have a directory called wordpress in your home directory. We are able to finish the installation by transferring the unpacked documents to Apache’s document root, where it could be served to site visitors of our website. We can transfer our WordPress data files there with rsync, that may preserve the files’ default permissions:
sudo rsync -avP ~/wordpress/ /var/www/html/
rysnc will safely copy all the contents from the directory you unpacked to the record root at /var/www/html/. Nevertheless, we still have to put in a folder for WordPress to store uploaded files. We are able to do this with the mkdir order:
Now we have to assign the right ownership and permissions to your WordPress documents and folders. This increase protection while still permitting WordPress to operate as intended. To get this done, we’ll make use of chown to grant possession to Apache’s consumer and group:
sudo chown -R apache:apache /var/www/html/*
With this change, the web server can create and modify WordPress data files, and can also allow us to upload content to the server.
STEP 3 – Configure WordPress
The majority of the configuration necessary to use WordPress will end up being completed through an internet interface down the road. However, we need to do some function from the command collection to make sure that WordPress can hook up to the MySQL data source that people created for it.
Begin by getting into the Apache root directory where you installed WordPress:
The primary configuration file that WordPress relies on is named wp-config.php. An example configuration file that mainly matches the settings we need is roofed by default. All we need to do is duplicate it to the default configuration file location, in order that WordPress can identify and utilize the file:
cp wp-config-sample.php wp-config.php
Now that we’ve a configuration file to utilize, let’s open up it in a text message editor:
The only adjustments we have to make to the file are to the parameters that keep our database information. We will have to discover the section titled MySQL configurations and switch the DB_NAME, DB_USER, and DB_PASSWORD variables to ensure that WordPress to properly connect and authenticate to the data source that we created.
Complete the values of the parameters with the information for the database that you created. It will look like this:
// ** MySQL settings – You may get this information from your hosting company ** //
/** The name of the data source for WordPress */
/** MySQL database username */
/** MySQL database password */
They are the only ideals that you should change, so conserve and close the document if you are finished.
STEP 4 – Complete Set up Through the net Interface
Now that you possess your files set up and your software program is configured, you may complete the WordPress installation through the net interface. In your browser, navigate to your server’s domain name or general public IP address:
First, you will have to choose the language that you want to install WordPress with.
After choosing the language and simply clicking Continue, you’ll be presented with the WordPress initial construction web page, where you will generate a short administrator account:
Fill out the info for the website and administrative account that you intend to make. If you are finished, go through the Install WordPress switch at the bottom to continue.
WordPress can confirm the set up, and ask you to sign in with the accounts which you created:
To keep, hit the Log in button in the bottom, then complete your administrator username and passwords:
After hitting Sign in, you will be offered your brand-new WordPress dashboard:
Congratulations! You have now successfully installed WordPress!
Next up : Navigating in WordPress Dashboard