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 libxml2-dev 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 libprotobuf-c0-dev protobuf-c-compiler \
77 libgeos-c1 libgeos++-dev \
80 # git clone --recursive https://github.com/twain47/Nominatim.git
83 # now ideally login as $USERNAME and continue
85 cd /home/vagrant/Nominatim
95 LOCALSETTINGS_FILE='settings/local.php'
96 if [[ -e "$LOCALSETTINGS_FILE" ]]; then
97 echo "$LOCALSETTINGS_FILE already exist, writing to settings/local-vagrant.php instead."
98 LOCALSETTINGS_FILE='settings/local-vagrant.php'
101 # IP=`curl -s http://bot.whatismyipaddress.com`
105 @define('CONST_Database_DSN', 'pgsql://@/nominatim');
107 @define('CONST_Postgresql_Version', '9.3');
108 @define('CONST_Postgis_Version', '2.1');
110 @define('CONST_Website_BaseURL', 'http://$IP:8089/nominatim/');
111 " > $LOCALSETTINGS_FILE
120 ### Setup Apache/website
123 sudo -u postgres createuser -SDR www-data
128 # DirectoryIndex index.html
129 # ErrorDocument 403 /index.html
131 DocumentRoot "/var/www/"
133 <Directory "/var/www/nominatim/">
134 Options FollowSymLinks MultiViews
135 AddType text/html .php
138 ' | sudo tee /etc/apache2/sites-enabled/nominatim.conf > /dev/null
141 sudo apache2ctl graceful
144 sudo mkdir -m 755 /var/www/nominatim
145 sudo chown $USERNAME /var/www/nominatim
146 ./utils/setup.php --threads 1 --create-website /var/www/nominatim
149 # if you get 'permission denied for relation word', then try
150 # GRANT usage ON SCHEMA public TO "www-data";
151 # GRANT SELECT ON ALL TABLES IN SCHEMA public TO "www-data";
154 ## Test suite (Python)
155 ## https://github.com/twain47/Nominatim/tree/master/tests
157 sudo apt-get install -y python-dev python-pip python-Levenshtein python-shapely \
158 python-psycopg2 tidy python-nose python-tidylib
159 sudo pip install lettuce==0.2.18 six==1.7 haversine
162 ## https://github.com/twain47/Nominatim/tree/master/tests-php
163 sudo apt-get install -y phpunit