GeoServer
Description
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]
sudo apt update
sudo apt upgrade
- First add the repository to the latest community edition of Docker
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
- Add the official repository
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- Install the dependencies
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y
- Do an update again
sudo apt update
- Install the docker
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
- 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]
sudo docker pull docker.osgeo.org/geoserver:2.23.4
docker run --mount type=bind,src=/MY/DATADIRECTORY,target=/opt/geoserver_data -it -p8081:8081 docker.osgeo.org/geoserver:2.23.4
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
sudo apt update
sudo apt upgrade
- Verify if you got java already installed:
java --version
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]wget https://sourceforge.net/projects/geoserver/files/GeoServer/2.25.0/geoserver-2.25.0-bin.zip
Latest as of Mar 19 2025, or go for the older "stable" one athttps://geoserver.org/release/stable/
sudo mkdir /usr/share/geoserver
sudo apt install unzip
sudo unzip -d /usr/share/geoserver/ geoserver-2.25.0-bin.zip
sudo groupadd geoserver
Have a group to access the directory feel free to use a different namesudo useradd -m -U -s /bin/false user1
- Replace "user1" with any other name of your choosing for the user(s) to access the shared foldersudo usermod -aG geoserver user1
sudo usermod -aG geoserver user2
sudo chgrp -R geoserver /usr/share/geoserver
chmod -R g+rwX /usr/share/geoserver
sudo chown -R user1:geoserver /usr/share/geoserver
sudo vi /usr/lib/systemd/system/geoserver.service
and enter the following into the document
[Unit]
Description=GeoServer Service
After=network.target
[Service]
Type=simple
User=geoserver
Group=geoserver
Environment="GEOSERVER_HOME=/usr/share/geoserver"
ExecStart=/usr/share/geoserver/bin/startup.sh
ExecStop=/usr/share/geoserver/bin/shutdown.sh
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable --now geoserver
systemctl status geoserver
- this will output if your service is loaded and active- you can now go to the website: http://yourip:8080/geoserver/ and it'll show you the main login
- 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
Data Directory[6][7]
It is advisable to change the default data directory outside of the root directory of the Geoserver. It eases updating the Geoserver to newer releases.
- Please edit the service file
/usr/lib/systemd/system/geoserver.service
and add the environment variableEnvironment="GEOSERVER_DATA_DIR=/usr/share/geoserver_data"
under the[Service]
- Alternative, only if you can't set the environment variable through the service or don't want to run it as a service:
vi .bash_profile
orvi .bashrc
and add the lineexport GEOSERVER_DATA_DIR=/usr/share/geoserver_data
- Last resort, if you find yourself having problems to edit the environment variable you may edit the file
vi /usr/share/geoserver/webapps/geoserver/WEB-INF/web.xml
and change the following
<!--
<context-param>
<param-name>GEOSERVER_DATA_DIR</param-name>
<param-value>C:\eclipse\workspace\geoserver_trunk\cite\confCiteWFSPostGIS</param-value>
</context-param>
-->
into
<context-param>
<param-name>GEOSERVER_DATA_DIR</param-name>
<param-value>/anywhere_outside_root_dir</param-value>
</context-param>
Plugins / Extensions[8]
Installing plugins is very simple and straight-forward, but for the sake of completeness I'll add an example of the authentication module. Ensure versions match!
- Go to https://build.geoserver.org/geoserver/ and browse to the version of your Geoserver
- Under "ext-latest" you'll find the updated plugin versions for your Geoserver version
- Use the wget command to download the zip
wget https://build.geoserver.org/geoserver/2.25.x/ext-latest/https://build.geoserver.org/geoserver/2.25.x/ext-latest/geoserver-2.25-SNAPSHOT-authkey-plugin.zip
- Unzip wherever you wish
unzip -d authkey -o geoserver-2.25-SNAPSHOT-authkey-plugin.zip
the -o ensures you overwrite any older unzip files in case you're upgrading - Now look inside the unzip directory for *.jar files and copy all of them to the plugin directory
cp authkey/gs-authkey-2.25-SNAPSHOT.jar /usr/share/geoserver/webapps/geoserver/WEB-INF/lib/gs-authkey-2.25-SNAPSHOT.jar
and do this for all .jar files - restart the Geoserver and your plugins are up and running
- take note, plugins have documentation, our example plugin https://docs.geoserver.org/stable/en/user/extensions/authkey/index.html
Updating and upgrading your installation[9][10] [11]
If you have your data directory outside of the root geoserver folder this is pretty straight forward.
You should update twice a year to keep up with vulnerabilities[12]
- Make a backup folder of your existing data directory
cp -r /usr/share/data_dir /usr/share/data_dir_bck
- Go to the Geoserver Status page and there to the Modules tab and take note of the plugins/extensions you have installed
- Stop the service
systemctl stop geoserver
- Delete the existing geoserver root folder
rm -r /usr/share/geoserver
- Proceed now with the wget and unzip for the newer version to the same geoserver directory
- Download maintenance to update existing release http://geoserver.org/release/maintain
- Download stable to upgrade to a new release http://geoserver.org/release/stable
- Do the same wget and unzip and copy to the proper directory for plugins/extensions
- Now you can start the Geoserver
systemctl start geoserver
- After restarting the newest version should automatically update the data directory to be compatible with the newest version and everything should be up and running
note if something goes wrong, this can happen if you have skipped many updates/upgrades and do many at once, use the backup directory and go back to your original version and try to update incrementally
Troubleshooting
- If you on Ubuntu Server run into 403 or 115 errors, these are server errors! Quite often from local servers which are IP-restrictive.[13]
- Open your sources.list with an editor
sudo nano /etc/apt/sources.list
- at this point find all references to local servers i.e. http://ph.archive.ubuntu.com/ubuntu and replace with http://archive.ubuntu.com/ubuntu
- Open your sources.list with an editor
- If you run into errors "The method 'ftp' is unsupported and disabled by default." run the following command[14]
echo 'Dir::Bin::Methods::ftp "ftp";' | sudo tee -a /etc/apt/apt.conf.d/99local-ftp
- 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.
- 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
- To Remove/change Java and install another version: https://askubuntu.com/questions/84483/how-to-completely-uninstall-java
- Removing old service (if needed for upgrading process)
systemctl cat [servicename] # info on the files for this servicename systemctl stop [servicename] systemctl disable [servicename] rm /etc/systemd/system/[servicename] rm /etc/systemd/system/[servicename] # and symlinks that might be related rm /usr/lib/systemd/system/[servicename] rm /usr/lib/systemd/system/[servicename] # and symlinks that might be related systemctl daemon-reload systemctl reset-failed
Configuration
Configuration of authentication module[15][16]
In the official documentation there's a lot of technical additional information you don't need to know and might be confusing for Linux-novices who just want things to be up&running without understanding the technical details. So we focus here simply on the practical steps to get your stuff up&running so you can use the data hosted on the server to be compatible with Vespucci for your mapping activities to OSM.
- On the Geoserver web interface, under "About & Status" please click on "Server Status" and then the tab "Modules" to verify that you have "Authkey Extension" available and enabled
- Under "Security" click on "Authentication" and then under "Authentication Filters" you click on "Add new"
- The basic functionality can be provided with the settings as in the following image
- Click on "Synchronize user/group service" to ensure you generated the property file used for the UUID generation of the users
- You now generated a new file "authkeys.properties" which on our example setup can be found at "/usr/share/geoserver_data_dir/security/usergroup/default"
- Open this file in a text editor of your choice and notice the format is "authkey=username"
- The {authkey} values you see here are what you use to identify to the authkey at the end of the URL-string for the WMS layers in for instance Vespucci
- After saving your settings, click on "default" under the "Filter Chains"
- At the bottom under "Available" you now see the option "authkey" has been added, move it to the top of "Selected" field
- Click on "Close" to get back to the "Authentication" page and at the bottom click on "Save"
Please note that this is just a basic example which serves us on internal network through HTTP, you can configure Authentication Module in many ways to support this method including external online methods. If you do this exposed to the internet, then ensure you have https up and running and restrict this authorization method to HTTPS only!
Examples for URL-string to access WMS layers through the authorization module
http://192.168.90.44:8083/geoserver/ows?service=WMS&version=1.3.0&request=GetCapabilities&authkey=00000000-0000-0000-0000-000000000000
http://192.168.90.44:8083/geoserver/ows?FORMAT=image/png&TRANSPARENT=TRUE&VERSION=1.3.0&SERVICE=WMS&REQUEST=GetMap&LAYERS=ort:mapanan2024&STYLES=&SRS=EPSG:3857&WIDTH={width}&HEIGHT={height}&BBOX={bbox}&authkey=00000000-0000-0000-0000-000000000000
Please note that the last entry is what you would use in "Custom layers" for Vespucci. In our case the following image shows the full settings for our setup having <10cm accurately georeferenced orthophotomosaic served for mapping purposes.

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[17]
- enter in the shell to work as root
sudo -i
- create a file for instance in the root home folder
vi updategeoserver
- Enter the code below into that file so its command can be executed by root
#!/bin/bash curl -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
- Execute the follow command to enter the cron job file for root
crontab -e
- 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
- enter in the shell to work as root
sudo -i
- create a file for instance in the root home folder
vi cleangeoserver
- Enter the code below into that file so its command can be executed by root
#!/bin/bash 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[18] |
cat /etc/group
|
Lists all groups[19] |
cat /etc/passwd
|
Lists all users[20] |
userdel -r usernamed
|
Deletes a user from Linux '-r' deletes $HOME folder[21] |
ls -ld directory
|
Get permissions of directory[22] |
sudo -i
|
Elevate to root[23] |
docker container ls -a
|
Show all containers[24] |
docker container rm ID
|
Remove container with ID[24] |
systemctl list-unit-files | grep enabled
|
find all enabled services using systemctl |
systemctl restart geoserver.service
|
restart the service |
Important linux locations
/var/snap/nextcloud/common/nextcloud/data |
Data directory of NextCloud using Snap installation[25] |
/usr/share/geoserver/webapps/geoserver/WEB-INF/classes/org/geoserver/web/img/logo.png |
This is the location to overwrite the Geoserver icon in the upper left corner with your own [26] |
/usr/share/geoserver/start.ini |
File that holds startup data like port number |
/usr/share/geoserver/webapps/geoserver/WEB-INF/lib |
Plugins directory |
Tile optimizations and practical experience

Hosting the high resolution orthographic images comes with a caveat, namely the sheer amount of data results in huge file sizes. In JOSM, QGIS and similar software for both the mapper and for the data consumer it's quite slow in the loading the data and the delays the mapper gets on his end using JOSM are frustrating to staff and students using the hosted imagery for mapping activities as well as data consumer activities using OpenStreetMap in conjunction with orthographic imagery in QGIS.
We found by trial and error that smaller individual tiles hosted instead of large single files speeds up this process especially when zooming-in and -out in JOSM on higher zoom levels.
Therefore we use predefined squared cut-lines to split the large single survey orthographic images into smaller parts.
GDAL, splitting orthographic images
placeholder
References
- ↑ https://github.com/geoserver/geoserver
- ↑ https://www.zdnet.com/article/docker-101-how-to-install-docker-on-ubuntu-server-22-04/
- ↑ https://docs.geoserver.org/maintain/en/user/installation/docker.html
- ↑ https://cloudinfrastructureservices.co.uk/how-to-install-geoserver-server-on-ubuntu-20-04-tutorial-step-by-step/
- ↑ https://docs.geoserver.org/maintain/en/user/production/java.html#production-java
- ↑ https://docs.geoserver.org/2.25.x/en/user/datadirectory/setting.html#datadir-setting
- ↑ http://gs.cens.am:8081/opengeo-docs/geoserver/datadirectory/data-dir-setting.html
- ↑ https://dev.to/ronitjadhav/how-to-install-geoserver-extensions-the-right-way-4e78
- ↑ https://docs.geoserver.org/stable/en/user/community/opensearch-eo/upgrading.html
- ↑ https://docs.geoserver.org/stable/en/user/installation/upgrade.html
- ↑ https://gis.stackexchange.com/questions/82796/upgrading-geoserver-version-running-with-jetty
- ↑ https://geoserver.org/vulnerability/2024/09/12/cve-2024-36401.html
- ↑ https://askubuntu.com/questions/104695/how-do-i-change-mirrors-in-ubuntu-server-from-regional-to-main
- ↑ https://askubuntu.com/questions/1187236/how-to-re-enable-ftp-on-secondary-ubuntu-debian-server-to-pull-updates-from-main
- ↑ https://docs.geoserver.org/stable/en/user/extensions/authkey/index.html
- ↑ https://docs.geoserver.org/stable/en/user/security/auth/chain.html
- ↑ https://docs.geoserver.org/latest/en/user/rest/imagemosaic.html#updating-an-image-mosaic-contents
- ↑ https://linuxhandbook.com/list-users-in-group-linux/
- ↑ https://www.howtouselinux.com/post/list-all-groups-linux
- ↑ https://phoenixnap.com/kb/how-to-list-users-linux
- ↑ https://linuxize.com/post/how-to-delete-users-in-linux-using-the-userdel-command/
- ↑ https://stackoverflow.com/questions/338037/how-to-check-permissions-of-a-specific-directory
- ↑ https://askubuntu.com/questions/230476/how-to-solve-permission-denied-when-using-sudo-with-redirection-in-bash#230482
- ↑ 24.0 24.1 https://linuxize.com/post/how-to-remove-docker-images-containers-volumes-and-networks/
- ↑ https://help.nextcloud.com/t/where-and-how-are-the-acutal-files-stored/30565
- ↑ https://geoserver-users.narkive.com/KMR2K56I/how-to-change-favicon-of-geoserver