-
Download Platform Independent Binary version of GeoServer 2.16.0 from http://geoserver.org/release/2.16.0/
-
Using the Operating System user that you want to run geoserver under, unzip the file:
unzip geoserver-2.16.0-bin.zip -d /var/geoserver
-
Create link so the path to geoserver is /var/geoserver/latest:
ln -s /var/geoserver/geoserver-2.16.0 /var/geoserver/latest
-
(Optional) Setup GeoServer as a linux service (CentOS7 or any systemctl based Linux OS)
- Create a file in /usr/lib/systemd/system called geoserver.service
- Paste the following content into that file
#Required only if running on CentOS7 due to the migration from init to SystemV process manager #You should put this file in /usr/lib/systemd/system #IMPORTANT rename this file as <service_name>.service #often the service name for geoserver is simply geoserver [Unit] Description=Start/Stop geoserver #RequiresMountsFor=/ha/datigis /ha/geoserver [Service] Type=oneshot ExecStart=/etc/init.d/geoserver start ExecStop=/etc/init.d/geoserver stop RemainAfterExit=yes [Install] WantedBy=multi-user.target
- Create a file in /etc/init.d called geoserver, and paste the following content into that file, while updating
the START, STOP, GEOSERVER_HOME, and JAVA_HOME properties in the first section for your deployment.
#!/bin/sh ### BEGIN INIT INFO # Provides: GeoServer # Required-Start: $local_fs $network $named $time $syslog # Required-Stop: $local_fs $network $named $time $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Description: Starts and stops the GeoServer, which should be located at GEOSERVER_HOME as listed below ### END INIT INFO SERVICE_NAME=GeoServer START=/space/geoserver/latest/bin/startup.sh STOP=/space/geoserver/latest/bin/shutdown.sh RUNAS=root GEOSERVER_HOME=/space/geoserver/latest JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64/jre export JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=64643 PIDFILE=/var/run/geoserver.pid LOGFILE=/var/log/geoserver.log start() { if [ -f /var/run/$PIDNAME ] && kill -0 $(cat /var/run/$PIDNAME); then echo "$SERVICE_NAME is already running" >&2 return 1 fi echo "Starting $SERVICE_NAME…" >&2 su -c "GEOSERVER_HOME=$GEOSERVER_HOME JAVA_HOME=$JAVA_HOME $START &> '$LOGFILE' & echo \$!" $RUNAS > "$PIDFILE" echo "$SERVICE_NAME is started" >&2 } stop() { if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then echo "$SERVICE_NAME is not running" >&2 if [ -f "$PIDFILE" ]; then echo "Removing $PIDFILE" rm $PIDFILE fi return 1 fi echo "Stopping $SERVICE_NAME…" >&2 su -c "$STOP &> '$LOGFILE' & echo \$!" $RUNAS && kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" echo "$SERVICE_NAME has stopped" >&2 } status() { printf "%-50s" "Checking $SERVICE_NAME..." if [ -f $PIDFILE ]; then PID=`cat $PIDFILE` if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then printf "%s\n" "Process dead but pidfile exists" exit 1 else echo "$SERVICE_NAME is running" fi else printf "%s\n" "$SERVICE_NAME is not running" exit 3 fi } case "$1" in status) status ;; start) start ;; stop) stop ;; restart) stop start ;; *) echo "Usage: $0 {start|restart|status|stop}" esac exit 0
- Enable the service with the command:
systemctl enable geoserver.service
- Start the service with the command:
systemctl start geoserver.service
Geoserver Installation Notes:
- This can be using either the standalone version OR the WAR deployment, however the war must be exploded for the MarkLogic geotools plugin to be deployed.
- The plugin has NOT been tested with newer releases, and will not work with earlier versions of geoserver due to dependency changes.
- Add the MarkLogic GeoTools Driver and Dependencies to the WAR deployed in Step 1.
- Build the driver without running the test cases by running ./gradlew build -x test.
- Copy the MarkLogicGeoToolsDriver*.jar and all jars in the dependency folder to the geoserver war/WEB-INF/lib directory.
- OR, use the ./gradlew deployOffline or the ./gradlew deployGeoServerPluginJars tasks.
GeoTools Driver Notes:
- The deployGeoServerPluginJars gradle task will copy the jars to the property location if the geoServerHome property in gradle.properties is pointing to the correct location of Tomcat or the GeoServer binary distribution.
Depending on how you have setup your service use:
systemctl start geoserver.service
or
service geoserver start
##Step 4. Setup GeoServer
-
Navigate to
http://{host}:{port}/geoserver/web
-
Login as an administrator (default is admin/geoserver)
-
Create your workspace(s) where you are going to use the MarkLogic DataStore
- On the welcome page, click
Create workspaces
- Provide a workspace name (eg. "MarkLogic")
- Provide a Namespace URI (eg. "http://marklogic.com/geoserver/wfs")
- If you desire this to be the default workspace, click the corresponding checkbox.
- Click the
submit
button - Click on the newly created workspace name on the
Workspaces
list - Click on the
Enabled
checkbox - Click on any checkboxes for services you want enabled on this workspace (eg.
WFS
) - Fill out Contact Information for this service.
- Click
save
button
- On the welcome page, click
-
Create a new Store
- On the left column, click the
Stores
link underData
- Click on the
Add new Store
link at the top of theStores
list - Select the
MarkLogic (Basic)
type from the Vector Data Sources - Select the workspace created in Step 3
- Provide a Data Source Name (eg. "MarkLogic Store")
- Provide a Description of the Data Store
- Provide the Connection Parameters:
- Hostname is the host running MarkLogic Server
- Port is the geo-data-services-admin server on your MarkLogic Cluster
- Username is an administrative user on the MarkLogic Cluster
- Password is the adminsitrative user's password on the MarkLogic Cluster
- Database is the corresponding database (eg.
my-content
) - User-Auth-Type should the authentication mechanism used by the MarkLogic app server that has
marklogic-geo-data-services installed; this will default to
digest
. UsePreAuthenticatedHeader
instead if you are using MarkLogic application-layer authentication. - User-Hostname is the host running the MarkLogic Server for user queries (may be the same as hostname above)
- User-Port is the port for the application server running the marklogic-geo-data-services app server in MarkLogic.
- Click
save
button- This should show you a list of available Service Descriptors for publishing.
- On the left column, click the
-
Setup GeoServer Security (Optional).
This section is necessary if you are using the
PreAuthenticatedHeader
authentication mechanism.- Create a new Role called "USERS"
- On the left column, click the
Users, Groups, Roles
link. - Click on the
Roles
tab - Click
Add new role
link - Provide the name
USERS
- Click the
save
button
Note: This role will be passed in on all calls to the WFS APIs.
- On the left column, click the
- Create a new Authentication Filter
- On the left column, click the
Authentication
link. - In the
Authentication Filters
section, click theAdd new
link - Click the
HTTP Header
link - Provide a name for your proxy (eg.
proxy
) - Provide the Request Header Attribute (eg.
authentication
) - Select the
Request Header
Role Source - Provide the name of the header that will be passed in (eg.
gs-role
) - Click
save
button
- On the left column, click the
- Modify the rest, and default Filter Chains
- If not already there, on the left column, click the
Authentication
link - In the
Filter Chains
section, find therest
chain, and click on that link - In the bottom section, move the authentication filter you created earlier to the selected list, as the first entry
- In the bottom section, if
anonymous
is in the selected list, removeanonymous
from the selected list - Click the
close
button - Back In the
Filter Chains
section, find thedefault
chain, and click on that link - In the bottom section, move the authentication filter you created earlier to the selected list, as the first entry
- In the bottom section, if
anonymous
is in the selected list, removeanonymous
from the selected list - Click the
close
button - Scroll to the bottom of the window and click the
save
button
- If not already there, on the left column, click the
- Create a new Role called "USERS"