9 *Note:* these installation instructions are also available in executable
10 form for use with vagrant under vagrant/install-on-ubuntu-16.sh.
12 Installing the Required Software
13 ================================
15 These instructions expect that you have a freshly installed Ubuntu 16.04.
17 Make sure all packages are are up-to-date by running:
21 sudo apt-get update -qq
23 Now you can install all packages needed for Nominatim:
25 sudo apt-get install -y build-essential cmake g++ libboost-dev libboost-system-dev \
26 libboost-filesystem-dev libexpat1-dev zlib1g-dev libxml2-dev\
27 libbz2-dev libpq-dev libgeos-dev libgeos++-dev libproj-dev \
28 postgresql-server-dev-9.5 postgresql-9.5-postgis-2.2 postgresql-contrib-9.5 \
29 apache2 php php-pgsql libapache2-mod-php php-pear php-db \
32 If you want to run the test suite, you need to install the following
35 sudo apt-get install -y python3-dev python3-pip python3-psycopg2 python3-tidylib phpunit
37 pip3 install --user behave nose # urllib3
38 sudo pear install PHP_CodeSniffer
44 The following steps are meant to configure a fresh Ubuntu installation
45 for use with Nominatim. You may skip some of the steps if you have your
46 OS already configured.
48 Creating Dedicated User Accounts
49 --------------------------------
51 Nominatim will run as a global service on your machine. It is therefore
52 best to install it under its own separate user account. In the following
53 we assume this user is called nominatim and the installation will be in
54 /srv/nominatim. To create the user and directory run:
56 sudo useradd -d /srv/nominatim -s /bin/bash -m nominatim
58 You may find a more suitable location if you wish.
60 To be able to copy and paste instructions from this manual, export
61 user name and home directory now like this:
63 export USERNAME=nominatim
64 export USERHOME=/srv/nominatim
66 **Never, ever run the installation as a root user.** You have been warned.
68 Make sure that system servers can read from the home directory:
75 Tune the postgresql configuration, which is located in
76 `/etc/postgresql/9.5/main/postgresql.conf`. See section *Postgres Tuning* in
77 [the installation page](Installation.md) for the parameters to change.
79 Restart the postgresql service after updating this config file.
81 sudo systemctl restart postgresql
84 Finally, we need to add two postgres users: one for the user that does
85 the import and another for the webserver which should access the database
89 sudo -u postgres createuser -s $USERNAME
90 sudo -u postgres createuser www-data
93 Setting up the Apache Webserver
94 -------------------------------
96 You need to create an alias to the website directory in your apache
97 configuration. Add a separate nominatim configuration to your webserver:
100 sudo tee /etc/apache2/conf-available/nominatim.conf << EOFAPACHECONF
101 <Directory "$USERHOME/Nominatim/build/website">
102 Options FollowSymLinks MultiViews
103 AddType text/html .php
104 DirectoryIndex search.php
108 Alias /nominatim $USERHOME/Nominatim/build/website
115 Then enable the configuration and restart apache
118 sudo a2enconf nominatim
119 sudo systemctl restart apache2
125 Building and Configuration
126 --------------------------
128 Get the source code from Github and change into the source directory
133 git clone --recursive git://github.com/openstreetmap/Nominatim.git
140 When installing the latest source from github, you also need to
141 download the country grid:
144 wget -O data/country_osm_grid.sql.gz http://www.nominatim.org/data/country_grid.sql.gz
147 The code must be built in a separate directory. Create this directory,
148 then configure and build Nominatim in there:
152 cmake $USERHOME/Nominatim
155 You need to create a minimal configuration file that tells nominatim
156 where it is located on the webserver:
159 tee settings/local.php << EOF
161 @define('CONST_Website_BaseURL', '/nominatim/');
166 Nominatim is now ready to use. Continue with
167 [importing a database from OSM data](Import_and_update.md).