Installing GeoServer on Mac OS X

Today I started to install GeoServer, in preparation for some demos next week. I do almost all of my work on a Macbook, so this is a great opportunity to enjoy the strengths of a cross-platform Java app like Geoserver. I have limited Java experience and certainly have never used Tomcat for anything except GeoServer and GeoNetwork in the past. JBoss - what's that?

Resources

  1. GeoServer web site
  2. GeoServer MacOSX Install Guide (Doc URL recently gone missing)
  3. Latest GeoServer war file from download page

Installing Tomcat

For many of my service focused applications I try to use DarwinPorts, so I tried this for Tomcat as well. It's nice to run the install command and walk away until it is done building.

  1. To get Tomcat up and running I ran:
  sudo port install tomcat5

Unfortunately one of the dependencies wasn't being found very easily and the install failed after a few minutes or trying and re-trying to install the apache-ant package:

  --->  Fetching apache-ant
  --->  Attempting to fetch apache-ant-1.6.5-bin.tar.bz2 from http://www.apache.org/dist/ant/binaries
  --->  Attempting to fetch apache-ant-1.6.5-bin.tar.bz2 from ftp://ftp.planetmirror.com/pub/apache/dist/ant/binaries
  ...
  Error: Target com.apple.fetch returned: fetch failed

Turns out that that my port environment is so old that it was looking for an outdated version of apache-ant. This was fixed by running the sync command:

  sudo port sync

.. and then re-running the above install command:and then re-running the above install command. This got the process started again and it ran for about an hour and downloaded/built and installed several packages (about a dozen).

To start tomcat I ran:

 sudo /opt/local/share/java/tomcat5/bin/tomcatctl start

and it output its status as:


 conf_setup.sh: file conf/catalina.policy is missing; copying conf/catalina.policy.sample to its place.
 conf_setup.sh: file conf/catalina.properties is missing; copying conf/catalina.properties.sample to its place.
 conf_setup.sh: file conf/server.xml is missing; copying conf/server.xml.sample to its place.
 conf_setup.sh: file conf/tomcat-users.xml is missing; copying conf/tomcat-users.xml.sample to its place.
 conf_setup.sh: file conf/web.xml is missing; copying conf/web.xml.sample to its place.
 conf_setup.sh: file conf/setenv.local is missing; copying conf/setenv.local.sample to its place.
 Starting Tomcat.... started. (pid 25009)

Install GeoServer war file

For tomcat to find the GeoServer install file you must place it in the Tomcat webapps folder:

  sudo cp geoserver.war /opt/local/share/java/tomcat5/webapps/

then restart the Tomcat server:

 sudo /opt/local/share/java/tomcat5/bin/tomcatctl restart
 Starting Tomcat.... started. (pid 20900)

Conveniently the port installer tells you how to set this up to launch tomcat on startup:

 sudo launchctl load -w /Library/LaunchDaemons/org.macports.tomcat5.plist

Launch GeoServer

I was then able to access GeoServer in the web browser by going to:

 http://localhost:8080/geoserver

Note that localhost is the default Mac instance of Apache. And localhost:8080 is the Tomcat web server and the above url is GeoServer running in Tomcat.