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
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.
- To get Tomcat up and running I ran:
sudo port install tomcat5Unfortunately 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 startand 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 start 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.
Chris Holmes:
Nice post Tyler. One thing to note is that you don't actually need Tomcat to run GeoServer. You can download the binary version, with ships with an embedded web server. See Mac OS/X install for how to do it on a Mac.
We also recently got a nice contribution to easily package GeoServer as a 'droplet'. See this post, snd let us know if you have success with it, we want to include it in our build, visit the issue in our tracker to give feedback and vote on the issue.
Post new comment