Quickstart - Plone Site installation on Debian/Vm

Hi,

I recently installed Virtualmin GPL on Debian Lenny and found it quite easy and a pleasure to work with. I also wanted to install Plone, which I had deployed together with Webmin on Debian Etch before. - Why Plone? For me it was, because it has by far the best multi-lingual support of any open-source CMS I have come across. Also, I like the security and stability provided by the Zope/Plone platform and the Python language.

Since I did not find much information in this Forum regarding using Plone/Zope together with Virtualmin, I would like to share a short Quickstart guide on how to do this. I noticed that someone else here had difficulty in setting this up as mentioned in this thread. Its actually much easier, than anticipated, as Virtualmin makes it a joy to setup virtual hosts, which Apache will gladly forward to your Plone site. Virtualmin’s default configuration of Apache also provides almost all that is needed.

My goal was to setup Plone behind Apache 2, so that http://www.test-site.net would be served by the Plone/Zope server instance. The following guide was applied on Debian 5, but should work with minor changes on Debian 4 or Ubuntu 8.04 to 9.04. Even, if you have never tried Plone before, following these simple steps should give you a speedy start into a powerful CMS.

Check Prerequisites

  • Debian 5 Lenny with Virtualmin 3.69+ installed and working
  • enough free memory (especilly on a VPS). Plone will need an additional 100 MB at least!
  • if not yet set up, install the build packages which will be used by the installer to compile Plone:

sudo aptitude install build-essential

— recommended libraries —

The following libraries should be installed:

  • libssl (SSL support)
  • zlib (GZ compression)
  • libjpeg (jpeg support)
  • libxml2 (used by marshall in Plone)
  • libreadline (Python command-line history)
  • poppler-utils (used for PDF to html conversion)

To install them type:
sudo aptitude install libssl-dev zlib1g-dev libjpeg62-dev
sudo aptitude install libxml2-dev libreadline5-dev
sudo aptitude --without-recommends install poppler-utils

note:

  • wv (used to index Word documents) may not be needed, and can be installed later

Plone Installation

— download plone —

Get the current download url from http://plone.org/products/plone, for example:

wget hxxp://launchpad.net/plone/3.2/3.2.2/+download/Plone-3.2.2-UnifiedInstaller.tgz
tar -zxf Plone-*

  • read the extracted README.txt about Plone installation :wink:

— Install as root or sudo —

  • Install Plone 3.2.2 in a ‘stand-alone’ (single Zope instance) configuration to /usr/local/Plone:

cd Plone-*
sudo ./install.sh standalone

  • this should take a few minutes to compile
  • read the next README.txt in /usr/local/Plone/zinstance/

— Start the Plone instance —

sudo /usr/local/Plone/zinstance/bin/plonectl start

— check that the Plone site is working —

Browse to: www.test-site.net:8080

  • you can log in using your password in /usr/local/Plone/zinstance/adminPassword.txt

Create a Virtual Server in Virtualmin

  • using Virtualmin as described here.
  • you can use the defaults or choose what you need. For Plone only a Website is needed.

Edit configuration files
The proxy.conf, was the one which stopped my site from appearing and took a while to figure out. I do not know, if this was, because of the Debian 5 default configuration or, if Virtualmin had modified it. It was different from my proxy.conf on Debian 4 and led to permission errors. So you have to insert the lines as marked:

You can edit this file from within Virtualmin:

Webmin -> Apache Webserver -> Global configuration -> Edit Config Files ->

=== Edit /etc/apache2/mods-available/proxy.conf ===

#turning ProxyRequests on and allowing proxying from all may allow
#spammers to use your proxy to send email.

    ProxyRequests Off
	
    <Proxy *>
            AddDefaultCharset off
            Order deny,allow
            Deny from all
            #Allow from .example.com
    </Proxy>
	
    # Enable/disable the handling of HTTP/1.1 "Via:" headers.
    # ("Full" adds the server version; "Block" removes all outgoing Via: headers)
    # Set to one of: Off | On | Full | Block

–> insert start <--
# This part is needed by Plone, otherwise Apache will deny access
# allow to connect to localhost with port ending with 80 and 90 (www, webdav)
# the having at least 2 digets before the 80 or 90
<ProxyMatch http://localhost:[0-9]{2,}?[8|9]0/.*>
Order deny,allow
Allow from all

–> insert end <–

    ProxyVia On


Add a Rewrite Rule
In the site configuration file we need to add a rewrite rule which will instruct Apache to forward all our requests for http://www.test-site.net to the Plone server at http://www.test-site.net/Plone:8080 (replace test-site.net with your domain name.)

To edit the file, select your Virtual Server and go to Services -> Configure Website -> Edit Directives:

=== in /etc/apache2/sites-available/test-site.net.conf add after the last rewrite rule ===
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.test-site.net
RewriteRule ^(.) https://test-site.net:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.test-site.net
RewriteRule ^(.
) https://test-site.net:10000/ [R]

–> insert start <–
# use RewriteLog to debug problems with your rewrite rules
# disable it after you found the error our your harddisk will be filled very fast
#RewriteLog “/var/log/apache2/rewrite.log”
#RewriteLogLevel 2

# rewrite all other access to the zope server
    # using a proxy [P] and add the VMH magic keywords **
RewriteRule ^/(.*) \
    http://localhost:8080/VirtualHostBase/http/%{SERVER_NAME}:80/Plone/VirtualHostRoot/$1 [P]

ProxyVia On

# prevent the webserver from beeing used as proxy
<LocationMatch "^[^/]">
Deny from all
</LocationMatch>

–> insert end <--
…** You can easily generate other rewrite rules at “RewriteRule Generator”, for example to have the site in a sub-directory below of site root.

Activate and test configuration

=== restart Apache ===

Check, that Virtualmin can parse the new file without errors:
Virtualmin -> Services -> Configure Website -> Show Directives

If all looks well:

  • restart Apache (in Virtual Server Options -> Apply changes)

=== Add a start-up script to /etc/init.d/ ===

  • you can copy the script from here.
    and add it to /etc/init.d

— check that the Plone site is working behind Apache —

Browse to: www.test-site.net

If something does not work, uncomment the RewriteLog lines above. You can also start Plone in the foreground and see any startup errors by starting it like this:

/usr/local/Plone/zinstance/bin/plonectl fg

For me, all is running well and I can see no interference from Virtualmin’s way of processing the Apache files. Using other non-Plone sites alongside Plone is easy to accomplish, too. Additionally I’ve set-up https forwarding to Plone in a similar way, which is described in the links below.

Blessings,
Christian

Links and References:

Edit: added some more details to the Prerequisites section.
Edit: After the transfer to the new site’s forum a lot of the formatting and code was mangled. The forum software still tries to rewrite some content within code tags (http://) which I cannot fix from here. Hopefully no other errors were introduced in fixing this up.

Awesome writeup, Christian!

It’s been a while, but one of the first big deployments of Virtualmin was managing a Plone/Zope multi-site installation for a major Python project. So, it shouldn’t be too surprising that Plone drops in pretty easily. :wink:

Work perfect, thanks!