4 ## During 'vagrant provision' this script runs as root and the current
5 ## directory is '/root'
9 ### maybe create ubuntu user
12 # if [[ ! `id -u $USERNAME` ]]; then
13 # useradd $USERNAME --create-home --shell /bin/bash
16 # echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/99-$USERNAME-user
17 # chmod 0440 /etc/sudoers.d/99-$USERNAME-user
18 # service sudo restart
20 # # add basic .profile
21 # cp -r .ssh .profile .bashrc /home/$USERNAME/
22 # chown -R $USERNAME /home/$USERNAME/.*
23 # chgrp -R $USERNAME /home/$USERNAME/.*
25 # # now ideally login as $USERNAME and continue
30 sudo apt-get update -qq
31 sudo apt-get upgrade -y
32 sudo apt-get install -y build-essential libgeos-dev libpq-dev libbz2-dev \
33 libtool automake libproj-dev libboost-dev libboost-system-dev \
34 libboost-filesystem-dev libboost-thread-dev libexpat-dev
35 sudo apt-get autoremove -y
37 # get arrow-keys working in terminal (e.g. editing in vi)
38 echo 'stty sane' >> ~/.bash_profile
39 echo 'export TERM=linux' >> ~/.bash_profile
40 source ~/.bash_profile
44 ### PostgreSQL 9.3 + PostGIS 2.1
47 sudo apt-get install -y postgresql-9.3-postgis-2.1 postgresql-contrib-9.3 postgresql-server-dev-9.3
48 # already included: proj-bin libgeos-dev
50 # make sure OS-authenticated users (e.g. $USERNAME) can access
51 sudo sed -i "s/ident/trust/" /etc/postgresql/9.3/main/pg_hba.conf
52 sudo sed -i "s/md5/trust/" /etc/postgresql/9.3/main/pg_hba.conf
53 sudo sed -i "s/peer/trust/" /etc/postgresql/9.3/main/pg_hba.conf
54 sudo /etc/init.d/postgresql restart
57 sudo -u postgres createuser -s $USERNAME
64 sudo apt-get install -y php5 php5-pgsql php-pear php-db
67 # get rid of some warning
68 # where is the ini file? 'php --ini'
69 echo "date.timezone = 'Etc/UTC'" | sudo tee /etc/php5/cli/conf.d/99-timezone.ini > /dev/null
76 sudo apt-get install -y libgeos-c1 libgeos++-dev libxml2-dev
78 # now ideally login as $USERNAME and continue
82 if [ ! -d "Nominatim" ]; then
83 sudo apt-get install -y git
84 git clone --recursive https://github.com/twain47/Nominatim.git
96 LOCALSETTINGS_FILE='settings/local.php'
97 if [[ -e "$LOCALSETTINGS_FILE" ]]; then
98 echo "$LOCALSETTINGS_FILE already exist, writing to settings/local-vagrant.php instead."
99 LOCALSETTINGS_FILE='settings/local-vagrant.php'
102 # IP=`curl -s http://bot.whatismyipaddress.com`
106 @define('CONST_Database_DSN', 'pgsql://@/nominatim');
108 @define('CONST_Postgresql_Version', '9.3');
109 @define('CONST_Postgis_Version', '2.1');
111 @define('CONST_Website_BaseURL', 'http://$IP:8089/nominatim/');
112 " > $LOCALSETTINGS_FILE
121 ### Setup Apache/website
124 sudo -u postgres createuser -SDR www-data
129 # DirectoryIndex index.html
130 # ErrorDocument 403 /index.html
132 DocumentRoot "/var/www/"
134 <Directory "/var/www/nominatim/">
135 Options FollowSymLinks MultiViews
136 AddType text/html .php
139 ' | sudo tee /etc/apache2/sites-enabled/nominatim.conf > /dev/null
142 sudo apache2ctl graceful
145 sudo mkdir -m 755 /var/www/nominatim
146 sudo chown $USERNAME /var/www/nominatim
147 ./utils/setup.php --threads 1 --create-website /var/www/nominatim
150 # if you get 'permission denied for relation word', then try
151 # GRANT usage ON SCHEMA public TO "www-data";
152 # GRANT SELECT ON ALL TABLES IN SCHEMA public TO "www-data";
155 ## Test suite (Python)
156 ## https://github.com/twain47/Nominatim/tree/master/tests
158 sudo apt-get install -y python-dev python-pip python-Levenshtein python-shapely \
159 python-psycopg2 tidy python-nose python-tidylib
160 sudo pip install lettuce==0.2.18 six==1.7 haversine
163 ## https://github.com/twain47/Nominatim/tree/master/tests-php
164 sudo apt-get install -y phpunit