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:
21 sudo apt-get -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" --force-yes -fuy install grub-pc #DOCS:
22 sudo apt-get update -qq
24 # Now you can install all packages needed for Nominatim:
26 sudo apt-get install -y build-essential cmake g++ libboost-dev libboost-system-dev \
27 libboost-filesystem-dev libexpat1-dev zlib1g-dev libxml2-dev\
28 libbz2-dev libpq-dev libgeos-dev libgeos++-dev libproj-dev \
29 postgresql-server-dev-9.5 postgresql-9.5-postgis-2.2 postgresql-contrib-9.5 \
30 apache2 php php-pgsql libapache2-mod-php php-pear php-db \
33 # If you want to run the test suite, you need to install the following
34 # additional packages:
36 sudo apt-get install -y python3-dev python3-pip python3-psycopg2 python3-tidylib phpunit
38 pip3 install --user behave nose # urllib3
39 sudo pear install PHP_CodeSniffer
42 # System Configuration
43 # ====================
45 # The following steps are meant to configure a fresh Ubuntu installation
46 # for use with Nominatim. You may skip some of the steps if you have your
47 # OS already configured.
49 # Creating Dedicated User Accounts
50 # --------------------------------
52 # Nominatim will run as a global service on your machine. It is therefore
53 # best to install it under its own separate user account. In the following
54 # we assume this user is called nominatim and the installation will be in
55 # /srv/nominatim. To create the user and directory run:
57 # sudo useradd -d /srv/nominatim -s /bin/bash -m nominatim
59 # You may find a more suitable location if you wish.
61 # To be able to copy and paste instructions from this manual, export
62 # user name and home directory now like this:
64 export USERNAME=vagrant #DOCS: export USERNAME=nominatim
65 export USERHOME=/home/vagrant #DOCS: export USERHOME=/srv/nominatim
67 # **Never, ever run the installation as a root user.** You have been warned.
69 # Make sure that system servers can read from the home directory:
73 # Setting up PostgreSQL
74 # ---------------------
76 # Tune the postgresql configuration, which is located in
77 # `/etc/postgresql/9.5/main/postgresql.conf`. See section *Postgres Tuning* in
78 # [the installation page](Installation.md) for the parameters to change.
80 # Restart the postgresql service after updating this config file.
82 sudo systemctl restart postgresql
85 # Finally, we need to add two postgres users: one for the user that does
86 # the import and another for the webserver which should access the database
90 sudo -u postgres createuser -s $USERNAME
91 sudo -u postgres createuser www-data
94 # Setting up the Apache Webserver
95 # -------------------------------
97 # You need to create an alias to the website directory in your apache
98 # configuration. Add a separate nominatim configuration to your webserver:
101 sudo tee /etc/apache2/conf-available/nominatim.conf << EOFAPACHECONF
102 <Directory "$USERHOME/build/website"> #DOCS:<Directory "$USERHOME/Nominatim/build/website">
103 Options FollowSymLinks MultiViews
104 AddType text/html .php
105 DirectoryIndex search.php
109 Alias /nominatim $USERHOME/build/website #DOCS:Alias /nominatim $USERHOME/Nominatim/build/website
113 sudo sed -i 's:#.*::' /etc/apache2/conf-available/nominatim.conf #DOCS:
116 # Then enable the configuration and restart apache
119 sudo a2enconf nominatim
120 sudo systemctl restart apache2
123 # Installing Nominatim
124 # ====================
126 # Building and Configuration
127 # --------------------------
129 # Get the source code from Github and change into the source directory
131 if [ "x$1" == "xyes" ]; then #DOCS:
134 git clone --recursive git://github.com/openstreetmap/Nominatim.git
138 cd $USERHOME/Nominatim #DOCS:
141 # When installing the latest source from github, you also need to
142 # download the country grid:
144 if [ ! -f data/country_osm_grid.sql.gz ]; then #DOCS:
145 wget -O data/country_osm_grid.sql.gz http://www.nominatim.org/data/country_grid.sql.gz
148 # The code must be built in a separate directory. Create this directory,
149 # then configure and build Nominatim in there:
154 cmake $USERHOME/Nominatim
157 # You need to create a minimal configuration file that tells nominatim
158 # where it is located on the webserver:
161 tee settings/local.php << EOF
163 @define('CONST_Website_BaseURL', '/nominatim/');
168 # Nominatim is now ready to use. Continue with
169 # [importing a database from OSM data](Import-and-Update.md).