Skip to content

keystone_currency

Cnaik edited this page Jun 19, 2019 · 8 revisions

Building WordPress

Below versions of WordPress are available in respective distributions at the time of creation of these build instructions:

  • Ubuntu 16.04 has 4.4.2
  • Ubuntu 18.04 has 4.9.5
  • Ubuntu 19.04 has 5.1.1

The instructions provided below specify the steps to build WordPress version 5.2.1 on Linux on IBM Z for following distributions:

  • RHEL (6.10, 7.4, 7.5, 7.6)
  • SLES (12 SP4, 15)
  • Ubuntu (16.04, 18.04, 19.04)

General Notes:

  • When following the steps below please use a standard permission user unless otherwise specified.
  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writeable directory anywhere you'd like to place it.

Step 1: Building and Installing WordPress

1.1) Install dependencies

  • RHEL 6.10

    sudo yum install httpd git mysql mysql-server
  • RHEL (7.4, 7.5, 7.6)

    sudo yum install httpd git mariadb mariadb-server 
  • SLES (12 SP4, 15)

    sudo zypper install apache2 apache2-devel tar wget git-core mariadb  php7 php7-devel php7-mysql apache2-mod_php7 curl
  • Ubuntu (16.04, 18.04, 19.04)

    sudo apt-get update
    sudo apt-get install git apache2 mysql-server php php-mysql libapache2-mod-php
  • Build PHP (For RHEL only) Instructions for building PHP can be found here. Follow instructions till step 1.7 (choose option Without intl extensions)

1.3) Make changes in the configuration file

(You should be root to do the below changes.)

  • RHEL (6.10)

    • /etc/httpd/conf/httpd.conf

      --- /etc/httpd/conf/httpd.conf_orig     2019-06-18 01:44:18.694251985 -0400
      +++ /etc/httpd/conf/httpd.conf  2019-06-18 02:22:02.302641578 -0400
      @@ -290,7 +290,7 @@
       # documents. By default, all requests are taken from this directory, but
       # symbolic links and aliases may be used to point to other locations.
       #
      -DocumentRoot "/var/www/html"
      +DocumentRoot "/var/www/html/WordPress"
      
       #
       # Each directory to which Apache has access can be configured with respect
      @@ -315,7 +315,7 @@
       #
       # This should be changed to whatever you set DocumentRoot to.
       #
      -<Directory "/var/www/html">
      +<Directory "/var/www/html/WordPress">
      
       #
       # Possible values for the Options directive are "None", "All",
      @@ -1008,3 +1008,11 @@
       #    ErrorLog logs/dummy-host.example.com-error_log
       #    CustomLog logs/dummy-host.example.com-access_log common
       #</VirtualHost>
      +
      +ServerName localhost
      +<Directory />
      + DirectoryIndex index.php
      +</Directory>
      +<FilesMatch \.php$>
      +SetHandler application/x-httpd-php
      +</FilesMatch>
  • RHEL (7.4, 7.5, 7.6)

    • /etc/httpd/conf/httpd.conf

      --- /etc/httpd/conf/httpd.conf_orig	2019-06-18 12:34:49.078128838 +0000
      +++ /etc/httpd/conf/httpd.conf	2019-06-19 05:15:35.908798531 +0000
      @@ -117,7 +117,7 @@
       # documents. By default, all requests are taken from this directory, but
       # symbolic links and aliases may be used to point to other locations.
       #
      -DocumentRoot "/var/www/html"
      +DocumentRoot "/var/www/html/WordPress"
      
       #
       # Relax access to content within /var/www.
      @@ -129,7 +129,7 @@
       </Directory>
      
       # Further relax access to the default document root:
      -<Directory "/var/www/html">
      +<Directory "/var/www/html/WordPress">
           #
           # Possible values for the Options directive are "None", "All",
           # or any combination of:
      @@ -352,3 +352,10 @@
       #
       # Load config files in the "/etc/httpd/conf.d" directory, if any.
       IncludeOptional conf.d/*.conf
      +ServerName localhost
      +<Directory />
      + DirectoryIndex index.php
      +</Directory>
      +<FilesMatch \.php$>
      +SetHandler application/x-httpd-php
      +</FilesMatch>
  • SLES (12 SP4, 15)

    • /etc/apache2/default-server.conf

      --- /etc/apache2/default-server.conf_orig	2019-06-18 06:57:55.298714625 +0000
      +++ /etc/apache2/default-server.conf	2019-06-18 10:09:30.720084493 +0000
      @@ -3,12 +3,12 @@
       # deleted here, or overriden elswhere.
       # 
      
      -DocumentRoot "/srv/www/htdocs"
      +DocumentRoot "/srv/www/htdocs/WordPress"
      
       #
       # Configure the DocumentRoot
       #
      -<Directory "/srv/www/htdocs">
      +<Directory "/srv/www/htdocs/WordPress">
      	# Possible values for the Options directive are "None", "All",
      	# or any combination of:
      	#   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    • /etc/apache2/httpd.conf

      --- /etc/apache2/httpd.conf_orig	2019-06-18 09:03:55.901418888 +0000
      +++ /etc/apache2/httpd.conf	2019-06-18 09:05:34.897668037 +0000
      @@ -226,3 +226,10 @@
       #       putting its name into APACHE_CONF_INCLUDE_FILES in 
       #       /etc/sysconfig/apache2 -- this will make system updates 
       #       easier :) 
      +
      +AddType application/x-httpd-php .php
      +ServerName localhost
      +<Directory />
      + DirectoryIndex index.php
      +</Directory>
      +LoadModule php7_module /usr/lib64/apache2/mod_php7.so
  • Ubuntu (16.04, 18.04, 19.04)

    • /etc/apache2/apache2.conf

      --- /etc/apache2/apache2.conf_orig	2019-06-18 15:52:07.961956798 +0530
      +++ /etc/apache2/apache2.conf	2019-06-18 15:53:35.382150820 +0530
      @@ -225,3 +225,8 @@
       IncludeOptional sites-enabled/*.conf
      
       # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
      +AddType application/x-httpd-php .php
      +ServerName localhost
      +<Directory />
      + DirectoryIndex index.php
      +</Directory>
    • /etc/apache2/sites-available/000-default.conf

      --- /etc/apache2/sites-available/000-default.conf_orig	2019-06-18 15:52:26.725558243 +0530
      +++ /etc/apache2/sites-available/000-default.conf	2019-06-18 15:54:31.852903705 +0530
      @@ -9,7 +9,7 @@
      	#ServerName www.example.com
       
      	ServerAdmin webmaster@localhost
      -	DocumentRoot /var/www/html
      +	DocumentRoot /var/www/html/WordPress
       
      	# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
      	# error, crit, alert, emerg.

1.4) Download and install WordPress

  • Download WordPress source code

    cd /var/www/html   #RHEL (6.10, 7.4, 7.5, 7.6)  and Ubuntu (16.04, 18.04, 19.04)
    cd /srv/www/htdocs #SLES (12 SP4, 15)
    sudo git clone git://github.com/WordPress/WordPress.git
    cd WordPress
    sudo git checkout 5.2.1
  • Rename wp-config-sample.php as wp-config.php

    sudo mv wp-config-sample.php wp-config.php 
  • Make the following changes in the wp-config.php file ( You may require root permissions to do the changes.)

    --- wp-config.php_orig	2019-06-18 11:16:29.939997876 +0000
    +++ wp-config.php	2019-06-18 11:27:05.383398076 +0000
    @@ -20,16 +20,16 @@
    
     // ** MySQL settings - You can get this info from your web host ** //
     /** The name of the database for WordPress */
    -define( 'DB_NAME', 'database_name_here' );
    +define( 'DB_NAME', 'WORDPRESS' );
    
     /** MySQL database username */
    -define( 'DB_USER', 'username_here' );
    +define( 'DB_USER', 'Wordpress' );
    
     /** MySQL database password */
    -define( 'DB_PASSWORD', 'password_here' );
    +define( 'DB_PASSWORD', 'password' );
    
     /** MySQL hostname */
    -define( 'DB_HOST', 'localhost' );
    +define( 'DB_HOST', '127.0.0.1' );
    
     /** Database Charset to use in creating database tables. */
     define( 'DB_CHARSET', 'utf8' );

1.5) Prerequisites to start WordPress

  • Start httpd server

    • RHEL (6.10, 7.4, 7.5, 7.6) and SLES (12 SP4, 15)
     sudo /usr/sbin/httpd -D BACKGROUND  
    • Ubuntu (16.04, 18.04, 19.04)
     sudo service apache2 start          
  • Start MySQL service

    Note: For reference, click here

  • Create database and grant privileges to 'Wordpress' user

    Note: First two commands will prompt for password. Press Enter if the password for root user is not set.

    sudo /usr/bin/mysql  -h <DB_HOST> -uroot -p -e "create database WORDPRESS" && sudo /usr/bin/mysql -h <DB_HOST> -uroot -p -e "create user 'Wordpress'@'localhost' identified by 'password'" 
    sudo /usr/bin/mysql  -h <DB_HOST> -uroot -p -e "grant all privileges on WORDPRESS.* to 'Wordpress'@'localhost' identified by 'password' with GRANT OPTION"

Note: After starting Apache httpd Server and MySQL Service, direct your Web browser to the WordPress Admin Console at http://<HOST_IP>:<PORT>.

References

https://wordpress.org/