Difference between revisions of "Joomla 3"

From SME Server
Jump to navigationJump to search
(Add PHP requirements for two-factor authentication)
(→‎Restrict access to backend: - Edited to use custom template fragment)
Line 76: Line 76:
  
 
====Restrict access to backend====
 
====Restrict access to backend====
I wanted to restrict access to the administration backend to my LAN, so an outside user couldn't even get to the login page.  To do this, I created an .htaccess file like this:
+
I wanted to restrict access to the administration backend to my LAN, so an outside user couldn't even get to the login page.  To do this, I created a custom template fragment:
  
  [root@e-smith html]# '''nano administrator/.htaccess'''
+
  [root@e-smith ~]# '''mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf'''
 +
[root@e-smith ~]# '''cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf'''
 +
[root@e-smith httpd.conf]# '''nano -w 92Joomla'''
  
 
The contents of the file look like this:
 
The contents of the file look like this:
  
 +
<Directory /home/e-smith/files/ibays/'''joomla'''/html>
 
  Order Deny,Allow
 
  Order Deny,Allow
 
  Deny from all
 
  Deny from all
 
  Allow from 192.168.x.0/24
 
  Allow from 192.168.x.0/24
 +
</Directory>
 +
 +
You'll need to change the directory name to reflect your ibay name.  Then, expand the template and restart Apache:
 +
 +
[root@e-smith httpd.conf]# '''expand-template /etc/httpd/conf/httpd.conf'''
 +
[root@e-smith httpd.conf]# '''service httpd-e-smith restart'''
 +
Restarting httpd-e-smith                                  [  OK  ]
  
 
====Enable two-factor authentication====
 
====Enable two-factor authentication====

Revision as of 16:01, 11 October 2014

Warning.png Work in Progress:
This page is a Work in Progress. The contents off this page may be in flux, please have a look at this page history the to see list of changes.


PythonIcon.png Skill level: Medium
These instructions assume familiarity with basic shell commands


Installing Joomla! 3 on SME Server 9.0

Overview

Joomla! is a powerful, flexible content management system (CMS) that is in wide use across the Internet. This How-To will cover configuration of the SME 9.0 server to support Joomla! 3, and installation of Joomla! 3 on the SME 9.0 server. It will not cover configuration or use of Joomla! itself; those subjects are covered by the Joomla! documentation and many other sources.

As of this writing, the most recent version of Joomla! 3 is 3.3.6. This version requires PHP 5.3.10 or greater, which is a greater version than installed by default with SME 9.0. You can either upgrade PHP following these instructions, or install Joomla! 3.2.7, which will work with the stock version of PHP.

Installation of Joomla! involves creating an ibay to house Joomla!, creating a MySQL user for Joomla!, downloading and extracting the Joomla! package, and going through the Joomla! web setup.

Create the ibay

Create an ibay for Joomla! to live in. You can call it anything you want, but I'll use joomla for this example. I used the following settings: Joomla ibay.png

If you expect to give remote users the ability to log in, you should probably set "Force secure connections" to "Enabled".

Create the MySQL user

You should set up a database user just for Joomla!, rather than using the root user. To do this, log in to your SME server as root and do the following:

[root@e-smith ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 110981
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> grant all on joomla.* to joomla@localhost identified by 'password';
Query OK, 0 rows affected (0.05 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> quit
Bye

You should, of course, replace 'password' above with a secure password.

Download and extract the Joomla! package

Download the Joomla! package (either version 3.2.7 if you have chosen not to upgrade PHP, or the most recent version if you have upgraded PHP) to joomla/html and unzip it. You can do this from the command line like this (substituting the link for the most recent version). These commands will also move the .zip file out of your web-accessible space, and set ownership and permissions appropriately.

[root@e-smith ~]# cd ~joomla/../html
[root@e-smith html]# wget https://github.com/joomla/joomla-cms/releases/download/3.3.6/Joomla_3.3.6-Stable-Full_Package.zip
[root@e-smith html]# unzip Joomla_3.3.6-Stable-Full_Package.zip
[root@e-smith html]# rm index.html
[root@e-smith html]# mv Joomla_3.3.6-Stable-Full_Package.zip ../files/
[root@e-smith html]# chown -R apache:www *
[root@e-smith html]# find . -type f -exec chmod 644 {} \;
[root@e-smith html]# find . -type d -exec chmod 755 {} \;

Configure Joomla! using its web installer

Using a web browser, browse to http://yourserver/joomla. The installer is pretty self-explanatory, as shown below: Joomla installer1.png Joomla installer2.png Joomla installer3.png Joomla installer4.png

If you receive an error message when you click on the "Remove installation folder" button, you may need to remove it from the command line, like this:

[root@e-smith html]# rm -rf installation

Now you can browse to your Joomla! site at http://yourserver/joomla. It should look like this: Joomla site.png

You can go to the administration backend at http://yourserver/joomla/administrator. Once you log in with the admin user and password you specified in the installer, it should look like this:

Joomla backend.png

Security

Two possible security measures are to restrict access to the administration backend to users on your LAN, and to enable two-factor authentication.

Restrict access to backend

I wanted to restrict access to the administration backend to my LAN, so an outside user couldn't even get to the login page. To do this, I created a custom template fragment:

[root@e-smith ~]# mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
[root@e-smith ~]# cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
[root@e-smith httpd.conf]# nano -w 92Joomla

The contents of the file look like this:

<Directory /home/e-smith/files/ibays/joomla/html>
Order Deny,Allow
Deny from all
Allow from 192.168.x.0/24
</Directory>

You'll need to change the directory name to reflect your ibay name. Then, expand the template and restart Apache:

[root@e-smith httpd.conf]# expand-template /etc/httpd/conf/httpd.conf 
[root@e-smith httpd.conf]# service httpd-e-smith restart
Restarting httpd-e-smith                                   [  OK  ]

Enable two-factor authentication

Two-factor authentication allows you to use Google Authenticator, or any compatible app or device, to further secure your installation by requiring a six-digit PIN that changes every 30 seconds. You can require this for all users, or specific users. Enabling this is part of the Joomla! configuration, and is not discussed here. However, it will require installation of a PHP extension. First, you will need to add the EPEL repository to your installation. Then, if you have upgraded PHP as discussed above, do

[root@e-smith html]# yum --enablerepo=remi-php55,epel install php-mcrypt

If you have not upgraded PHP, and have installed Joomla! 3.2.7 instead, do

[root@e-smith html]# yum --enablerepo=epel install php-mcrypt

Then you can enable two-factor authentication following the Joomla! documentation.

--DanB35 (talk) 23:54, 10 October 2014 (CEST)