+# Get the source code from Github and change into the source directory
+#
+if [ "x$1" == "xyes" ]; then #DOCS: :::sh
+ cd $USERHOME
+ git clone --recursive https://github.com/openstreetmap/Nominatim.git
+ cd Nominatim
+else #DOCS:
+ cd $USERHOME/Nominatim #DOCS:
+fi #DOCS:
+
+# When installing the latest source from github, you also need to
+# download the country grid:
+
+if [ ! -f data/country_osm_grid.sql.gz ]; then #DOCS: :::sh
+ wget -O data/country_osm_grid.sql.gz https://nominatim.org/data/country_grid.sql.gz
+fi #DOCS:
+
+# The code must be built in a separate directory. Create this directory,
+# then configure and build Nominatim in there:
+
+ mkdir $USERHOME/build
+ cd $USERHOME/build
+ cmake $USERHOME/Nominatim
+ make
+ sudo make install
+
+# Nominatim is now ready to use. You can continue with
+# [importing a database from OSM data](../admin/Import.md). If you want to set up
+# a webserver first, continue reading.
+#
+# Setting up a webserver
+# ======================
+#
+# The webserver should serve the php scripts from the website directory of your
+# [project directory](../admin/Import.md#creating-the-project-directory).
+# This directory needs to exist when being configured.
+# Therefore set up a project directory and create a website directory:
+
+ mkdir $USERHOME/nominatim-project
+ mkdir $USERHOME/nominatim-project/website
+
+# The import process will populate the directory later.
+
+#
+# Option 1: Using Apache
+# ----------------------
+#
+if [ "x$2" == "xinstall-apache" ]; then #DOCS:
+#
+# Apache has a PHP module that can be used to serve Nominatim. To install them
+# run:
+
+ sudo apt install -y apache2 libapache2-mod-php
+