Silva Silva · Silva 3.0.1 Installation under Mac OS X Mountain Lion (10.8.2)

Silva 3.0.1 Installation under Mac OS X Mountain Lion (10.8.2)

Initial version:   13.12.2012, Marc Petitmermet (MP)
Last modification: 13.03.2013, update for silva-3.0.1, removed empty chapters using paster (MP)

Please report errors to petitmermet (at) mine dot ch

Please note: If you are working with an account that is not allowed to administer the computer, as you should, you first need to change to a user in the Terminal with the appropriate permissions, e.g.:

  $ su - administrator

The steps below assume that you have administrator privileges in the Terminal.



                                         

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 and don't forget the Command Line Tools from within Xcode (screenshot). If it is already installed we might do an update:

  $ export PATH=/opt/local/bin:$PATH
  $ sudo port -v selfupdate
  $ sudo port upgrade outdated

1. Installing Python and other Prerequisites

Silva 3.0.1 needs Python 2.7 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 and set version 2.7 as the default python:

  $ sudo port -v install python27
  $ sudo port select --set python python27

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
  $ sudo port -v install file 

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-3.0
  $ export PROJECTDIR=$PROJECTSROOT/$PROJECTNAME
  $ export MACPORTSDIR=/opt/local

2. Installing Paster and ZopeSkel

Install distribute (py-setuptools has been replaced by py-distribute):

  $ sudo port -v install py-distribute

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

  $ sudo $MACPORTSDIR/bin/easy_install-2.7 -s $MACPORTSDIR/bin -U ZopeSkel

3. Creating a Silva Buildout Tree

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

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

4. Running the Installation

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

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

Finish the buildout of Silva:



                                         

  $ cd $PROJECTDIR
  $ sudo ./bin/buildout

Please ignore the warnings, the "Link to http://foobar ***BLOCKED*** by --allow-hosts" and "SyntaxError: 'return' outside function".

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 here.

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/trunk/buildout/requirements.html#installation-under-mac-os-x
  2. https://svn.infrae.com/buildout/silva/tag/Silva-3.0/README.txt
  3. http://www.macports.org/


Please report errors to petitmermet (at) mine dot ch