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-18.sh.
13 # Installing the Required Software
14 # ================================
16 # These instructions expect that you have a freshly installed Ubuntu 18.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-10 postgresql-10-postgis-2.4 \
31 postgresql-contrib-10 postgresql-10-postgis-scripts \
32 apache2 php php-pgsql libapache2-mod-php \
33 php-intl python3-setuptools python3-dev python3-pip \
34 python3-psycopg2 python3-tidylib git
36 # If you want to run the test suite, you need to install the following
37 # additional packages including the PHP package manager composer:
39 pip3 install --user behave nose
41 sudo apt-get install -y php-cgi php-cli php-mbstring php-xml zip unzip
43 curl -Ss 'https://raw.githubusercontent.com/composer/getcomposer.org/99312bc6306564ac1f0ad2c6207c129b3aff58d6/web/installer' -o /tmp/composer-setup.php
44 if echo 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a /tmp/composer-setup.php' | sha384sum --check --strict --status; then
46 php /tmp/composer-setup.php --install-dir ~/.local/bin --filename composer
48 ~/.local/bin/composer global require "squizlabs/php_codesniffer=*"
49 sudo ln -s ~/.config/composer/vendor/bin/phpcs /usr/bin/
51 ~/.local/bin/composer global require "phpunit/phpunit=8.*"
52 sudo ln -s ~/.config/composer/vendor/bin/phpunit /usr/bin/
54 echo 'Installer corrupt. Cannot install composer, php_codesniffer and phpunit.' >&2
58 # System Configuration
59 # ====================
61 # The following steps are meant to configure a fresh Ubuntu installation
62 # for use with Nominatim. You may skip some of the steps if you have your
63 # OS already configured.
65 # Creating Dedicated User Accounts
66 # --------------------------------
68 # Nominatim will run as a global service on your machine. It is therefore
69 # best to install it under its own separate user account. In the following
70 # we assume this user is called nominatim and the installation will be in
71 # /srv/nominatim. To create the user and directory run:
73 # sudo useradd -d /srv/nominatim -s /bin/bash -m nominatim
75 # You may find a more suitable location if you wish.
77 # To be able to copy and paste instructions from this manual, export
78 # user name and home directory now like this:
80 export USERNAME=vagrant #DOCS: export USERNAME=nominatim
81 export USERHOME=/home/vagrant #DOCS: export USERHOME=/srv/nominatim
83 # **Never, ever run the installation as a root user.** You have been warned.
85 # Make sure that system servers can read from the home directory:
89 # Setting up PostgreSQL
90 # ---------------------
92 # Tune the postgresql configuration, which is located in
93 # `/etc/postgresql/10/main/postgresql.conf`. See section *Postgres Tuning* in
94 # [the installation page](../admin/Installation.md#postgresql-tuning)
95 # for the parameters to change.
97 # Restart the postgresql service after updating this config file.
99 sudo systemctl restart postgresql
102 # Finally, we need to add two postgres users: one for the user that does
103 # the import and another for the webserver which should access the database
107 sudo -u postgres createuser -s $USERNAME
108 sudo -u postgres createuser www-data
111 # Setting up the Apache Webserver
112 # -------------------------------
114 # You need to create an alias to the website directory in your apache
115 # configuration. Add a separate nominatim configuration to your webserver:
118 sudo tee /etc/apache2/conf-available/nominatim.conf << EOFAPACHECONF
119 <Directory "$USERHOME/build/website"> #DOCS:<Directory "$USERHOME/Nominatim/build/website">
120 Options FollowSymLinks MultiViews
121 AddType text/html .php
122 DirectoryIndex search.php
126 Alias /nominatim $USERHOME/build/website #DOCS:Alias /nominatim $USERHOME/Nominatim/build/website
130 sudo sed -i 's:#.*::' /etc/apache2/conf-available/nominatim.conf #DOCS:
133 # Then enable the configuration and restart apache
136 sudo a2enconf nominatim
137 sudo systemctl restart apache2
140 # Installing Nominatim
141 # ====================
143 # Building and Configuration
144 # --------------------------
146 # Get the source code from Github and change into the source directory
148 if [ "x$1" == "xyes" ]; then #DOCS: :::sh
150 git clone --recursive git://github.com/openstreetmap/Nominatim.git
153 cd $USERHOME/Nominatim #DOCS:
156 # When installing the latest source from github, you also need to
157 # download the country grid:
159 if [ ! -f data/country_osm_grid.sql.gz ]; then #DOCS: :::sh
160 wget -O data/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz
163 # The code must be built in a separate directory. Create this directory,
164 # then configure and build Nominatim in there:
166 cd $USERHOME #DOCS: :::sh
169 cmake $USERHOME/Nominatim
172 # You need to create a minimal configuration file that tells nominatim
173 # where it is located on the webserver:
176 tee settings/local.php << EOF
178 @define('CONST_Website_BaseURL', '/nominatim/');
183 # Nominatim is now ready to use. Continue with
184 # [importing a database from OSM data](../admin/Import-and-Update.md).