Basic instructions on using the dice/options/wordpress-non-rpm.h header

Assuming this is a newly installed machine, to which you've just added the header, with no extra #defines, then

#include <dice/options/wordpress-non-rpm.h>

will assume your wordpress tarball has been unpacked to /disk/data/wordpress and will configure apache to serve the site as http://hostname.inf.ed.ac.uk using the default PHP of 5.4.

It will also do some basic backup of the mysql database, and ask for the backup and wordpress data to be mirrored.

Note: you still have to manually install and configure Wordpress, this header does not do any of that. More details of that later.

Optional #defines

define description default
DICE_OPTIONS_WORDPRESS_NON_RPM_INSTALL_DIR parent dir of "wordpress" directory /disk/data
DICE_OPTIONS_WORDPRESS_NON_RPM_SITENAME DNS sitename, used for optional SSL cert and apache config hostname.inf.ed.ac.uk
DICE_OPTIONS_WORDPRESS_NON_RPM_SKIP_MYSQL don't install mysql/mariadb. assumes you'll do it else where undef
DICE_OPTIONS_WORDPRESS_NON_RPM_HTTPS configure HTTPS apache and certificate undef
DICE_OPTIONS_WORDPRESS_NON_RPM_PROPERCERT by default if configured to do HTTPS, you will get a staging/test Let's Encrypt certificate, defining this will get you a proper certificate - trusted by browsers, but there's site limits as to how many of these we can register per day/month undef
DICE_OPTIONS_WORDPRESS_NON_RPM_PHP_VERSION version of PHP to use: 56=5.6 71=7.1 the OS default, probably 5.4
DICE_OPTIONS_WORDPRESS_NON_RPM_SKIP_MIRROR don't ask to be mirrored undef

For example you could do:

#define DICE_OPTIONS_WORDPRESS_NON_RPM_SITENAME www.foobar.com
#define DICE_OPTIONS_WORDPRESS_NON_RPM_INSTALL_DIR /disk/data
#define DICE_OPTIONS_WORDPRESS_NON_RPM_PHP_VERSION 71
#define DICE_OPTIONS_WORDPRESS_NON_RPM_HTTPS 
#define DICE_OPTIONS_WORDPRESS_NON_RPM_PROPERCERT 

#include <dice/options/wordpress-non-rpm.h>

the header would then assume /disk/data/wordpress/ existed, and was the root of your wordpress install.

HTTPS setup

HTTPS will not work out of the box due to a chicken and egg situation with Let's Encrypt, which requires a working HTTP website and open HTTP firewall hole. So we need to get a basic HTTP site working, get the HTTPS certificate, then proceed with the manual setup parts.

This assumes you've either rebooted or run updaterpms after adding the header and configuring the #defines.

  • Configure firewall holes to be open for HTTP at least.
  • om apacheconf start
  • Apache will refuse to start as it is configured for HTTPS, but there are no certs yet. So as root edit /etc/httpd/conf/httpd.conf and delete/comment out the line Include "/etc/httpd/lcfg.sites.d/wp443.conf"
  • manually start apache apachectl start
  • confirm that http://your.site.name/ works, even if it gives "forbidden"
  • Now start x509 om x509 start, it should successfully get your certificate
  • The successful cert get should have automatically restarted the apacheconf component and restored the line you deleted from httpd.conf (if not run om apacheconf configure)
  • confirm that https://your.site.name/ now works, even if it gives "forbidden"

That should be HTTPS apache and Let's Encrypt now configured.

Manual install steps

As mentioned this header does not actually install wordpress or configure it, you need to do that. The reason we are doing it this way, is to assume that wordpress is configured to automatically update, so it gets the latest security fixes right away, rather than waiting for RPMs to be updated and installed.

If you've added the header and rebooted (or otherwise installed the RPMs and started apache), and configured HTTPS if necessary (see above), you should have a working web server, serving content out of /disk/data/wordpress (or wherever you configured it to look for the "wordpress" directory.

Basic info for now:

cd /disk/data
wget https://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz 
rm latest.tar.gz
chown -R apache:apache wordpress

# test PHP
echo -e "<?php\nphpinfo();\n?>" > wordpress/pdice.php
curl http://`hostname`/pdice.php

# config mysql. replace sitewp, someuser and SomePassword with something appropriate make sure mysql is running - om mysql start.
cat <<EOF | om mysql runcommand
create database sitewp;
grant all privileges on sitewp.* to 'someuser'@localhost identified by 'SomePasword';
flush privileges;
EOF

You should now be able to visit your site in a web browser, and go through the WordPress setup procedure. You'll need the details you set in the SQL above.

-- NeilBrown - 02 Oct 2018

Topic revision: r3 - 12 Mar 2019 - 15:07:16 - NeilBrown
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
This Wiki uses Cookies