-
-
Save iacovlev-pavel/9006ba2f33cafc8d2ab71528f25f9f45 to your computer and use it in GitHub Desktop.
# | |
apt-get install openjdk-8-jre | |
# PostgreSQL and PostGIS | |
apt-get install postgresql postgresql-contrib postgis postgresql-10-postgis-2.4 | |
# Create "geoserver" database | |
sudo -u postgres createuser -P geoserver | |
sudo -u postgres createdb -O geoserver geoserver | |
sudo -u postgres psql -c "CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology;" geoserver | |
# GeoServer install | |
apt install unzip | |
mkdir -p /var/www/geoserver | |
cd /var/www/geoserver | |
wget https://netcologne.dl.sourceforge.net/project/geoserver/GeoServer/2.14.1/geoserver-2.14.1-bin.zip | |
unzip geoserver-2.14.1-bin.zip | |
mv geoserver-2.14.1/* . | |
echo "export GEOSERVER_HOME=/var/www/geoserver" >> ~/.profile | |
. ~/.profile | |
# GeoServer run | |
./bin/startup.sh | |
In the browser open http://localhost:8080/geoserver/web/ |
It seems that i can not find the file. Need help
What does the startup.sh file look like?
https://gist.github.com/iacovlev-pavel/d784dae233798df3d4d4a769977a9a83
It seems that i can not find the file. Need help
https://gist.github.com/iacovlev-pavel/d784dae233798df3d4d4a769977a9a83
How can I install it as a service, so that I don't need to run ./bin/startup.sh command each time?
How can I install it as a service, so that I don't need to run ./bin/startup.sh command each time?
Well you can create a runnable scipt in init.d as following :
cat >> /etc/init.d/geoserver
# then paste what comes at the end on the comment
# then CTRL + D
chmod +x /etc/init.d/geoserver
update-rc.d geoserver defaults
service geoserver start
And then the content of /etc/init.d/geoserver file :
#!/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 /usr/share/geoserver
### END INIT INFO
SERVICE_NAME=geoserver
GEOSERVER_HOME=/path/to/geoserver
START=$GEOSERVER_HOME/bin/startup.sh
STOP=$GEOSERVER_HOME/bin/shutdown.sh
RUNAS=root
JAVA_HOME=/usr/lib/jvm/java-13-openjdk-amd64 # or something else
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
How to run geoserver with https protocol , what are the configurations required to setup
How to run geoserver with https protocol , what are the configurations required to setup
You can set up a reverse proxy with a webserver like nginx or caddy. Just make sure to configure CSRF for your domain.
Thank you , i used tomcat and deployed certificates
i had to go with
apt-get install postgresql postgresql-contrib postgis postgresql-9.5-postgis-2.2