-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
33 lines (31 loc) · 1.48 KB
/
bootstrap.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
#!/usr/bin/env bash
#Vagrant bootstrap file (don't run this on the server)
if [`hostname` != "vagrant-ubuntu-trusty-64"]; then
echo "only runs on Vagrant!!"
exit 1
fi
#install postgres
apt-get update
apt-get install -y postgresql postgis postgresql-9.3-postgis-2.1 wget git
#setup postgres users and database
sudo -u postgres -H sh -c "createuser vagrant -s"
sudo -u postgres -H sh -c "createuser $1 -s"
sudo -u postgres -H sh -c "createdb --owner vagrant moabi"
sudo -u postgres -H sh -c "psql -d moabi -c 'CREATE EXTENSION postgis; CREATE EXTENSION hstore;'"
#allow all postgres users to access
echo -e "local \t all \t all \t trust" >> /etc/postgresql/9.3/main/pg_hba.conf
echo -e "host \t all \t all \t all \t trust" >> /etc/postgresql/9.3/main/pg_hba.conf
echo "listen_addresses = '*'" >> /etc/postgresql/9.3/main/postgresql.conf
service postgresql restart
#install osm2pgsql
apt-get install -y autoconf automake libtool make g++ libboost-dev \
libboost-system-dev libboost-filesystem-dev libboost-thread-dev libxml2-dev \
libgeos-dev libgeos++-dev libpq-dev libbz2-dev libproj-dev
git clone git://github.com/openstreetmap/osm2pgsql.git
cd osm2pgsql/
git checkout tags/0.84.0
./autogen.sh
./configure && make && make install
cd ~vagrant
sudo -u vagrant -H sh -c "wget http://planet.osm.moabi.org/planet.latest.osm.gz"
sudo -u vagrant -H sh -c "osm2pgsql --create --hstore-all --multi-geometry --slim --cache 64 --cache-strategy sparse --database moabi --style carto/moabi.style planet.latest.osm.gz"