No, really, you can (just) use Buildout to install Plone.

This is a follow up to my Getting Excited about Plone as Eggs post, because I can’t keep updating that one forever.

Generally speaking, the recommended (and supported) way to install Plone is via the installers, e.g. the Unified Installer. Obviously, if you want things to Just Work™ you should be using the latest stable release, which is why I linked to the 3.3.3 unified installer (although there is no Windows installer for 3.3.3 yet, which is why it’s not released on plone.org).

That said, since both Plone and Zope 2 have been packaged as eggs  (Plone became an egg in version 3.2 and Zope 2 became an egg as of Zope 2.12 which is the version of Zope 2 that Plone 4 will use) it has become “mostly trivial” to write a buildout.cfg to install Plone with. That means that you don’t even need paster to do it. You can just fire up an editor and type:

[buildout]

parts =
  instance

[instance]
recipe = plone.recipe.zope2instance
user = admin:admin
eggs =
  Plone

Amazing!

Of course there is the nasty bit about PIL, which I get around now-a-days by adding a very specific find-link, e.g.:

[buildout]

parts =
  instance

find-links = http://dist.plone.org/thirdparty/PILwoTk-1.1.6.4.tar.gz

[instance]
recipe = plone.recipe.zope2instance
user = admin:admin
eggs =
  PILwoTk
  Plone

What you should have at this point is a working Plone, but not necessarily a repeatable buildout. The reason being we have not pinned any egg versions yet, so we are effectively asking for whatever the latest version of Plone is on PyPI. Fun for playing, not fun for production. Fortunately the nice Plone people have created a bunch of version pins for us, so we just need to use them:

[buildout]

extends =
    http://dist.plone.org/release/4.0a3/versions.cfg

versions = versions

parts =
  instance

find-links = http://dist.plone.org/thirdparty/PILwoTk-1.1.6.4.tar.gz

[instance]
recipe = plone.recipe.zope2instance
user = admin:admin
eggs =
  PILwoTk
  Plone

If you are completely new to buildout and you are thinking to yourself right now “what in the world is this guy talking about?” then you will likely want to install buildout first so you can join in the fun. Fortunately, the nice Python people have made that easy with a package called Distribute.

Following their instructions, you can do this:

$ curl -O http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py

Then:

$ easy_install zc.buildout
$ mkdir plone
$ cd plone
$ buildout init

After which you will have a buildout.cfg file, and you can follow along with the above steps. Happy?

The best part about all of this is that (on a fast internet connection) it should only be a matter of minutes before you are able to do this:

$ bin/instance fg

and be staring at:

Of course, if you are running in the foreground (recommended for debugging) you should see something like this:

aclark@Alex-Clarks-MacBook-Pro:~/Developer/public-plone/ > bin/instance fg
/Users/aclark/Developer/public-plone/parts/instance/bin/runzope -X debug-mode=on
2010-01-07 12:07:56 INFO ZServer HTTP server started at Thu Jan  7 12:07:56 2010
 Hostname: 0.0.0.0
 Port: 8080
2010-01-07 12:08:14 INFO Zope Ready to handle requests

If you’d like to get a little less noisy and skip debug mode but still run in the foreground, you can use April 2008′s famous addition to plone.recipe.zope2instance:

aclark@Alex-Clarks-MacBook-Pro:~/Developer/public-plone/ > bin/instance console

Sweet, blissful, silent running Plone.

Happy Plone 4′ing all!

  • http://aclark.net aclark

    Don’t like to type? You can checkout the buildout like this:

    $ svn export http://svn.aclark.net/svn/public/buildout/plone/trunk/ plone

    and run it like this:

    $ cd plone
    $ python2.4 bootstrap.py
    $ bin/buildout

  • http://aclark.net aclark

    Which raises another question, where does that bootstrap.py file come from?

    Now-a-days I don’t like to worry about that mundane detail, but I do like to have that file so that my buildouts can be bootstrapped without having to easy_install buildout.

    So, I use:

    http://pypi.python.org/pypi/collective.recipe.bootstrap

    which downloads it for me when I run buildout, then I just check it in.

  • catherinew

    Hi Alex
    Given that this seems to be targeted at newbies, you may also want to discuss (or link to something that discusses) which version of python to use, and how to get hold of / call this if your system version is different.

    Worth linking this off the weblion wiki? Specifically, the related pages section of https://weblion.psu.edu/trac/weblion/wiki/BuildOut
    Catherine

  • http://aclark.net aclark

    Hi Catherine,

    I’m aiming at “average” Python users new to Plone. Generally speaking, I prefer to leave the “completely new to Plone and Python” crowd to other, more capable instructors. Although your point is well taken!

    I suppose of particular interest with regard to Plone 4 is that you MUST USE Python 2.6 (I’ve shot myself in the foot with that more than once).

    Alex

  • http://dukebody.com dukebody

    “If you’d like to get a little less noisy and skip debug mode but still run in the foreground, you can use April 2008’s famous addition to plone.recipe.zope2instance” :)

  • Pingback: 2010 : liens de la semaine 1 « Encolpe's What ?