Silva Silva · Silva 2.3.1 Installation under Mac OS X Snow Leopard (10.6.7)

Silva 2.3.1 Installation under Mac OS X Snow Leopard (10.6.7)

Initial version:   26.01.2011, Marc Petitmermet (MP)
                               with some tips from Wim Boucquaert (Infrae)
Last modification: 30.01.2011, forgot the effective SVN checkout in chapter 3.2 (MP)
                   31.01.2011, Sylvain Viollon, Antonin Amand
                               - silva needs to be started and stopped in WSGI mode
                               - added chapter 5
                               - minor corrections
                               - TODO: how to create system user/group "zope" 
                   08.04.2011, MP
                               - update for Mac OS X 10.6.7, Xcode 4.0, Silva 2.3.1
                               - chapter 5: added instructions about how to create zope user and group
                               - chapter 5: fixed some wrong variables
                               - Sources: removed obsolete references
                               - added chapter 7

This is an updated version of "Installation under Mac OS X" on [1] for Snow Leopard (10.6.7).

Please report errors to petitmermet (at) mat dot ethz dot ch

0. Installing MacPorts

MacPorts [2] allows easy installation of command-line, X11 or Aqua based open-source software on the Mac OS X operating system. Therefore, we install MacPorts (it requires XCode to be installed). If it is already installed we might do an update:

  $ sudo port -v selfupdate

1. Installing Python and other Prerequisites

Silva 2.3.x needs Python 2.6 to work, this is probably already present on your system. Nonetheless, we compile it ourselves and install it in a separate path. Therefore, we need libraries for ssl, jpg, png and xml support. We start the installation of python:

  $ export PATH=/opt/local/bin:$PATH
  $ sudo port -v install python26

Per default, this installs a Framework version of python in /opt/local/Library/Frameworks/Python.framework. Personally, I prefer the Linux way but let's leave it at the defaults.

Let's continue with the installation of additional libraries:

  $ sudo port -v install jpeg
  $ sudo port -v install libpng
  $ sudo port -v install libxml2
  $ sudo port -v install libxslt

The original documentation suggest to update the ~/.bashrc [1]; I don't do this because then I have problems with X11 to run properly. For convenience we define some variables (this is for a Laptop setup for development; on a server, you might want to put the files somewhere else):

  $ sudo mkdir -p /Applications/Silva/sources
  $ export SOURCES=/Applications/Silva/sources
  $ export PROJECTSROOT=/Applications/Silva
  $ export PROJECTNAME=silva-2.3.1
  $ export PROJECTDIR=$PROJECTSROOT/$PROJECTNAME
  $ export MACPORTSDIR=/opt/local

2. Installing Paster and ZopeSkel

Install setuptools:

  $ sudo port -v install py26-setuptools

Now that we have the setuptools installed, we can use easy_install to install ZopeSkel:

  $ sudo $MACPORTSDIR/bin/easy_install-2.6 -s /opt/local/bin -U ZopeSkel

3. Creating a Silva Buildout Tree

3.1. Using Paster

work in progress...

3.2. Using SVN

For production deployment or development the use of a SVN checkout of Silva is recommended. In case of Silva 2.3.1:

  $ cd $PROJECTSROOT
  $ sudo svn co https://svn.infrae.com/buildout/silva/tag/Silva-2.3.1 silva-2.3.1

4. Running the Installation

4.1. When using Paster (chapter 3.1 above)

work in progress...

4.2. When using SVN (chapter 3.2. above)

Now that we have a Silva project environment, we can run bootstrap:

  $ cd $PROJECTDIR
  $ sudo $MACPORTSDIR/bin/python2.6 bootstrap.py --buildout-profile profiles/simple-instance.cfg 

Finish the buildout of silva:



                                         

  $ cd $PROJECTDIR
  $ sudo ./bin/buildout

Please ignore the hundreds of "SyntaxError: 'return' outside function" and 

5. Running Silva

The simple-instance.cfg profile sets the "effective-user" to "zope". Therefore, you might need to create a new user/group "zope" and need to change the ownership of $PROJECTDIR/var directory before starting and using the new Silva instance:Correct the user and group permissions of $PROJECTDIR/var and start the instance:

Check if the user "zope" and group "zope" already exists:

  $ sudo /usr/bin/dscl . -search /Users name zope
  $ sudo /usr/bin/dscl . -search /Groups name zope

If they don't existe, create them. We use uid=503 and gid=503.

Create group:

  $ sudo /usr/sbin/dseditgroup -o create -r "zope" -i 503 "zope"
  $ sudo /usr/bin/dscl . -append "/Groups/zope" passwd "*"

Create user:

  $ sudo /usr/bin/dscl . -create "/Users/zope"
  $ sudo /usr/bin/dscl . -append "/Users/zope" UserShell /sbin/nologin
  $ sudo /usr/bin/dscl . -append "/Users/zope" PrimaryGroupID 503
  $ sudo /usr/bin/dscl . -append "/Users/zope" UniqueID 503
  $ sudo /usr/bin/dscl . -passwd "/Users/zope" "*"

Set directory permissions:

  $ sudo chown -R zope:zope $PROJECTDIR/var

Start the silva instance:

  $ sudo $PROJECTDIR/bin/paster serve deploy.ini --daemon

Stop the silva instance:

  $ sudo $PROJECTDIR/bin/paster serve --stop-daemon

6. Follow-up Documentation



                                         

7. Troubleshooting

Set initial zope admin password:

  $ sudo $PROJECTDIR/bin/zpasswd -u admin -p yoursecret $PROJECTDIR/parts/instance/inituser
If necessary restart the instance (see chapter 5).

Sources

  1. http://docs.infrae.com/silva/buildout.html
  2. http://www.macports.org/


Please report errors to petitmermet (at) mat dot ethz dot ch