joomla - sinherle/Recipes GitHub Wiki

Joomla can be built for Linux on z Systems running RHEL 6, RHEL 7 ,SLES 11, SLES12 and UBUNTU 16.04 by following these instructions. Version 3.4.3 has been successfully built & tested this way. More information on Joomla is available at https://www.joomla.org and the source code can be downloaded from http://joomlacode.org

General Notes:

i) When following the steps below, please use a standard permission user unless otherwise specified.

ii) This recipe uses vi as a standard command line editor but you are welcome to use any alternative line editor of your choice

iii) A directory /<source_root>/ will be referred to in these instructions. This is a temporary writeable directory anywhere you'd like to place it.

Building Joomla

###Obtain pre-built dependencies and create /<source_root>/ directory.

  1. Use the following commands to obtain dependencies :

    For RHEL 6.6 and RHEL 7.1

    sudo yum install git wget libjpeg-devel libpng-devel

    For SLES 11 and SLES 12

    sudo zypper install git wget libjpeg-devel libpng-devel

    For UBUNTU 16.04

    sudo apt-get update
    sudo apt-get install wget apache2 mysql-server php5 php5-mysql 

Note: Add following repos in /etc/apt/sources.list file and upgrade the system, if any of the mentioned package on Ubuntu is missing.

deb http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe multiverse  
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main restricted universe multiverse  
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse  
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe multiverse  
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main restricted universe multiverse  
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main restricted universe multiverse
  1. Create the /<source_root>/ directory as mentioned above.

    mkdir /<source_root>/

###Build Apache HTTP Server for RHEL/SLES

  1. Building Apache HTTP Server 2.5

    To build the Apache HTTP Server, refer to the instructions here

###Dependency Build - MySQL 5.6.26 (For RHEL/SLES)

  1. Install MySQL following the recipe for MySQL. Run through the steps in Building MySQL recipe up until step 2 under Post installation Setup and Testing.

  2. Start the DB if it is not started

    sudo <mysql_installation_dir>/bin/mysqld_safe --user=mysql & 
  3. Grant access to the mysql user

cd /<mysql_installation_dir>/bin
sudo ./mysql
GRANT ALL PRIVILEGES ON *.* TO 'mysql'@'localhost'; 
exit

###Dependency Build - php-5.6.2 (For RHEL/SLES)

  1. Download the php source code, then extract it.
cd /<source_root>/
wget http://museum.php.net/php5/php-5.6.2.tar.gz
tar -xzvf php-5.6.2.tar.gz
cd php-5.6.2
  1. Bootstrap to configure the Makefile. Then Make and Install the utility.
./configure --with-apxs2=/<http_build_location>/bin/apxs --with-gd --with-zlib --with-mysql=<mysql_installation_dir>
make
sudo make install
**Note:**  

i) <http_build_location> is the http server installation prefix location. Default is /usr/local/apache2
ii) <mysql_installation_dir> is the mysql installation prefix location. Default is /usr/local/mysql

  1. Setup php.ini.
sudo cp php.ini-development /usr/local/lib/php.ini
  1. Update the configuration

    Firstly provide a php configuration:

    sudo cp php.ini-production /usr/local/lib/php.ini

    Secondly update the Apache configuration to support php:

    sudo vi /usr/local/apache2/conf/httpd.conf

    Update the config file to have the below section:

    #
    # DirectoryIndex: sets the file that Apache will serve if a directory
    # is requested.
    #
    <IfModule dir_module>
    DirectoryIndex index.php
    </IfModule>

    Note: We changed index.html to index.php

    Update the config file to have the below section:

    #
    # DocumentRoot: The directory out of which you will serve your
    # documents. By default, all requests are taken from this directory, but
    # symbolic links and aliases may be used to point to other locations.
    #
    
    Define DOCROOT "/usr/local/apache2/htdocs"
    DocumentRoot "${DOCROOT}"
    
    <Directory "${DOCROOT}"> 
    Options Indexes FollowSymLinks 
    AllowOverride All 
    Require all granted 
    </Directory>

    Note: We changed AllowOverride None to AllowOverride All. This will enable the Apache server rewrites.

    Update the config file to have the below line change :

    LoadModule rewrite_module modules/mod_rewrite.so 

    Note: Uncomment the line by removing "#" . This will load module for Apache server rewrites.

    Also append the following to the end of the config file:

    <FilesMatch \.php$>
    SetHandler application/x-httpd-php    
    </FilesMatch>

    Note: This section tells Apache how to handle .php files, like index.php above

    Finally restart the Apache HTTP server to make the configuration take effect:

    sudo /usr/local/apache2/bin/apachectl -k restart

Start Apache and MySQL Sever (For UBUNTU 16.04)

  1. start Apache

    sudo /usr/sbin/apachectl  -k start
    
  2. Start the DB if it is not started

    sudo /usr/bin/mysqld_safe --user=mysql & 
    
  3. Grant access to the mysql user

    /usr/bin/mysql -u root -p
    GRANT ALL PRIVILEGES ON *.* TO 'mysql'@'localhost'; 
    exit
    

###Product Build - Joomla 3.4.3

  1. Extract Joomla source code

    For RHEL and SLES

cd /<source_root>/
wget http://joomlacode.org/gf/download/frsrelease/20086/162539/Joomla_3.4.3-Stable-Full_Package.tar.gz
sudo cp Joomla_3.4.3-Stable-Full_Package.tar.gz /<http_build_location>/htdocs
mkdir -p /<http_build_location>/htdocs/Joomla
cd  /<http_build_location>/htdocs/Joomla
sudo tar -zxvf Joomla_3.4.3-Stable-Full_Package.tar.gz

For UBUNTU 16.04

cd /var/www/html
sudo mkdir Joomla
cd Joomla
sudo wget http://joomlacode.org/gf/download/frsrelease/20086/162539/Joomla_3.4.3-Stable-Full_Package.tar.gz
sudo tar -zxvf Joomla_3.4.3-Stable-Full_Package.tar.gz
  1. Move the configuration file to configuration.php
cd installation
sudo mv configuration.php-dist configuration.php
  1. Change the owner of htdocs to daemon
cd  /<http_build_location>
sudo chown -R daemon:daemon htdocs
  1. Install Joomla

    i) Start the HTTP Server (if not started)

    For RHEL/SLES

    /<http_build_location>/bin/apachectl configtest
    sudo /<http_build_location>/bin/apachectl -k start

    For UBUNTU 16.04

    sudo /usr/sbin/apachectl  -k start

    For RHEL/SLES

    ii) Start the MySQL Database (if not started)

    sudo <mysql_installation_dir>/bin/mysqld_safe --user=mysql &

    For UBUNTU 16.04

    sudo /usr/bin/mysqld_safe --user=mysql &

    iii) Access the Joomla install file using a browser

    http://<host-ip>:<port>/installation/index.php

    Note: if you get an error like "Forbidden You don't have permission to access / on this server" you may need to update the permissions of the parent directory where you installed Apache HTTP Server, for example sudo chmod o+x <user parent directory>

###[Optional] Post installation Setup and Testing.

  1. To Manage the site content visit the index file at

     http://<host-ip>:<port>/Joomla/index.php

###[Optional] Clean up.

  1. Remove the /<source_root>/ directory to tidy up.
```shell
sudo rm -rf /<source_root>/
sudo rm /<http_build_location>/htdocs/Joomla_3.4.3-Stable-Full_Package.tar.gz
```

###References:
http://php.net/manual/en/install.unix.apache2.php
https://docs.joomla.org/J3.x:Installing_Joomla#cite_note-PHPFileHandler-3

⚠️ **GitHub.com Fallback** ⚠️