-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathprovision.sh
124 lines (97 loc) · 3.79 KB
/
provision.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Install PostGIS
echo *** Installing PostGIS ***
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt trusty-pgdg main" >> /etc/apt/sources.list'
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | apt-key add -
sudo apt-add-repository -y ppa:georepublic/pgrouting
sudo apt-get update
sudo apt-get install -y postgresql-9.4-postgis-2.1 pgadmin3 postgresql-contrib libssl-dev
# Enable Adminpack
# sudo -u postgres psql
# CREATE EXTENSION adminpack;
# service postgresql restart
# SELECT pg_reload_conf();
# SELECT name, setting FROM pg_settings where category='File Locations';
# \q
# sudo su - postgres
# Create user - note change it from postgisuser
# createuser -d -E -i -l -P -r -s postgisuser
# echo "default postgres user <postgisuser> created - please change"
# Install pgRouting package (for Ubuntu 14.04)
# sudo apt-get install postgresql-9.4-pgrouting
echo ' '
echo --- PostGIS Installed - note there will be post-configuration steps needed ---
# Install JRE for GeoServer
echo ' '
echo --- Installing JRE ---
sudo add-apt-repository ppa:openjdk-r/ppa -y
sudo apt-get update
sudo apt-get install -y openjdk-8-jre -y
echo "Java installed?"
# sleep 20s
# Config JRE - still needs to be fixed
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
export JAVA_HOME
echo ' '
echo --- Installing unzip ---
# Install unzip
sudo apt-get install -y unzip
echo ' '
echo --- Setting Up for GeoServer ---
echo "export GEOSERVER_HOME=/usr/local/geoserver/" >> ~/.profile
. ~/.profile
sudo rm -rf /usr/local/geoserver/
mkdir /usr/local/geoserver/
sudo chown -R vagrant /usr/local/geoserver/
cd /usr/local
echo ' '
echo --- Downloading GeoServer package - please wait ---
wget -nv -O tmp.zip http://sourceforge.net/projects/geoserver/files/GeoServer/2.9.1/geoserver-2.9.1-bin.zip && unzip tmp.zip -d /usr/local/ && rm tmp.zip
echo ' '
echo --- Package unzipped - configuring GeoServer directory ---
cp -r /usr/local/geoserver-2.9.1/* /usr/local/geoserver && sudo rm -rf /usr/local/geoserver-2.9.1/
echo ' '
echo --- GeoServer Installed ---
echo ' '
echo --- Getting ready to run GeoServer ---
sudo chown -R vagrant /usr/local/geoserver/
cd /usr/local/geoserver/bin
# Geoserver configuration - use /etc/default/geoserver to override these vars
# user that shall run GeoServer
USER=geoserver
GEOSERVER_DATA_DIR=/home/$USER/data_dir
export GEOSERVER_DATA_DIR
#GEOSERVER_HOME=/home/$USER/geoserver
GEOSERVER_HOME=/usr/local/geoserver/
export GEOSERVER_HOME
PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="GeoServer daemon"
NAME=geoserver
JAVA_OPTS="-Xms128m -Xmx512m"
DAEMON="$JAVA_HOME/bin/java"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
DAEMON_ARGS="$JAVA_OPTS $DEBUG_OPTS -DGEOSERVER_DATA_DIR=$GEOSERVER_DATA_DIR -Djava.awt.headless=true -jar start.jar"
# Load the VERBOSE setting and other rcS variables
[ -f /etc/default/rcS ] && . /etc/default/rcS
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
echo ' '
echo --- Launching GeoServer startup script ---
echo --- This will run in the background with nohup mode ---
echo --- To access the server, use vagrant ssh ---
echo --- To view the web client go to http://localhost:8080/geoserver ---
echo ' '
# run startup script and have it run in the background - output logged to nohup.out
echo "USER is" $USER
echo "GEOSERVER_DATA_DIR is" $GEOSERVER_DATA_DIR
echo "GEOSERVER_HOME is " $GEOSERVER_HOME
cd /usr/local/geoserver/bin/
echo " "
echo "Working directory:"
pwd
echo "--------"
echo "Starting up GeoServer"
sh /usr/local/geoserver/bin/startup.sh 0<&- &>/dev/null &