How To Install GeoServer on CentOS / RHEL 8 - CentLinux

Latest

Tuesday, 19 October 2021

How To Install GeoServer on CentOS / RHEL 8

How To Install GeoServer on CentOS / RHEL 8

In this article, you will learn how to install GeoServer on CentOS / Rocky / RHEL 8 or similar Linux distros.

 

Table of Contents:

 

install-geoserver-on-centos-rocky-rhel-linux-8

 

What is GeoServer? :

GeoServer is an open-source server written in Java that allows users to share, process and edit geospatial data. Designed for interoperability, it publishes data from any major spatial data source using open standards. GeoServer has evolved to become an easy method of connecting existing information to virtual globes such as Google Earth and NASA World Wind as well as to web-based maps such as OpenLayers, Leaflet, Google Maps and Bing Maps.

GeoServer functions as the reference implementation of the Open Geospatial Consortium Web Feature Service standard, and also implements the Web Map Service, Web Coverage Service and Web Processing Service specifications.

GeoServer aims to operate as a node within a free and open Spatial Data Infrastructure. Just as the Apache HTTP Server has offered a free and open web server to publish HTML, GeoServer aims to do the same for geospatial data.

Recommended Book: GeoServer Beginner's Guide - Second Edition: Share geospatial data using Open Source standards 2nd Revised edition by Stefano Iacovella.

 

GeoServer Features:

GeoServer reads a variety of data formats, including:

  • PostGIS
  • Oracle Spatial
  • ArcSDE
  • DB2
  • MySQL
  • MongoDB
  • Apache Solr
  • Shapefiles
  • GeoTIFF
  • GTOPO30
  • ECW, MrSID
  • JPEG2000

Through standard protocols it produces KML, GML, Shapefile, GeoRSS, PDF, GeoJSON, JPEG, GIF, SVG, PNG and more. In addition, one can edit data via the WFS transactional profile (WFS-T). GeoServer includes an integrated OpenLayers client for previewing data layers.

GeoServer additionally supports efficient publishing of geospatial data to Google Earth through the use of network links, using KML. Advanced features for Google Earth output include templates for customized pop-ups, time and height visualizations, and "super-overlays".

GeoServer relies on GeoTools, a GIS library.

 

Environment Specification:

We are using a minimal RHEL 8 virtual machine with following specifications.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - Red Hat Enterprise Linux 8.4
  • Hostname – geoserver-01.centlinux.com
  • IP Address - 192.168.116.243/24

 

Update your Linux Server:

Connect with geoserver-01.centlinux.com as root user by using a ssh client.

It is the best practice to update Linux server before installing any new software.

Therefore, execute following dnf command to update your Linux server.

# dnf update -y

If the above command updates your Linux Kernel, then restart your operating system with new Kernel before moving forward.

# reboot

After reboot, login to your GeoServer machine and verify the Linux Kernel and operating system versions.

# uname -r
4.18.0-305.19.1.el8_4.x86_64

# cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.4 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.4 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8.4:GA"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.4
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.4"

 

Install Java Runtime Environment on CentOS / RHEL 8:

GeoServer software is developed in Java programming language, therefore, you have to install Java runtime environment to execute GeoServer application.

Use dnf command to install OpenJDK on your Linux operating system.

# dnf install java-1.8.0-openjdk-devel

After installation, verify the Java version.

# java -version
openjdk version "1.8.0_302"
OpenJDK Runtime Environment (build 1.8.0_302-b08)
OpenJDK 64-Bit Server VM (build 25.302-b08, mixed mode)

 

Install GeoServer Software on CentOS / RHEL 8:

To download and extract you may need wget and unzip software packages.

Therefore, install these packages before installing GeoServer on your Linux server.

# dnf install -y wget unzip

You can download GeoServer software from their Official website.

01-download-geoserver-web-page

Right Click on the "Platform Independent Binary" and "copy link address" if you are using Google Chrome. The option may vary on other web browsers.

Use the wget command to download GeoServer software directly from the Linux CLI.

# cd /tmp
# wget http://sourceforge.net/projects/geoserver/files/GeoServer/2.19.2/geoserver-2.19.2-bin.zip
...
Connecting to netix.dl.sourceforge.net (netix.dl.sourceforge.net)|87.121.121.2|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 103982460 (99M), 28517756 (27M) remaining [application/octet-stream]
Saving to: ‘geoserver-2.19.2-bin.zip’

geoserver-2.19.2-bi 100%[++++++++++++++=====>]  99.17M  97.7KB/s    in 3m 26s

2021-10-17 10:20:39 (135 KB/s) - ‘geoserver-2.19.2-bin.zip’ saved [103982460/103982460]

Create a directory for GeoServer software and use unzip command to extract downloaded zip file therein.

# mkdir /usr/share/geoserver
# unzip -d /usr/share/geoserver/ geoserver-2.19.2-bin.zip

Create a Linux user and grant him the ownership of GeoServer home directory.

# useradd -m -U -d /usr/share/geoserver -s /bin/false geoserver
# chown -R geoserver:geoserver /usr/share/geoserver

Allow GeoServer service port in Linux Firewall.

# firewall-cmd --permanent --add-port=8080/tcp
success
# firewall-cmd --reload
success

Create a Systemd unit for GeoServer service. You can use vim text editor for this purpose.

# vi /usr/lib/systemd/system/geoserver.service

Add following directives in this file.

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

Enable and Start geoserver.service.

# systemctl daemon-reload
# systemctl enable --now geoserver.service

To access GeoServer application, open URL http://geoserver-01.centlinux.com:8080/geoserver in a web browser.

02-geoserver-web-application-main-page

Login with default credentials i.e. admin/geoserver

03-geoserver-web-application-admin-dashboard

 

Conclusion:

In this article, you have learned how to install GeoServer on CentOS / Rocky / RHEL 8 or similar Linux distros.

No comments:

Post a Comment