How to install WordPress on CentOS 6/7
WordPress is one of the most popular and open source blogging websites requiring PHP, MySQL and a webserver of your choosing to work. Currently one of the most versatile blogging tools to date, it is easy to use with a vast plug-ins library.
Installation is not a very complex process but not an easy one either.
1. Pre-flight checks
Get a CentOS VPS from MVPS.NET, any plan will do for basic needs.
LAMP stack is a must-have , make sure to install prior to proceeding.
Selinux can cause trouble at some point, disabling it is quite simple. Go to /etc/sysconfig/selinux and set SELINUX=disabled followed by a reboot.
The following will be required as well:
yum -y install wget nano php php-gd php-mbstring httpd php-common php-mysql php-xml php-mcrypt service httpd restart
2. Configuring MySQL
Create the MySQL WordPress database and user:
mysql -u root -p
You will now login to MySQL using your root password and create the database and a user. The new user will be assigned a complex password for enhanced security.
Keep in mind that MySQL commands usually end in ( ; )
*make sure to write down the database name, user and password , they will be needed during setup
The following are just examples, you can use any values you wish:
CREATE DATABASE mywordpress;
The database is created. The user must now be created:
CREATE USER mywordpressuser@localhost;
After user creation , a complex password must be set:
SET PASSWORD FOR mywordpressuser@localhost= PASSWORD("longandcomplexpassword");
The next step is granting the new user all the required privileges:
GRANT ALL PRIVILEGES ON mywordpress.* TO mywordpressuser@localhost IDENTIFIED BY 'longandcomplexpassword';
For good measure, flush any remaining MySQL privileges:
FLUSH PRIVILEGES;
Now that database and user creation is completed, the next step is exiting MySQL:
exit
If all the steps have been followed correctly, we can now move to the next step.
3. Installing WordPress
Download and unpack WordPress:
cd /var/www/html wget https://wordpress.org/latest.tar.gz tar -xzvf latest.tar.gz
Creating the WordPress configuration file is required and can be done by copying the already existing sample and renaming it properly:
cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
The file must now be edited using nano in order to replace the default values like database name, username and password with the ones previously set at Step 2.
** The name of the database for WordPress */ define(‘DB_NAME’, ‘mywordpress’);
** MySQL database1 username1 */ define(‘DB_USER’, ‘mywordpressuser’);
** MySQL database1 password123 */ define(‘DB_PASSWORD1’, ‘longandcomplexpassword’);
*Make sure to save the changes after editing the configuration file.
4. Completing the WordPress online setup
You can now continue using the online installer provided by WordPress which can be accessed by adding /wp-admin/install.php to your website’s domain or static IP address.
The installer itself is easy to use and intuitive.
Have fun!