From OpenStreetMap Wiki
Jump to navigation Jump to search


GeoServer is a FOSS server allowing users to work with and visualize geospatial data. The software can publish data from any major spatial data source using open standards. [1]

Installation and setup

GeoServer with Ubuntu 22.04 LTS (using Docker)

Please check the non-Docker installation first, it's a bit more complicated but gives you more control over your data.

Assuming you got your Ubuntu Server running, start the terminal and follow the steps

First we install Docker, if not already done so[2]

  1. sudo apt update
  2. sudo apt upgrade
  3. First add the repository to the latest community edition of Docker curl -fsSL | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  4. Add the official repository echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  5. Install the dependencies sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y
  6. Do an update again sudo apt update
  7. Install the docker sudo apt-get install docker-ce docker-ce-cli -y
  8. Add the user of your choice to the Docker group sudo usermod -aG docker $USER

Now we add the geoserver container using the own data directory[3]

  1. sudo docker pull
  2. docker run --mount type=bind,src=/MY/DATADIRECTORY,target=/opt/geoserver_data -it -p8081:8081

Change /MY/DATADIRECTORY into whatever you wish and 8081 is the port you wish to use, feel free to appoint another port.

GeoServer on VirtualBox with Ubuntu 22.04 LTS (native - no Docker!)

The following is a step by step tutorial how to set up GeoServer on Ubuntu 22.04 LTS Server

The tutorial is based on the Tutorial by Hitesh Jethva [4] with slight alterations for the versions as mentioned below (up-to-date at the moment of this writing) and focused on the MAPANAN project in the City of Baguio, Philippines to host Orthophotos by UAS in GeoTIFF format.

Software used for deployment, installation and setup

Version Download link Version used for this tutorial Release date
Ubuntu Server Ubuntu 22.04.4 LTS 16 Feb 2024
GeoServer GeoServer 2.25.0 19 Mar 2024

Specifications of hardware

Hosting imagery doesn't really take that much resources, just to get it to work. I've got it running 150GB of high-res drone imagery on just 2 cores and 4GB RAM. Though speed is an issue and to get an acceptable responsiveness you should dedicate a bit more hardware.

Installation and setup for Ubuntu

Assuming you got your Ubuntu Server running, start the terminal and follow the following guidelines

  1. sudo apt update
  2. sudo apt upgrade
  3. Verify if you got java already installed: java --version
  4. sudo apt install openjdk-11-jdk -y - There's other versions feel free to suit your needs, GeoServer is tested to work with 8, 11 and 17 (11 more stable and tested)[5]
  5. wget Latest as of Mar 19 2025, or go for the older "stable" one at
  6. sudo mkdir /usr/share/geoserver
  7. sudo apt install unzip
  8. sudo unzip -d /usr/share/geoserver/
  9. sudo groupadd geoserver Have a group to access the directory feel free to use a different name
  10. sudo useradd -m -U -s /bin/false user1 - Replace "user1" with any other name of your choosing for the user(s) to access the shared folder
  11. sudo usermod -aG geoserver user1
  12. sudo usermod -aG geoserver user2
  13. sudo chgrp -R geoserver /usr/share/geoserver
  14. chmod -R g+rwX /usr/share/geoserver
  15. sudo chown -R user1:geoserver /usr/share/geoserver
  16. sudo nano /usr/lib/systemd/system/geoserver.service
    • and enter the following into the document
      Description=GeoServer Service
  17. systemctl daemon-reload
  18. systemctl enable --now geoserver
  19. systemctl status geoserver - this will output if your service is loaded and active
  20. you can now go to the website: http://yourip:8080/geoserver/ and it'll show you the main login
  21. default username/password is admin/geoserver - on the left side you can go to Security->Users, Groups, Roles->Users/Groups->admin now you can change your administrator username and password and at this point your done setting up the GeoServer.Proceed with configuration


  1. If you on Ubuntu Server run into 403 or 115 errors, these are server errors! Quite often from local servers which are IP-restrictive.[6]
  2. If you run into errors "The method 'ftp' is unsupported and disabled by default." run the following command[7]
    • echo 'Dir::Bin::Methods::ftp "ftp";' | sudo tee -a /etc/apt/apt.conf.d/99local-ftp
  3. If you run into "couldn't open data connection" errors for some downloads during sudo apt-get install xxxx while others download just fine, do the following:
    • sudo apt-get update --fix-missing
    • sudo apt-get install xxxx
    • repeat these steps until you got them all, in some cases you may have to repeat this many times but you'll get them all eventually.
  4. Geoserver has some rights/ownership specifics. The folder with the drone images should be properly set:
    • sudo chown -R username:groupname foldername
    • sudo chmod -R 770 foldername
  5. To Remove/change Java and install another version:


GeoServer Workspaces.png
First go to Workspaces
GeoServer New Workspace.png
Create a new workspace
Geoserver Workspace Services and Settings.png
Click on the newly created workspace and set WMTS, WMS and if required enable the settings and fill out the data as you see fit
GeoServer Stores.png
Next add new stores as you see fit. I arranged them per quarter of the year so newer orthographic images automatically overwrite older
Select from the list of options the ImageMosaic under the Raster Data Sources

Maintenance of Stores for Mosaic Imagery

The web interface doesn't provide an automated update for stores. Copying a new orthographic image to the directory of a given workspace won't thus automatically update. One can manually wipe clean the corresponding files in the directory or wipe out the caching and then manually re-scan the directory. This is time consuming and prone to errors.

Setting up a cron job for this is the easiest way, it may need root permission[8]

  1. enter in the shell to work as root
    sudo -i
  2. create a file for instance in the root home folder
    vi updategeoserver
  3. Enter the code below into that file so its command can be executed by root
#!/bin/bashcurl -v -u admin:geoserver -XPOST -H "Content-type: text/plain" -d "file:///path/to/the/mosaic/folder" "http://localhost:8080/geoserver/rest/workspaces/<workspace_name>/coveragestores/<store_name>/external.imagemosaic"
  • <workspace_name> replace this with the workspace "Name" listed under "Basic Info" in the "Edit Workspace" web interface.
  • <store_name> replace this with the "Data Source Name" listed under "Basic Store Info" in the "Edit Raster Data Source" web interface for the corresponding Store.
  • example: curl -v -u admin:geoserver -XPOST -H "Content-type: text/plain" -d "file:///var/snap/nextcloud/common/nextcloud/data/HikeAndMap/files/Survey/UAV/2_OUTPUT/orthophoto/2023" "http://localhost:8080/geoserver/rest/workspaces/baguio_ortho/coveragestores/ortho_2023/external.imagemosaic"
  • Clearly keep in mind to replace the default admin:geoserver with the username:password of your choosing

The cron job itself the easiest, assuming still logged on as root

  1. Execute the follow command to enter the cron job file for root
    crontab -e
  2. The following line will update the Geoserver store for that specific directory once per hour
    */60 * * * * ./updategeoserver

At this point your Geoserver for that specific store/workspace will update automatically once an hour.

To clean a geoserver folder one can just create a script file analog to the update command and wipe out the geoserver generated files

  1. enter in the shell to work as root
    sudo -i
  2. create a file for instance in the root home folder
    vi cleangeoserver
  3. Enter the code below into that file so its command can be executed by root

rm ../folder/*.dbf
rm ../folder/*.fix
rm ../folder/*.prj
rm ../folder/*.properties
rm ../folder/*.qix
rm ../folder/*.shp
rm ../folder/*.shx
rm ../folder/sample_image.dat

* example: ../../var/snap/nextcloud/common/nextcloud/data/HikeAndMap/files/Survey/UAV/2_OUTPUT/orthophoto/2024/2024.dbf

work in progress

Linux commands

getent group group_name Users in a group[9]
cat /etc/group Lists all groups[10]
cat /etc/passwd Lists all users[11]
userdel -r usernamed Deletes a user from Linux '-r' deletes $HOME folder[12]
ls -ld directory Get permissions of directory[13]
sudo -i Elevate to root[14]
docker container ls -a Show all containers[15]
docker container rm ID Remove container with ID[15]
systemctl list-unit-files | grep enabled find all enabled services using systemctl
systemctl restart geoserver.service restart the service

Important linux locations

Data directory of NextCloud using Snap installation[16]
This is the location to overwrite the Geoserver icon in the upper left corner with your own [17]
File that holds startup data like port number