Pre-requisites
Our first step will be to install some pre-requisites. As of right now, Wordpress only supports MySQL as the database server, but there has been talk about expanding to eventually support alternative databases. We will also need to get PHP, PHP-GD for graphics, and PHP-MYSQL:
yum install mysql-server php php-gd php-mysql yum update
Download Wordpress
Now, we want to download and extract the Wordpress in your /home directory
cd /home wget https://wordpress.org/latest.tar.gz tar xvf latest.tar.gz chown -R apache:apache wordpress/*
Initialize MySQL
We are going to be starting and doing the initial set-up of MySQL. If you have already done so, you can skip this section.
service mysqld start /usr/bin/mysql_secure_installation
Hit enter when it prompts you with "Enter current password for root (enter for none):" After this, you can just follow the prompts. You can accept all the defaults.
Configure MySQL
We will now log into MySQL and create the Wordpress database.
mysql -uroot -ppassword CREATE DATABASE wordpressdb; CREATE USER wpuser@localhost IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON wordpressdb.* TO wpuser@localhost; FLUSH PRIVILEGES; exit;
Configure Wordpress
We will now copy the sample config and edit it.
cp /home/wordpress/wp-config-sample.php /home/wordpress/wp-config.php nano /home/wordpress/wp-config.php
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'wordpressdb'); /** MySQL database username */ define('DB_USER', 'wpuser'); /** MySQL database password */ define('DB_PASSWORD', ‘wppassword’);
Adding unique salts and keys
Open up a browser window and navigate to https://api.wordpress.org/secret-key/1.1/salt/. You will now want to copy all of the text and paste it over the following section of wp-config.php:
define('AUTH_KEY', 'put your unique phrase here'); define('SECURE_AUTH_KEY', 'put your unique phrase here'); define('LOGGED_IN_KEY', 'put your unique phrase here'); define('NONCE_KEY', 'put your unique phrase here'); define('AUTH_SALT', 'put your unique phrase here'); define('SECURE_AUTH_SALT', 'put your unique phrase here'); define('LOGGED_IN_SALT', 'put your unique phrase here'); define('NONCE_SALT', 'put your unique phrase here');
Configure Apache
You will now set the DocumentRoot of /etc/httpd/conf/http.conf to /home/wordpress.
nano /etc/httpd/conf/http.conf
DocumentRoot "/var/www/html" should be changed to DocumentRoot "/home/wordpress" Directory "/var/www/html"\ should be changed to Directory "/home/wordpress"
SELinux
yum install policycoreutils-python semanage fcontext -a -t httpd_sys_content_t '/home/wordpress(/.*)?' restorecon -Rv /home/wordpress service httpd restart
You're Done!
Now you can navigate to http://[Your IP address or domain] You will be brought to the wp-admin/install.php page. Fill out the information and you will have your very own wordpress page.