-
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
submitbutton - Click on the newly created workspace name on the
Workspaceslist - Click on the
Enabledcheckbox - Click on any checkboxes for services you want enabled on this workspace (eg.
WFS) - Fill out Contact Information for this service.
- Click
savebutton
- On the welcome page, click
-
Create a new Store
- On the left column, click the
Storeslink underData - Click on the
Add new Storelink at the top of theStoreslist - 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. UsePreAuthenticatedHeaderinstead 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
savebutton- 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
PreAuthenticatedHeaderauthentication mechanism.- Create a new Role called "USERS"
- On the left column, click the
Users, Groups, Roleslink. - Click on the
Rolestab - Click
Add new rolelink - Provide the name
USERS - Click the
savebutton
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
Authenticationlink. - In the
Authentication Filterssection, click theAdd newlink - Click the
HTTP Headerlink - Provide a name for your proxy (eg.
proxy) - Provide the Request Header Attribute (eg.
authentication) - Select the
Request HeaderRole Source - Provide the name of the header that will be passed in (eg.
gs-role) - Click
savebutton
- On the left column, click the
- Modify the rest, and default Filter Chains
- If not already there, on the left column, click the
Authenticationlink - In the
Filter Chainssection, find therestchain, 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
anonymousis in the selected list, removeanonymousfrom the selected list - Click the
closebutton - Back In the
Filter Chainssection, find thedefaultchain, 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
anonymousis in the selected list, removeanonymousfrom the selected list - Click the
closebutton - Scroll to the bottom of the window and click the
savebutton
- If not already there, on the left column, click the
- Create a new Role called "USERS"