Table Of Contents

Previous topic

Expert Plone User Guide

Next topic

Creating your own CA certificate

This Page

Plone On Ubuntu

Installing Plone on Ubuntu

This how-to assumes some knowledge of how to get thing done on Linux, and Ubuntu or Debian. For example, how to use the command line, and the package manager is assumed.

Install the following packages:

apt-get install make gcc g++
apt-get install libxml2 libxml2-dev libxslt1-dev
apt-get install zlibc libbz2-dev libssl-dev p7zip-full unzip
apt-get install unace unp bzip2 gzip patch

Other packages that I’ve had to resort to:

zlib1g-dev

I install emacs as well since that’s the editor that my fingers remember best.

Download the unified installer from the Plone download site:

wget https://launchpad.net/plone/<blah>/Plone-4.2.1-UnifiedInstaller.tgz

(Visit the plone download pages to get the actual URL).

Untar the package:

tar xvf Plone-<version>-UnifiedInstaller.tgz

Until Plone fix this bug, you will need to edit the setup.py that is in the package packages/Python-2.7.3.tar.bz2 to add the library path /usr/lib/i386-linux-gnu/ for it to find the zlib library libz.so. You can edit the bz2 file directly in emacs, or you’ll have to unzip the archive, make the change, and then zip it up again:

lib_dirs = self.compiler.library_dirs + [
    ...,
    '/usr/lib/i386-linux-gnu',
    '/usr/lib/x86_64-linux-gnu',
]

This will cover both 32- and 64-bit architectures.

Then run:

sudo ./install.sh zeo

After much building and compilation, the build should report success.

The zeo install puts the product into the folder /usr/local/Plone/zeocluster by default. It’s in this folder that most of the commands to configure and run the web server must be run. So, run the following as root:

cd /usr/local/Plone/zeocluster
bin/plonectl start

Visit the web-site in a browser on port 8080. You should see a page saying “Plone is up and running”. Success! Now the fun begins in creating a site instance and customizing it.

Creating a site instance

You will need the admin password that was generated during the install: it gets written into the file buildout.cfg:

grep admin buildout.cfg

Copy the password from the output, which will look something like this:

user=admin:abcdefgh

In the browser, click on the “Create new Plone site” button, and log in using the admin credentials from the above command. In the form, add the name, the short name and select the first batch of add-ons. I would recommend the following:

  • Diazo theme support
  • Static resource storage
  • Workflow Policy Support
  • collective.z3cform.datetimewidget

and hit “Create Plone Site”. Once again, we should experience a major sense of achievement - the site we want is up and running.

Install Plone Packages

Let’s install our first add-on package to see what the procedure is. In your favourite editor, edit the buildout.cfg file. Look for the following section:

eggs =
   Plone
   Pillow

and then add one line to that list of eggs:

eggs =
   Plone
   Pillow
   diazotheme.bootstrap

Whenever the buildout.cfg file is changed the Plone server needs to be re-configured, and re-started. To reconfigure run:

bin/buildout

The buildout tool is a very rich build system and configuration tool for Python, and detailed discussion of it is beyond the scope of this how-to. For now, just recognize that after any change to buildout.cfg, or any of the .cfg file it imports, buildout must be run again. After much churning, the buildout should complete. Now to restart the server:

bin/plonectl stop
bin/plonectl start

This makes the package available to Plone to use in any of the sites running in that Plone instance. To enable the package for the site we’ve just created, select the ‘admin’ drop-down on the top-right-hand side of the page, and select “Site Setup”. Select the “Add-ons” configuration option. In that form, tick the check box for the diazotheme.bootstrap, and click “Activate”. This package is a new theme for the site, so when you go back to the Home page you should see a very different look to the site. This particular theme is very plain and simple, and might be a good starting point for creating your own theme.

Let’s add a few more packages that I find very useful. Edit the eggs entry in the buildout.cfg to include the following:

collective.quickupload
collective.easyslidshow
collective.googleanalytics
collective.rip
collective.blogging
quintagroup.portlet.generichtml
sc.social.like
collective.disqus

and then perform the following steps again (this will become second nature after a while).

  1. Run bin/buildout.

  2. Stop and start the plone server:

    bin/plonectl stop
    bin/plonectl start
  3. Enable the add-ons in the Site Setup.

Maintenance

Automatic start up

Before launching the site, you’ll need to make sure that the plone server is run automatically when the machine reboots. To do this, run the following as root:

ln -s /usr/local/Plone/zeocluster/bin/plonectl /etc/init.d/plonectl
update-rc.d plonectl defaults

Backups

If you google “backups of Plone” you will find a lot on information which can be a bit overwhelming. My take on it is to create a backup script like the one shown below and put it somewhere into the Plone folder - perhaps the bin folder - called backupall, and make it executable by root. It assumes you have an ftp site that allows rsync to save data to it. Change the details that are in <...> at the top of the file to the relevant details of your setup:

#!/bin/sh

HOSTNAME=<your-backup-server>
USERNAME=<your-username-on-that-machine>
VERBOSE=-v
LHOST=<your-local-server-name>
RPATH=$LHOST/plonebackup
LPATH=/usr/local/Plone/zeocluster

# Create the new backup files in var/backups
/usr/local/Plone/zeocluster/bin/backup -q

# make sure the remote folders exist
ssh $USERNAME@$HOSTNAME "mkdir -p $RPATH"

# Copy the backups directory to the backup server
rsync $VERBOSE -a --delete -e "ssh -l $USERNAME" $LPATH/var/backups $HOSTNAME:$RPATH

# Copy the blob storage
rsync $VERBOSE -a --delete -e "ssh -l $USERNAME" $LPATH/var/blobstorage $HOSTNAME:$RPATH

# copy the setup to the backup server
rsync $VERBOSE -e ssh $LPATH/buildout.cfg $USERNAME@$HOSTNAME:$RPATH/buidout.cfg

Now we need to run this script regularly. First we must pack the database weekly - this reduces the size of it and stops it growing indefinitely, which is the nature of the ZODB. The following crontab commands run the zeopack at 2:00am on Monday morning and runs the above backup script every morning at 4:00am. Run crontab -e and then paste the following into the editor window:

0 2 * * 0 /usr/local/Plone/zeocluster/bin/zeopack
0 4 * * * /usr/local/Plone/zeocluster/bin/backupall

Save and close the editor, and then check it’s been accepted with crontab -l. Set the environment VISUAL to the name of the editor if you don’t want the default vi.

Setting up the private and public keys to allow this script to both rsync and ssh into the backup server is beyond the scope of this how-to, but this page describes how to do it.

Installing Some Plone Add-ons

Installing a PDF document viewer

The collective.documentviewer add-on is built on top of the docsplit tools. This description distills the install requirements to their bare essentials.

Run the following:

sudo apt-get rubygem

sudo gem install docsplit

sudo apt-get install graphicsmagick

sudo apt-get install poppler-utils

Then add collective.documentviewer to the buildout.cfg eggs, run bin/buildout and then stop (bin/plonectl stop) and restart (bin/plonectl start) the plone server.

Select and Activate the Add-on in the Setup / Add-ons page. Add a PDF file content type.

Installing a Google Analytics Add-on

TODO