Setting up Geoserver on Debian 12 with Tomcat 9: A Tech Support Guide
Geoserver is an open-source software server that allows for the sharing and editing of geospatial data. In this guide, we will walk through the process of setting up Geoserver on a Debian 12 system using Tomcat 9 as the servlet container. By the end of this article, you will have a fully functional Geoserver instance ready to serve your geospatial data.
Prerequisites
Before we begin, it is assumed that you have a fresh installation of Debian 12 and have administrative access to the system. Additionally, you should have a basic understanding of Linux command line interface and be comfortable working with the terminal.
Installing Tomcat 9
Tomcat is a popular servlet container that can be used to run Geoserver. To install Tomcat 9 on Debian 12, follow these steps:
- Update the package list:
sudo apt update
- Install the Tomcat 9 package:
sudo apt install tomcat9
- Start the Tomcat 9 service:
sudo systemctl start tomcat9
- Enable the Tomcat 9 service to start on boot:
sudo systemctl enable tomcat9
- Verify that Tomcat 9 is running by visiting http://localhost:8080 in your web browser.
Installing Geoserver
Now that Tomcat 9 is installed and running, we can move on to installing Geoserver.
-
Download the latest Geoserver WAR file from the Geoserver website.
-
Copy the WAR file to the Tomcat 9 webapps directory:
sudo cp geoserver.war /var/lib/tomcat9/webapps/
-
Wait for Tomcat 9 to automatically deploy the Geoserver application. This can take a few minutes.
-
Verify that Geoserver is running by visiting http://localhost:8080/geoserver in your web browser.
Configuring Geoserver
Now that Geoserver is installed and running, we can move on to configuring it.
-
Log in to the Geoserver web interface using the default administrator credentials (username: "admin", password: "geoserver").
-
Create a new workspace by clicking on the "Workspaces" link in the left-hand menu and then clicking the "Add new workspace" button.
-
Configure the new workspace by specifying a name, an abstract, and an authority URL.
-
Create a new store by clicking on the "Stores" link in the left-hand menu and then clicking the "Add new store" button.
-
Choose the type of store you want to create (e.g., shapefile, PostGIS, etc.) and follow the prompts to configure it.
-
Publish a new layer by clicking on the "Layers" link in the left-hand menu and then clicking the "Add new layer" button.
-
Choose the store you created in step 4 and follow the prompts to configure the new layer.
Securing Geoserver with SSL
To secure Geoserver with SSL, we will use the Nginx web server as a reverse proxy.
- Install Nginx:
sudo apt install nginx
- Create a new Nginx configuration file for Geoserver:
sudo nano /etc/nginx/sites-available/geoserver
- Add the following configuration to the file:
server {
listen 80;
server_name your_domain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name your_domain.com;
ssl_certificate /etc/letsencrypt/live/your_domain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/your_domain.com/privkey.pem;
location / {
proxy_pass http://localhost:8080/geoserver;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
- Enable the new Nginx configuration file:
sudo ln -s /etc/nginx/sites-available/geoserver /etc/nginx/sites-enabled/
- Test the Nginx configuration:
sudo nginx -t
- Restart Nginx:
sudo systemctl restart nginx
- Run Certbot to obtain an SSL certificate:
sudo certbot certonly --webroot -w /var/www/html -d your_domain.com
- Verify that Geoserver is accessible via HTTPS by visiting https://your_domain.com/geoserver in your web browser.
Conclusion
In this guide, we have walked through the process of setting up Geoserver on Debian 12 with Tomcat 9 as the servlet container. We have also covered the process of securing Geoserver with SSL using Nginx as a reverse proxy. With these steps complete, you now have a fully functional Geoserver instance ready to serve your geospatial data.
References
- Geoserver website: https://geoserver.org/
- Tomcat 9 documentation: https://tomcat.apache.org/tomcat-9.0-doc/index.html
- Nginx documentation: https://nginx.org/en/docs/
- Certbot documentation: https://certbot.eff.org/docs/index.html