This howto will outline how to install Zope and Plone in Centos 6.x using the unified installer from Plone.org without damaging the Centos base system. For the purposes of this howto we’ll be using the latest stable version available at this time, 4.2.1.
Note: Plone is now up to 4.2.1 (stable) Please use this howto as a guide to installing the latest stable Plone release.
Applicable to Centos Versions:
- Centos 5.x
- Centos 6.x
Requirements
Explanation of requirements.
- Download the Zope/Plone Unified installer from Plone.org here
- Root or sudo access to the Centos system
- Note: Currently the EPEL software repo packages Zope 2.10-7final and Plone 3.1.6 for use with Centos, due to the Plone projects packaging choices it is unlikely that future versions of Zope or Plone will be included in this repo and will need to be installed using the method below.
Doing the Work
Basic description of what will be done and what is expected.
- Download and extract the Plone-4.2.1-UnifiedInstaller.tar.gz into a temp dir:
- Change directory to the Plone installer, read the README.txt and start the installation script:
- Next we’ll cd into the zeocluster directory and edit the buildout.cfg file. We’ll add in a few products or addons to test:
- The output of buildout should be similar to this:
- Next we’ll start the zeoserver and client1 in debug mode:
- One method for adding a separate ZODB Mountpoint to separate your data.fs if you have multiple projects/sites:
- Adding your new site(s) into your apache (httpd) configuration, this assumes you’re running your client1 on port 8181, if you aren’t, you’ll need to change this along with the obvious “mysite”:
- Version pinning:
1 |
wget https://launchpad.net/plone/4.2/4.2.1/+download/Plone-4.2.1-UnifiedInstaller.tgz && tar xvfz Plone-4.2.1-UnifiedInstaller.tgz |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
cd Plone-4.2.1-UnifiedInstaller; vi README.txt (<strong>use esc :q to exit the editor</strong>) The /opt directory is for "optional" software installs The /srv directory is for serving content: mp3s, images, pdfs, etc each of these directories should be empty on a default normal Centos install. <strong>For this howto we're going to install a zeo cluster into /srv/Plone. /opt/Plone is also a valid choice that will not harm your Centos install. For different install methods, please see the README.txt referred to above. The command below will compile and install into /srv/Plone Plone, Zope and Python. This will not harm your existing system Python which Centos needs to operate normally. Issue the following as root or with the appropriate sudo privileges:</strong> sudo ./install.sh zeo --target=/srv/Plone --password=mypass This will create the following directories: /srv/Plone<br />/srv/Plone/buildout-cache /srv/Plone/Python-2.7 /srv/Plone/zeocluster |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
cd /srv/Plone/zeocluster; sudo vi buildout.cfg (<strong>hit i to insert text, esc :qw to exit and write the changes</strong>) <strong>Under the [buildout] section after:</strong> eggs = Plone <strong>add in:</strong> ############################################ # Eggs # ---- # Add an indented line to the eggs section for any Python # eggs or packages you wish to include. # eggs = Plone Pillow collective.fancyzoomview collective.plonetruegallery <strong>Also under: zcml = </strong> <strong>add in:</strong> ############################################ # ZCML Slugs # ---------- # Some eggs need ZCML slugs to tell Zope to # use them. Eggs with names beginning with "Products." # usually don't need this. zcml = # plone.reload collective.fancyzoomview collective.plonetruegallery <font color="#cc0000">IMPORTANT</font>: If you get errors on the next command make sure you've used the same leading indentation, values for an option like eggs = subsequent lines should be indented 4 spaces. Save and exit the file and run this command: <strong>sudo bin/buildout</strong> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
[user@localhost zeocluster]$ <strong>sudo bin/buildout</strong> Uninstalling zopepy. Uninstalling client2. Uninstalling client1. Updating zope2. Updating fake eggs. Updating productdistros. Updating zeoserver. Installing client1. Getting distribution for 'collective.fancyzoomview'. Got collective.fancyzoomview 0.4.2. Getting distribution for 'collective.plonetruegallery'. Got collective.plonetruegallery 0.7.1. Generated script '/srv/Plone/zeocluster/bin/client1'. Installing client2. Generated script '/srv/Plone/zeocluster/bin/client2'. Installing zopepy. Generated interpreter '/srv/Plone/zeocluster/bin/zopepy'. Updating zopeskel. Updating chown. chown: Running chmod 600 .installed.cfg touch /srv/Plone/zeocluster/var/zeoserver/zeoserver.log find /srv/Plone/buildout-cache/eggs -type d -name LC_MESSAGES -exec chown -R zeo \{\} \; chown -R zeo /srv/Plone/zeocluster/var/filestorage chmod 700 /srv/Plone/zeocluster/var/filestorage chown -R zeo /srv/Plone/zeocluster/var/zeoserver chmod 700 /srv/Plone/zeocluster/var/zeoserver chown -R zeo /srv/Plone/zeocluster/var/client? chmod 700 /srv/Plone/zeocluster/var/client? Updating backup. Updating unifiedinstaller. Updating precompile. precompiling python scripts in /srv/Plone/zeocluster/products precompiling python scripts in /srv/Plone/zeocluster/parts/productdistros [user@localhost zeocluster]$ |
1 2 3 4 5 6 7 |
<strong>sudo bin/plonectl zeoserver start</strong> zeoserver: . daemon process started, pid=3975 <strong>sudo bin/plonectl client1 fg</strong> client1: /srv/Plone/zeocluster/parts/client1/bin/runzope -X debug-mode=on <strong>You should see a lot of output here after the initial lines above, the final line that lets us know all is well looks like this:</strong> 2009-10-20 17:43:47 INFO Zope Ready to handle requests |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<strong>First we'll need to create the directory for storing our new data.fs by hand:</strong> sudo mkdir /srv/Plone/zeocluster/var/filestorage/mysite <strong>Next we'll need to alter our buildout.cfg accordingly, this method will mimic the file structure in the ZMI (Zope Management Interface):</strong> Put this at the very bottom of the buildout.cfg: [client1] zope-conf-additional = <zodb_db mysite> <filestorage> path ${buildout:directory}/var/filestorage/mysite/Data_mysite.fs </filestorage> mount-point /mysite </zodb_db> <zodb_db mysite2> <filestorage> path ${buildout:directory}/var/filestorage/mysite2/Data_mysite2.fs </filestorage> mount-point /mysite2 </zodb_db> effective-user = plone (<strong>change this to "zeo" like the example below, this gives the proper read/write privileges to the new directory to create the new data.fs</strong>) effective-user = <strong>zeo</strong> save and exit, re-run buildout, restart the zeoserver and client1 (<em>sudo bin/buildout; sudo bin/plonectl zeoserver start; sudo bin/plonectl client1 fg</em>) Next, visit your site @ http://ip:port and from the dropdown in the upper right choose ZODB Mountpoint. From there you should see your new mountpoint, select and create it. Click on the newly created folder and from the same dropdown in the upper right select "Plone Site". Give your new site an id and create it. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<VirtualHost *:80> ServerAdmin admin@mysite.org ServerName mysite.org ServerAlias www.mysite DocumentRoot /var/www/html/mysite.org ScriptAlias /cgi-bin/ /var/www/html/mysite.org/cgi-bin/ SecRuleInheritance Off CustomLog logs/mysite.org_access_log combined ErrorLog logs/mysite.org_error_log RewriteEngine On RewriteLog /var/log/httpd/mysite.org_rewrite.log RewriteLogLevel 1 #9 for debugging# RewriteRule ^/sitemap.xml.gz$ http://127.0.0.1:8181/VirtualHostBase/http/%{SERVER_NAME}:80/mysite/mysite.org/VirtualHostRoot/sitemap.xml.gz [L,P] RewriteRule ^/(.*)/$ http://127.0.0.1:8181/VirtualHostBase/http/%{SERVER_NAME}:80/mysite/mysite.org/VirtualHostRoot/$1 [L,P] RewriteRule ^/(.*) http://127.0.0.1:8181/VirtualHostBase/http/%{SERVER_NAME}:80/mysite/mysite.org/VirtualHostRoot/$1 [L,P] </VirtualHost> <strong>Please see this information on further hardening your server against HTTP attacks and making Zope only listen locally for requests:</strong> <a class="external-link" href="https://weblion.psu.edu/trac/weblion/wiki/SecureZope">https://weblion.psu.edu/trac/weblion/wiki/SecureZope</a> |
1 2 3 4 5 6 7 8 9 10 11 12 |
<strong>In buildout.cfg at the top under [buildout], for example, we have:</strong> extends = versions.cfg versions2.cfg <strong>If both versions.cfg and versions2.cfg have a collective.foo = $version statement, the one in versions2.cfg is going to preside over versions.cfg. So in versions2.cfg we'll add a line at the top:</strong> [versions] collective.plonetruegallery = 0.7.1<strong> The benefit of pinning versions is so we don't wind up with unexpected results when running subsequent buildouts which may break our sites, effectively "pinning" a product to a specific version. We make backups or ideally run on dev servers/instances to test new versions of products/addons with our existing sites.</strong> Also, check out: <a class="external-link" href="http://good-py.appspot.com/">http://good-py.appspot.com/ </a> |
Troubleshooting & Supplementary Information
How to test
Explanation troubleshooting basics and expectations.
- Important directories and files to backup:
- Getting more products or addons for Plone:
- Deleting or removing the install:
- Useful commands:
- BASH backup scripts:
- Packing the Zope Database ZODB/Data.fs:
1 |
Important files and directories: buildout.cfg, versions.cfg, zeocluster/filestorage/* (<strong>We're after the Data.fs* files here and any subdirectories</strong>) zeocluster/products/* |
1 2 3 |
Most products here can be installed like we installed collective.fancyzoomview and collective.plonetruegallery above in the buildout.cfg <a class="external-link" href="http://plone.org/products">http://plone.org/products</a> <a class="external-link" href="http://pypi.python.org/pypi">http://pypi.python.org/pypi</a> |
1 |
With root or sudo privileges, cd /srv; sudo rm -rf Plone |
1 2 3 4 5 |
sudo bin/buildout -n -v (<strong>-n tells buildout to get the latest/newest available package, -v is for verbose output</strong>) sudo bin/plonectl start|stop (<strong>this will start/stop the zeoserver and all clients</strong>) sudo bin/plonectl zeoserver start|stop (<strong>this will start/stop the zeoserver only</strong>) sudo bin/plonectl client1 fg (<strong>this starts client1 in debug mode for troubleshooting, use control+c to exit</strong>) sudo bin/plonectl client1|client2|clients start|stop (<strong>this will start/stop client1, client2 or all clients depending on your choice</strong>) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
As root, copy and save the scripts below as a text file in: /root/plone-backup.sh, chmod +x plone-backup.sh /root/repozo-backup.sh, chmod +x repozo-backup.sh <a title="plone-backup.sh" class="internal-link" href="/scripts/plone-backup.sh">plone-backup.sh</a> click to download <a title="repozo-backup.sh" class="internal-link" href="/scripts/repozo-backup.sh">repozo-backup.sh</a> click to download To restore a repozo incremental backup here is the general syntax: python /srv/Plone/Zope-2.10.9-final-py2.4/lib/python/ZODB/scripts/repozo.py -Rv -r /srv/Plone/backup -D 2009-10-22-21-07-48.fsz -o MyBackup.fs This assumes your backups are stored in: /srv/Plone/backups and that the repozo python script is in: /srv/Plone/Zope-2.10.9-final-py2.4/lib/python/ZODB/scripts/repozo.py You will need to adjust this command to suit your needs as the scripts store the backups in /root/$DATE/$SERVER To automate and run these scripts for a nightly backup: cd /etc/cron.daily<br /><br />vi plonebackup and add: bash /root/plone-backup.sh > /dev/null 2>&1<br />chmod +x plonebackup or: vi repozobackup and add:<br />bash /root/repozo-backup.sh > /dev/null 2>&1 chmod +x repozobackup save and exit. These scripts will make backups of the important Zope & Plone files and directories to: /root/Plone-backup/$DATE/$SERVER /root/Plone-repozo-backup/$DATE/$SERVER For more information and a more verbose explanation see the Zope.org link below |
1 2 3 4 5 6 7 8 9 |
From the Root Zope ZMI (Zope Management Interface): 1. Click "Control Panel" 2. Click "Database Management" 3. Select the database you'd like to pack and the amount of days worth of history (<strong>the "days" field here signifies the amount of history you'd like saved in days</strong>) 4. Click the "Pack" button<br /> Depending on the database size this could take a few seconds or minites to finish. After it's finished you should find a "Data.fs.old" in the same directory as your Data.fs This is a backup of the Data.fs previous to being backed up in case there is a problem you can simply delete the newly created Data.fs and rename the Data.fs.old to Data.fs and restart Zope or your zeoserver and client(s). For more information and a more verbose explanation see the Zope.org link below |
Common problems and fixes
Describe common problems here, include links to known common problems if on another site
More Information
Any additional information or notes.
Disclaimer
We test this stuff on our own machines, really we do. But you may run into problems, if you do, come to #plone or #centoshelp on irc.freenode.net
Added Reading
Last Modified: 22 Apr, 2020 at 16:45:41