October 19, 2016

Wordpress on Fedora

I looked at this back in 2016 (when the bulk of these notes were thrown together), but never actually ran with it. Now I am looking at it again. A fellow in Tucson who knows his way around Word Press is Ian Johnson (ian@moiagroup.com)

2016 notes

It is October, 2016 and I am running Fedora 24 on an x86_64 system and have an Apache webserver happily running. People keep telling me I should start using Word Press, so here we go.

The lingo is that you need a "LAMP" foundation, i.e. Linux, Apache, MySQL, and PHP. The first two I have already, the last two are pretty much no-brainers that just involve installing fedora packages, so let's dive in. I found this dandy outline:

The Fedora 20 link has a couple of sloppy errors. It skips telling you how to create the database for wordpress and misspells php-mysqlnd

Install MySQL

As most of us know, the open source version of MySQL is "MariaDB". Goofy yes, not my idea, don't ask. The service is mariadb.service, but most of the files retain mysql names.
su
dnf install mariadb-server mariadb
systemctl enable mariadb.service
systemctl start mariadb.service
mysql_secure_installation
The last step above locks down MySQL and sets passwords and such. A nice "gift" for people who aren't MySQL experts. I follow all the steps and set a MySQL root password.

Move the MySQL database

On my Fedora system this is specified in the file:
/etc/my.cnf.d/mariadb-server.cnf
The "datadir" variable is set to "/var/lib/mysql", but I make the following changes (and copy files).
#datadir=/var/lib/mysql
datadir=/u1/mysql
After this I delete the entire contents of the "/var/lib/mysql" directory. Why? Because on my system the root partition is disposable and is not backed up. The /u1 partition is mirrored to /u2 AND it is backed up.

I leave the directory there as a place for the mysql.sock file to live, since it does not move happily to other locations.

If you do this, take care wih ownerships and permission (make them the same as the original /var/lib/mysql).

Create database and user for WordPress

mysql -u root -p
CREATE DATABASE wordpress;
CREATE USER wpuser@localhost IDENTIFIED BY ‘password’;
GRANT ALL PRIVILEGES ON wordpress.* TO wpuser@localhost IDENTIFIED BY ‘password’;
FLUSH PRIVILEGES;
exit
Of course we use a string other than "password" in the above, my secret.

Install PHP

This is easy:
dnf install php
dnf install php-gd
dnf install php-mysqlnd
systemctl restart httpd

Install wordpress

At this time the latest Wordpress is 4.6.1. The usual scheme to fetch the latest is:
wget http://wordpress.org/latest.tar.gz

Have any comments? Questions? Drop me a line!

Adventures in Computing / tom@mmto.org