3 # hacks for broken vagrant box #DOCS:
4 sudo rm -f /var/lib/dpkg/lock #DOCS:
5 sudo update-locale LANG=en_US.UTF-8 #DOCS:
6 export APT_LISTCHANGES_FRONTEND=none #DOCS:
7 export DEBIAN_FRONTEND=noninteractive #DOCS:
10 # *Note:* these installation instructions are also available in executable
11 # form for use with vagrant under vagrant/Install-on-Ubuntu-16.sh.
13 # Installing the Required Software
14 # ================================
16 # These instructions expect that you have a freshly installed Ubuntu 16.04.
18 # Make sure all packages are are up-to-date by running:
22 sudo apt-get -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" --force-yes -fuy install grub-pc #DOCS:
23 sudo apt-get update -qq
25 # Now you can install all packages needed for Nominatim:
27 sudo apt-get install -y build-essential cmake g++ libboost-dev libboost-system-dev \
28 libboost-filesystem-dev libexpat1-dev zlib1g-dev\
29 libbz2-dev libpq-dev libproj-dev \
30 postgresql-server-dev-9.5 postgresql-9.5-postgis-2.2 \
31 postgresql-contrib-9.5 \
32 apache2 php php-pgsql libapache2-mod-php \
33 php-intl python3-setuptools python3-dev python3-pip \
36 # python3-psycopg2 apt package is too old (2.6), we want at least 2.7
37 pip3 install --user psycopg2
39 # If you want to run the test suite, you need to install the following
40 # additional packages:
42 sudo apt-get install -y php-cgi php-mbstring
44 pip3 install --user behave nose
46 composer global require "squizlabs/php_codesniffer=*"
47 sudo ln -s ~/.config/composer/vendor/bin/phpcs /usr/bin/
49 composer global require "phpunit/phpunit=6.*"
50 sudo ln -s ~/.config/composer/vendor/bin/phpunit /usr/bin/
53 # System Configuration
54 # ====================
56 # The following steps are meant to configure a fresh Ubuntu installation
57 # for use with Nominatim. You may skip some of the steps if you have your
58 # OS already configured.
60 # Creating Dedicated User Accounts
61 # --------------------------------
63 # Nominatim will run as a global service on your machine. It is therefore
64 # best to install it under its own separate user account. In the following
65 # we assume this user is called nominatim and the installation will be in
66 # /srv/nominatim. To create the user and directory run:
68 # sudo useradd -d /srv/nominatim -s /bin/bash -m nominatim
70 # You may find a more suitable location if you wish.
72 # To be able to copy and paste instructions from this manual, export
73 # user name and home directory now like this:
75 export USERNAME=vagrant #DOCS: export USERNAME=nominatim
76 export USERHOME=/home/vagrant #DOCS: export USERHOME=/srv/nominatim
78 # **Never, ever run the installation as a root user.** You have been warned.
80 # Make sure that system servers can read from the home directory:
84 # Setting up PostgreSQL
85 # ---------------------
87 # Tune the postgresql configuration, which is located in
88 # `/etc/postgresql/9.5/main/postgresql.conf`. See section *Postgres Tuning* in
89 # [the installation page](../admin/Installation.md#postgresql-tuning)
90 # for the parameters to change.
92 # Restart the postgresql service after updating this config file.
94 sudo systemctl restart postgresql
97 # Finally, we need to add two postgres users: one for the user that does
98 # the import and another for the webserver which should access the database
102 sudo -u postgres createuser -s $USERNAME
103 sudo -u postgres createuser www-data
106 # Setting up the Apache Webserver
107 # -------------------------------
109 # You need to create an alias to the website directory in your apache
110 # configuration. Add a separate nominatim configuration to your webserver:
113 sudo tee /etc/apache2/conf-available/nominatim.conf << EOFAPACHECONF
114 <Directory "$USERHOME/build/website"> #DOCS:<Directory "$USERHOME/Nominatim/build/website">
115 Options FollowSymLinks MultiViews
116 AddType text/html .php
117 DirectoryIndex search.php
121 Alias /nominatim $USERHOME/build/website #DOCS:Alias /nominatim $USERHOME/Nominatim/build/website
125 sudo sed -i 's:#.*::' /etc/apache2/conf-available/nominatim.conf #DOCS:
128 # Then enable the configuration and restart apache
131 sudo a2enconf nominatim
132 sudo systemctl restart apache2
135 # Installing Nominatim
136 # ====================
138 # Building and Configuration
139 # --------------------------
141 # Get the source code from Github and change into the source directory
143 if [ "x$1" == "xyes" ]; then #DOCS: :::sh
145 git clone --recursive git://github.com/openstreetmap/Nominatim.git
148 cd $USERHOME/Nominatim #DOCS:
151 # When installing the latest source from github, you also need to
152 # download the country grid:
154 if [ ! -f data/country_osm_grid.sql.gz ]; then #DOCS: :::sh
155 wget -O data/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz
158 # The code must be built in a separate directory. Create this directory,
159 # then configure and build Nominatim in there:
161 cd $USERHOME #DOCS: :::sh
164 cmake $USERHOME/Nominatim
167 # You need to create a minimal configuration file that tells nominatim
168 # where it is located on the webserver:
171 tee settings/local.php << EOF
173 @define('CONST_Website_BaseURL', '/nominatim/');
178 # Nominatim is now ready to use. Continue with
179 # [importing a database from OSM data](../admin/Import-and-Update.md).