Skip to content

Instantly share code, notes, and snippets.

@fgianoli
Last active June 11, 2020 09:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fgianoli/54df0017662b10f14b4904b65eaa3349 to your computer and use it in GitHub Desktop.
Save fgianoli/54df0017662b10f14b4904b65eaa3349 to your computer and use it in GitHub Desktop.
------------------------
CONFIGURE SERVER FOR GIS
------------------------
sudo su
apt update
apt upgrade
apt install apache2
------------------------------
INSTALL POSTGRESQL AND POSTGIS
------------------------------
// https://www.youtube.com/watch?v=NvM09ken26o&t=260s or https://www.a2hosting.com/kb/developer-corner/postgresql/managing-postgresql-databases-and-users-from-the-command-line
apt install postgresql postgresql-contrib
apt install postgresql-10-postgis-2.4
su - postgres
createuser --interactive --pwprompt
//Replace user with the name of the user that you want to own the database, and replace dbname with the name of the database that you want to create:
createdb -O user dbname
// edit pg settings
cd etc/postgresql/10/main
nano pg_hba.conf
// add: host all all 0.0.0.0/0 md5
nano postgresql.conf
// add IP address of the server: listen_addresses = 'localhost, *'
service postgresql restart
------------------------------
INSTALL GEOSERVER UNDER TOMCAT 8
------------------------------
//Install JAVA 8 for Geoserver
apt install openjdk-8-jdk
//Install Tomcat8 https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04
groupadd tomcat
sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
mkdir /opt/tomcat
chmod -R 775 tomcat
chown -R tomcat:tomcat ./tomcat
cd /opt/tomcat
wget http://apache.spinellicreations.com/tomcat/tomcat-8/v8.5.56/bin/apache-tomcat-8.5.56.tar.gz //get the most updated link of tomcat here: https://tomcat.apache.org/download-80.cgi
tar xvzf apache-tomcat-8.5.56.tar.gz
nano ~/.bashrc // add to this file the following settings
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 //pay attention to the name of the java version
export CATALINA_HOME=/opt/tomcat/apache-tomcat-8.5.56
. ~/.bashrc
// to check if Tomcat8 is running
$CATALINA_HOME/bin/startup.sh
// create tomcat8 service file under:
nano /etc/systemd/system/tomcat.service
//paste these line, be carefull to the names of the packages
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre
Environment=CATALINA_PID=/opt/tomcat/apache-tomcat-8.5.56/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat/apache-tomcat-8.5.56
Environment=CATALINA_BASE=/opt/tomcat/apache-tomcat-8.5.56
Environment='CATALINA_OPTS=-Xms8192M -Xmx2048M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
ExecStart=/opt/tomcat/apache-tomcat-8.5.56/bin/startup.sh
ExecStop=/opt/tomcat/apache-tomcat-8.5.56/bin/shutdown.sh
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
// INSTALL GEOSERVER under Tomcat8
// https://docs.geoserver.org/stable/en/user/installation/war.html#installation-war
cd //opt/tomcat/apache-tomcat-8.5.56/webapps
wget https://sourceforge.net/projects/geoserver/files/GeoServer/2.17.0/geoserver-2.17.0-war.zip
apt install unzip
unzip geoserver-2.17.0-war.zip
service tomcat restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment