Sunday, April 10, 2011


So we now have a pretty decent little web application platform. We can run ASP.Net / C# web applications from this server using the PostgreSQL as our database backend. There are a couple of really good content management platforms that will run well on this server now...Chayahogo and MojoPortal. I have run Chayahogo and it works well. I hae never setup MojoPortal, but it seems to be the most robust solution for these technologies.

Anyway, we want to get to some GIS so lets move on to installing and running Geoserver. Perhaps I will come back to MojoPortal down the road. So, first we need to download and unpack Geoserver. You can download it from geoserver. I am going to install version 2.0.3, which is the latest stable build available. Also, I am going to install the binary (OS independent) install. I don't have a java servlet engine like Tomcat installed and want to keep this easy anyway.

One last thing...this is not a secure way to install Geoserver. I am just wanting to install it in as few steps possible to illustrate how to do it. We will discuss security later. Actually, you can take a look at this article if you want to get the details on security right away...production install.

So, let's download, unzip, and FTP the unzipped folder to some place on your server's file system. 

Install the Sun Java JRE (sun-java6-jre) (Used to need JDK and native JAI and JAI Image I/O extensions) Use the Sun Java JRE not the OpenJRE because it is much faster.

You have to add a source first to the end of the file /etc/apt/sources.list...

deb lucid partner

This makes it such that we can install from apt-get without downloading it manually from Oracle, etc. Then run the following lines from the terminal in order to install the Java JRE...
$ sudo apt-get update
$ sudo apt-get install sun-java6-jre #(may not need sun-java6-fonts)
$ sudo update-alternatives --config java
Test it out to make sure you have successfully installed the JRE...
$ java -version
Now navigate to the folder that you installed Geoserver to and go into the bin directory. You will see a number of script files for both windows and linux. The file is the one you want to use to start geoserver, but there are a few problems. The file was modified on a windows machine so it has an issue with carriage returns and line feeds. We need to fix this, so install a little program called flip to resolve this issue and run it like so...
$ sudo apt-get install flip
$ sudo flip -u
$ sudo flip -u
If you try to run it now, it will say that the JAVA_HOME variable is not set. That is true we never set it, so we need to do that. I tend to set these variable in the and files themselves so the application is completely self contained so let's do that. Open both files and add the following lines to the top of the file just after all the bash script comments...
If you added these lines to the file on a windows machine, make sure to flip them again like we did above. In fact I suspect that this version was touched by a windows text editor so you need to flip it. But, now it should run using the following command. Notice that I put an ampersand after the command in order to tell the shell to run the process in the background. This way you can continue to use the terminal for other work...
$ sudo sh &
and shut it down with...Ctrl-C

Again, this is not a secure installation at all. Everyone in the world knows your admin password until you change it. So, login to the geoserver administration page at http://localhost:8080/geoserver and change the admin password. The default for Geoserver is admin/geoserver for username/password, so change it first thing. Also, we did not set permissions at all on the file system. You may need to set some permissions if you get an error trying to run it, and then change ownership and permissions to secure it. At the very least set the permissions on the "gwc" and "logs" folders in the data_dir directory such that Geoserver has read and write to them. The performance will be terrible if you do not because the tile server will not cache any files and the logging will not work.

There are a number of ways to run geoserver and this was just the easiest way for me to get it setup. You can run geoserver as a Daemon so it is available on system startup or you can run the war file version from within a Java Servlet container. Either way it should behave exactly the same.


  1. Good stuff, Arwen.

    Note that OpenGeo now hosts GeoServer as standard RPM and DEB packages to make it even easier to install via standard means on Linux.

    Here are some details:

    Installing GeoServer on CentOS

    Installing GeoServer on Ubuntu

  2. Thanks for the post and the links. I actually noticed the OpenGeo downloads about the same time I was writing this blog entry. I added a couple of links to your site in previous posts as well. Keep up the good guys are great and are building fantastic software!!!


Note: Only a member of this blog may post a comment.