Installing geoserver on ubuntu 10.04

geoserver logo

Following the below steps should get the binary release of geoserver running on your 10.04 ubuntu install. This should also work generically for other versions of ubuntu. This process does not step you through securing or completely preparing the geoserver for production use, these details are outside the scope of this tutorial; please review the appropriate sections on security and running in a production environment via the geoserver documentation. Also if you are intending to run this geoserver in a production environment you should review any firewall and/or system settings that may be appropriate for your use case.

Install necessary supporting libraries and applications.

I think this is complete, but it may not be. If you run into any missing packages please indicate which packages also need to be installed in the comments so that others may benefit from your effort.

sudo apt-get update
sudo apt-get install gdal-bin openjdk-6-jdk openjdk-6-jre python-gdal unzip

Download the latest stable or latest release of geoserver.

In my case I grabbed Geoserver 2.1-RC4. These instructions should apply generically to the 2.0.3 release and hopefully others.

cd ~

Extract the release into your directory of choice.

In my case I chose '/opt' if you choose a different directory and release please substitute accordingly.

cd /opt
sudo unzip ~/ 

Setup system for running geoserver.

Create a symlink

We want '/opt/geoserver' to point to '/opt/geoserver-RELEASE' so that we can easily upgrade geoserver at a later date.

sudo ln -s /opt/geoserver-2.1-RC4 /opt/geoserver

Download geoserver extensions.

Follow the extension download link for whichever version you downloaded in the previous step here. Grab any extensions you want to install. I grabbed the following;

  1. MySQL Data Store
  2. GDAL Coverage Store
  3. OGR output format

After downloading the extensions extract them to '/opt/geoserver/webapps/geoserver/WEB-INF/lib'.

cd ~
mkdir geoserver_extensions
cd geoserver_extensions
find . -name \*.zip -exec unzip -o {} \;
sudo cp -rp *.jar /opt/geoserver/webapps/geoserver/WEB-INF/lib/

Add a geoserver user and group

Next we create a group and user that geoserver will run as:

sudo addgroup --system geoserver
sudo adduser --system --ingroup geoserver --no-create-home --disabled-password geoserver

Setup startup script

In order to start geoserver automatically at startup we need an init script. I grabbed the Debian/Ubuntu script located here.

cd /opt/geoserver/bin
sudo wget -O
sudo ln -s /opt/geoserver/bin/ /etc/init.d/geoserver
sudo chmod +x ./

This script needs one slight modification to be better suited to ubuntu. Change the following line

# Default-Stop:      S 0 1 6


# Default-Stop:      0 1 6

This should be line 7 of the file.

Change ownership of the geoserver directory

The geoserver install directory should be owned by the geoserver user and group we just created.

sudo chown -R geoserver:geoserver /opt/geoserver-2.1-RC4/

Set the default startup parameters

Use your editor of choice and create a new file '/etc/default/geoserver'. The commented lines, starting with '#', indicate the default as provided in the startup script.




#DESC="GeoServer daemon"



#JAVA_OPTS="-Xms128m -Xmx512m"
JAVA_OPTS="-Xms128m -Xmx512m -server"



Set the geoserver to launch on startup

sudo update-rc.d geoserver defaults

Setup log directories

sudo mkdir /opt/geoserver/webapps/geoserver/data/logs
sudo chown geoserver:geoserver /opt/geoserver/webapps/geoserver/data/logs/

Configure OGR based WFS output format

This allows geoserver to export a bunch of formats that geoserver does not handle natively. The conversion is done through the ogr library see OGR Simple Feature Library for more information on the capabilities of the gdal/ogr library. The following XML lets geoserver know where to find the ogr2ogr binary and the GDAL_DATA directory. Add the following XML to '/opt/geoserver/data_dir/ogr2ogr.xml'

      <ogrFormat>MapInfo File</ogrFormat>
      <ogrFormat>MapInfo File</ogrFormat>

Start the geoserver

sudo /etc/init.d/geoserver start

Test the geoserver

Now if everything has gone according to plan the geoserver should be running and accessible on port 8080. The default username and password are admin and geoserver respectively. You should review the security documentation for geoserver to properly secure the login and points of access.


Note that it can take geoserver quite a bit of time to actually bind to port 8080 and start responding. If you attempt to access geoserver on port 8080 and get an error message then wait a few minutes and try again. You can check to see if the geoserver is running by doing the following


ps aux | grep java

This should show something like the following indicating that the geoserver process is running.


5487 ?        Sl     0:21 /usr/lib/jvm/java-1.6.0-openjdk/bin/java -Xms128m -Xmx512m -server -DGEOSERVER_DATA_DIR=/opt/geoserver/data_dir -Djava.awt.headless=true -jar start.jar

If you see the geoserver process is running you can check to see if it has opened port 8080 and is listening for requests with the following

sudo lsof | grep TCP | grep geoserver

You should expect to see something like the following;

java      5487 geoserver  237u     IPv6      20420      0t0        TCP *:46378 (LISTEN)
java      5487 geoserver  249u     IPv6      20435      0t0        TCP *:http-alt (LISTEN)  

If you do not see the above but the java process is running just wait a few minutes as it can sometimes take a while for the geoserver to bind to port 8080.

Subscribe to RSS - geoserver