Tuesday, May 15, 2007

Setting up Plone on Ubuntu Feisty Fawn

Recently I needed to set up Plone on an Ubuntu server. I wanted to run Plone behind Apache and I needed to be able to remotely administer the server on a Windows machine.

I don't have very much experience with linux so I was expecting all sorts of command line stumbling blocks but I was amazed at how easy everything was to set up, barring a couple of hiccups.

I thought I'd post a log of what I did to get the server working (mostly for my own benefit so I've got a permanent record in case I need to do it again). It's not massively detailed so don't expect a breakdown on how to install and configure things like the secure FTP client WinSCP.

I'm absolutely certain that there are better ways of doing it, and I welcome any comments about how I could have done things differently.

Install Log

On the windows machine
  • Download and install these useful remote administration tools:
    • Putty - For remote login to linux
    • WinSCP - For secure file transfer to and from linux
On the linux machine
  • Install Ubuntu desktop edition (I used a Pentium III, 1GHz CPU with 512MB RAM)
  • Install SSH server - sudo apt-get install openssh-server
  • Install Apache - sudo apt-get install apache2
  • Install Zope (see How to setup Plone from source for some pointers on this) - sudo apt-get install zope2.9 (if you leave off the 2.9 bit it will probably find the package containing the latest version)
  • Make a Zope instance - sudo /usr/lib/zope2.9/bin/mkzopeinstance.py
    • Provide the information requested:
      • Directory: /var/zope/instance001
      • Username: user
      • Password: pass
    • If necessary edit zope.conf to specify port number, etc (it may be necessary to use a terminal to change the owner of zope.conf before you can save the changes to files that you edit)
      • sudo chown user /var/zope/instance001/etc/zope.conf
    • and then back again when you have finished
      • sudo chown zope /var/zope/instance001/etc/zope.conf
  • Run zope - sudo /var/zope/instance001/bin/runzope (or, to run it in debug mode: sudo /var/zope/instance001/bin/runzope -X "debug-mode=on")
    • or:
    • sudo /var/zope/instance001/bin/zopectl start
      • sudo /var/zope/instance001/bin/zopectl stop
  • Install PIL - sudo apt-get install python-imaging
  • Download and install Plone 2.5.2 (you may have to change ownership on the Products folder before you can transfer the Plone files to the Products directory)
Apache setup - See HTTPD - Apache2 Web Server to see how Apache is configured in Ubuntu
  • to create a new virtual host, make a copy of the default site and then - sudo a2ensite site-name
  • To enable a module - sudo a2enmod module-name
  • Enable mod_proxy and mod_rewrite
    • sudo a2enmod proxy
    • sudo a2enmod proxy_http
    • sudo a2enmod rewrite
  • Edit proxy.conf to allow proxying (I could only do this by enabling proxying from the specific client I was accessing the site from but I need to find a better way as this opens up the server to general proxying which is bad)
    • Change 'Proxyrequests Off' to 'Proxyrequests On'
    • Add 'Allow from all' in tag
  • To restart apache:
    • sudo /etc/init.d/apache2 reload
    • or:
    • sudo /etc/init.d/apache2 force-reload
For accessing the ubuntu server using a remote windows environment:
  • On the Ubuntu machine, log in locally to the desktop and open System -> Adminstration -> Login Window
    • In the 'Remote' tab, select 'Same as Local' from the 'Style' drop down list
  • On the Windows machine, Install Cygwin and the X11 components
  • Edit [CYGWIN_INSTALL_DRIVE]:\cygwin\usr\X11R6\bin\startxdmcp.bat setting the IP address of the REMOTE_HOST to the IP address of the Ubuntu server
  • Launch [CYGWIN_INSTALL_DRIVE]:\cygwin\usr\X11R6\bin\startxdmcp.bat
    • Note - By default, this will only allow you to have one session running simultaneously but this can be configured in the Login Window settings in Ubuntu
  • For further help, see:


Unknown said...

I was having some issues installing Zope. Your log was very helpful

Unknown said...

I have a similar article at this link