RBE10K/Website/Installation
From The Crowdsourced Resource-Based Economy Knowledgebase
This section documents the installation of a functional version of Joomla 3.0.3
Contents |
Installation
These are the full steps in order for a successful installation of an brand new Joomla 3.0.3 system.
- Download and extract the installation file in a suitable system folder for running the web app (http://joomlacode.org/gf/download/frsrelease/17965/78414/Joomla_3.0.3-Stable-Full_Package.zip)
- Set-up the permissions specified below
- Apply the patches specified below
- Create an Apache2 config file for this installation as per specified below, updating the directories and URLs to match. Restart the apache2 service. Note: should there be a problem during the installation, comment the #RewriteEngine On row.
- Run the application. On first run the application will install itself. Finish the installation and open and login into the Administrator.
- Apply the database patches specified below (straight into the database), and also in the Administrator apply all the database updates (should say one or maybe two).
- In Administrator, configure the system to use Use URL rewriting and Search Engine Friendly URLs (in Global Configuration/Site)
- If it had been required to comment #RewriteEngine On in the Apache2 config file, try now uncommenting it and restarting apache2
Permissions
The following permissions are required. These must be applied before running the installation script.
chmod -v 0777 administrator/components chmod -v 0777 administrator/language chmod -v 0777 administrator/language/en-GB chmod -v 0777 administrator/language/overrides chmod -v 0777 administrator/manifests/files chmod -v 0777 administrator/manifests/libraries chmod -v 0777 administrator/manifests/packages chmod -v 0777 administrator/modules chmod -v 0777 administrator/templates chmod -v 0777 components chmod -v 0777 images chmod -v 0777 images/banners chmod -v 0777 images/sampledata chmod -v 0777 language chmod -v 0777 language/en-GB chmod -v 0777 language/overrides chmod -v 0777 libraries chmod -R -v 0777 media chmod -v 0777 modules chmod -v 0777 plugins chmod -v 0777 plugins/authentication chmod -v 0777 plugins/captcha chmod -v 0777 plugins/content chmod -v 0777 plugins/editors chmod -v 0777 plugins/editors-xtd chmod -v 0777 plugins/extension chmod -v 0777 plugins/finder chmod -v 0777 plugins/quickicon chmod -v 0777 plugins/search chmod -v 0777 plugins/system chmod -v 0777 plugins/user chmod -v 0777 templates chmod -v 0777 configuration.php chmod -v 0777 cache chmod -v 0777 administrator/cache chmod -v 0777 logs chmod -v 0777 tmp chmod -v 0777 . chmod -R -v 0777 installation
Patches
The following patches are required. These must be implemented before running the installation script.
diff -rubN -X diffignore.txt joomla_inst/administrator/components/com_admin/sql/updates/postgresql/3.0.3.sql joomla/administrator/components/com_admin/sql/updates/postgresql/3.0.3.sql --- joomla_inst/administrator/components/com_admin/sql/updates/postgresql/3.0.3.sql 2013-02-04 11:05:45.000000000 +1100 +++ joomla/administrator/components/com_admin/sql/updates/postgresql/3.0.3.sql 2013-03-01 12:54:30.000000000 +1100 @@ -1 +1,2 @@ -ALTER TABLE `#__associations` ALTER COLUMN id TYPE INT(11); \ No newline at end of file +ALTER TABLE "#__associations" ALTER COLUMN id TYPE integer; +ALTER TABLE "#__modules" ALTER COLUMN content SET DEFAULT ''; diff -rubN -X diffignore.txt joomla_inst/administrator/components/com_categories/models/categories.php joomla/administrator/components/com_categories/models/categories.php --- joomla_inst/administrator/components/com_categories/models/categories.php 2013-02-04 11:05:45.000000000 +1100 +++ joomla/administrator/components/com_categories/models/categories.php 2013-03-01 14:25:04.000000000 +1100 @@ -164,10 +164,14 @@ $assoc = $this->getAssoc(); if ($assoc) { - $query->select('COUNT(asso2.id)>1 as association'); - $query->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context='.$db->quote('com_categories.item')); - $query->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key'); - $query->group('a.id'); + $q = $db->getQuery(true); + $q->select('COUNT(asso2.id)'); + $q->from('#__associations AS asso'); + $q->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key'); + $q->where('asso.id = a.id AND asso.context='.$db->quote('com_categories.item')); + + $query->select('(' . $q . ')>1 as association'); + unset($q); } // Filter by extension diff -rubN -X diffignore.txt joomla_inst/administrator/components/com_contact/models/contacts.php joomla/administrator/components/com_contact/models/contacts.php --- joomla_inst/administrator/components/com_contact/models/contacts.php 2013-02-04 11:05:45.000000000 +1100 +++ joomla/administrator/components/com_contact/models/contacts.php 2013-03-01 14:27:10.000000000 +1100 @@ -182,10 +182,14 @@ $assoc = isset($app->item_associations) ? $app->item_associations : 0; if ($assoc) { - $query->select('COUNT(asso2.id)>1 as association'); - $query->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context='.$db->quote('com_contact.item')); - $query->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key'); - $query->group('a.id'); + $q = $db->getQuery(true); + $q->select('COUNT(asso2.id)'); + $q->from('#__associations AS asso'); + $q->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key'); + $q->where('asso.id = a.id AND asso.context='.$db->quote('com_contact.item')); + + $query->select('(' . $q . ')>1 as association'); + unset($q); } // Filter by access level. diff -rubN -X diffignore.txt joomla_inst/administrator/components/com_content/models/articles.php joomla/administrator/components/com_content/models/articles.php --- joomla_inst/administrator/components/com_content/models/articles.php 2013-02-04 11:05:45.000000000 +1100 +++ joomla/administrator/components/com_content/models/articles.php 2013-03-01 14:28:08.000000000 +1100 @@ -189,10 +189,14 @@ $assoc = isset($app->item_associations) ? $app->item_associations : 0; if ($assoc) { - $query->select('COUNT(asso2.id)>1 as association'); - $query->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context='.$db->quote('com_content.item')); - $query->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key'); - $query->group('a.id'); + $q = $db->getQuery(true); + $q->select('COUNT(asso2.id)'); + $q->from('#__associations AS asso'); + $q->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key'); + $q->where('asso.id = a.id AND asso.context='.$db->quote('com_content.item')); + + $query->select('(' . $q . ')>1 as association'); + unset($q); } // Filter by access level. diff -rubN -X diffignore.txt joomla_inst/administrator/components/com_joomlaupdate/models/default.php joomla/administrator/components/com_joomlaupdate/models/default.php --- joomla_inst/administrator/components/com_joomlaupdate/models/default.php 2013-02-04 11:05:45.000000000 +1100 +++ joomla/administrator/components/com_joomlaupdate/models/default.php 2013-03-01 12:54:30.000000000 +1100 @@ -664,7 +664,7 @@ // Clobber any possible pending updates $update = JTable::getInstance('update'); $uid = $update->find( - array('element' => $element, 'type' => 'file', 'client_id' => '', 'folder' => '') + array('element' => $element, 'type' => 'file', 'client_id' => 0, 'folder' => '') ); if ($uid) diff -rubN -X diffignore.txt joomla_inst/administrator/components/com_menus/helpers/html/menus.php joomla/administrator/components/com_menus/helpers/html/menus.php --- joomla_inst/administrator/components/com_menus/helpers/html/menus.php 2013-02-04 11:05:45.000000000 +1100 +++ joomla/administrator/components/com_menus/helpers/html/menus.php 2013-03-01 14:56:49.000000000 +1100 @@ -32,7 +32,7 @@ $query->select('mt.title as menu_title'); $query->from('#__menu as m'); $query->leftJoin('#__menu_types as mt ON mt.menutype=m.menutype'); - $query->where('m.id IN ('.implode(',', array_values($associations)).')'); + $query->where('m.id ' . ($associations ? 'IN ('.implode(',', array_values($associations)).')' : ' = -1')); $query->leftJoin('#__languages as l ON m.language=l.lang_code'); $query->select('l.image'); $query->select('l.title as language_title'); diff -rubN -X diffignore.txt joomla_inst/administrator/components/com_menus/models/items.php joomla/administrator/components/com_menus/models/items.php --- joomla_inst/administrator/components/com_menus/models/items.php 2013-02-04 11:05:45.000000000 +1100 +++ joomla/administrator/components/com_menus/models/items.php 2013-03-01 14:28:54.000000000 +1100 @@ -215,10 +215,14 @@ $assoc = isset($app->item_associations) ? $app->item_associations : 0; if ($assoc) { - $query->select('COUNT(asso2.id)>1 as association'); - $query->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context='.$db->quote('com_menus.item')); - $query->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key'); - $query->group('a.id'); + $q = $db->getQuery(true); + $q->select('COUNT(asso2.id)'); + $q->from('#__associations AS asso'); + $q->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key'); + $q->where('asso.id = a.id AND asso.context='.$db->quote('com_menus.item')); + + $query->select('(' . $q . ')>1 as association'); + unset($q); } // Join over the extensions diff -rubN -X diffignore.txt joomla_inst/administrator/components/com_newsfeeds/models/newsfeeds.php joomla/administrator/components/com_newsfeeds/models/newsfeeds.php --- joomla_inst/administrator/components/com_newsfeeds/models/newsfeeds.php 2013-02-04 11:05:45.000000000 +1100 +++ joomla/administrator/components/com_newsfeeds/models/newsfeeds.php 2013-03-01 14:29:47.000000000 +1100 @@ -174,10 +174,14 @@ $assoc = isset($app->item_associations) ? $app->item_associations : 0; if ($assoc) { - $query->select('COUNT(asso2.id)>1 as association'); - $query->join('LEFT', '#__associations AS asso ON asso.id = a.id AND asso.context='.$db->quote('com_newsfeeds.item')); - $query->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key'); - $query->group('a.id'); + $q = $db->getQuery(true); + $q->select('COUNT(asso2.id)'); + $q->from('#__associations AS asso'); + $q->join('LEFT', '#__associations AS asso2 ON asso2.key = asso.key'); + $q->where('asso.id = a.id AND asso.context='.$db->quote('com_newsfeeds.item')); + + $query->select('(' . $q . ')>1 as association'); + unset($q); } // Filter by access level. diff -rubN -X diffignore.txt joomla_inst/libraries/cms/schema/changeitem/postgresql.php joomla/libraries/cms/schema/changeitem/postgresql.php --- joomla_inst/libraries/cms/schema/changeitem/postgresql.php 2013-02-04 11:05:45.000000000 +1100 +++ joomla/libraries/cms/schema/changeitem/postgresql.php 2013-03-01 12:54:30.000000000 +1100 @@ -155,7 +155,8 @@ $this->checkQueryExpected = 0; $this->msgElements = array($this->fixQuote($idx)); } - elseif ($alterCommand == 'CREATE INDEX' || (strtoupper($alterCommand . $wordArray[2]) == 'CREATE UNIQUE INDEX')) + //elseif ($alterCommand == 'CREATE INDEX' || (strtoupper($alterCommand . $wordArray[2]) == 'CREATE UNIQUE INDEX')) + elseif ($command == 'CREATE INDEX' || (strtoupper($command . $wordArray[2]) == 'CREATE UNIQUE INDEX')) { if ($wordArray[1] === 'UNIQUE') { diff -rubN -X diffignore.txt joomla_inst/libraries/cms.php joomla/libraries/cms.php --- joomla_inst/libraries/cms.php 2013-02-04 11:05:45.000000000 +1100 +++ joomla/libraries/cms.php 2013-03-01 12:54:30.000000000 +1100 @@ -31,6 +31,8 @@ // Define the Joomla version if not already defined. if (!defined('JVERSION')) { + if(!defined('_JEXEC')) { define('_JEXEC'); } + include_once __DIR__ . '/cms/version/version.php'; $jversion = new JVersion; define('JVERSION', $jversion->getShortVersion()); } diff -rubN -X diffignore.txt joomla_inst/libraries/joomla/installer/adapters/file.php joomla/libraries/joomla/installer/adapters/file.php --- joomla_inst/libraries/joomla/installer/adapters/file.php 2013-02-04 11:05:45.000000000 +1100 +++ joomla/libraries/joomla/installer/adapters/file.php 2013-03-01 12:54:30.000000000 +1100 @@ -378,7 +378,7 @@ // Clobber any possible pending updates $update = JTable::getInstance('update'); $uid = $update->find( - array('element' => $this->get('element'), 'type' => 'file', 'client_id' => '', 'folder' => '') + array('element' => $this->get('element'), 'type' => 'file', 'client_id' => 0, 'folder' => '') ); if ($uid) diff -rubN -X diffignore.txt joomla_inst/libraries/joomla/installer/adapters/language.php joomla/libraries/joomla/installer/adapters/language.php --- joomla_inst/libraries/joomla/installer/adapters/language.php 2013-02-04 11:05:45.000000000 +1100 +++ joomla/libraries/joomla/installer/adapters/language.php 2013-03-01 12:54:30.000000000 +1100 @@ -250,7 +250,7 @@ // Clobber any possible pending updates $update = JTable::getInstance('update'); - $uid = $update->find(array('element' => $this->get('tag'), 'type' => 'language', 'client_id' => '', 'folder' => '')); + $uid = $update->find(array('element' => $this->get('tag'), 'type' => 'language', 'client_id' => 0, 'folder' => '')); if ($uid) { $update->delete($uid); @@ -352,7 +352,7 @@ // Clobber any possible pending updates $update = JTable::getInstance('update'); - $uid = $update->find(array('element' => $this->get('tag'), 'type' => 'language', 'client_id' => $clientId)); + $uid = $update->find(array('element' => $this->get('tag'), 'type' => 'language', 'client_id' => (int)$clientId)); if ($uid) { $update->delete($uid); @@ -360,7 +360,7 @@ // Update an entry to the extension table $row = JTable::getInstance('extension'); - $eid = $row->find(array('element' => strtolower($this->get('tag')), 'type' => 'language', 'client_id' => $clientId)); + $eid = $row->find(array('element' => strtolower($this->get('tag')), 'type' => 'language', 'client_id' => (int)$clientId)); if ($eid) { $row->load($eid); @@ -374,7 +374,7 @@ $row->set('enabled', 1); $row->set('protected', 0); $row->set('access', 0); - $row->set('client_id', $clientId); + $row->set('client_id', (int)$clientId); $row->set('params', $this->parent->getParams()); } $row->set('name', $this->get('name')); diff -rubN -X diffignore.txt joomla_inst/libraries/legacy/table/menu.php joomla/libraries/legacy/table/menu.php --- joomla_inst/libraries/legacy/table/menu.php 2013-02-04 11:05:45.000000000 +1100 +++ joomla/libraries/legacy/table/menu.php 2013-03-01 12:54:30.000000000 +1100 @@ -144,7 +144,7 @@ // Verify that the alias is unique $table = JTable::getInstance('Menu', 'JTable', array('dbo' => $this->getDbo())); - if ($table->load(array('alias' => $this->alias, 'parent_id' => $this->parent_id, 'client_id' => $this->client_id, 'language' => $this->language)) + if ($table->load(array('alias' => $this->alias, 'parent_id' => $this->parent_id, 'client_id' => (int)$this->client_id, 'language' => $this->language)) && ($table->id != $this->id || $this->id == 0)) { if ($this->menutype == $table->menutype) diff -rubN -X diffignore.txt joomla_inst/libraries/loader.php joomla/libraries/loader.php --- joomla_inst/libraries/loader.php 2013-02-04 11:05:45.000000000 +1100 +++ joomla/libraries/loader.php 2013-03-01 12:54:30.000000000 +1100 @@ -330,7 +330,7 @@ // Load the file if it exists. if (file_exists($path)) { - return include $path; + return include_once $path; } } }
Apache Virtual Host config
<IfDefine DEFAULT_VHOST>
<VirtualHost *:80>
ServerName 10k.rbem.org
ServerAlias www.rbem.org
DocumentRoot "/var/www/org.rbem.10k/htdocs/joomla"
<Directory "/var/www/org.rbem.10k/htdocs/joomla">
Options FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
</Directory>
ErrorLog /var/log/apache2/10k.rbemwiki.org-error.log
CustomLog /var/log/apache2/10k.rbemwiki.org-access.log common
</VirtualHost>
</IfDefine>
<VirtualHost *:80>
ServerName 10k.rbem.org
ServerAlias www.rbem.org
DocumentRoot "/var/www/org.rbem.10k/htdocs/joomla"
<Directory "/var/www/org.rbem.10k/htdocs/joomla">
Options FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_URI} !^/index\.php
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]
</Directory>
ErrorLog /var/log/apache2/10k.rbemwiki.org-error.log
CustomLog /var/log/apache2/10k.rbemwiki.org-access.log common
</VirtualHost>
</IfDefine>
Database patches
These database patches must be applied directly on the database. They can be applied through psql command-line tool, or a graphical front-end like pgAdmin3.
SELECT SETVAL(pg_get_serial_sequence('j_template_styles', 'id'), 9, FALSE); SELECT SETVAL(pg_get_serial_sequence('j_assets', 'id'), 35, FALSE);