1 # Setting up Nominatim for Development
3 This chapter gives an overview how to set up Nominatim for developement
7 This guide assumes that you develop under the latest version of Ubuntu. You
8 can of course also use your favourite distribution. You just might have to
9 adapt the commands below slightly, in particular the commands for installing
12 ## Installing Nominatim
14 The first step is to install Nominatim itself. Please follow the installation
15 instructions in the [Admin section](../admin/Installation.md). You don't need
16 to set up a webserver for development, the webserver that is included with PHP
19 If you want to run Nominatim in a VM via Vagrant, use the default `ubuntu` setup.
20 Vagrant's libvirt provider runs out-of-the-box under Ubuntu. You also need to
21 install an NFS daemon to enable directory sharing between host and guest. The
22 following packages should get you started:
24 sudo apt install vagrant vagrant-libvirt libvirt-daemon nfs-kernel-server
26 ## Prerequisites for testing and documentation
28 The Nominatim test suite consists of behavioural tests (using behave) and
29 unit tests (using PHPUnit). It has the following additional requirements:
31 * [behave test framework](https://behave.readthedocs.io) >= 1.2.5
32 * [phpunit](https://phpunit.de) >= 7.3
33 * [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer)
35 The documentation is built with mkdocs:
37 * [mkdocs](https://www.mkdocs.org/) >= 1.1.2
39 ### Installing prerequisites on Ubuntu/Debian
41 Some of the Python packages require the newest version which is not yet
42 available with the current distributions. Therefore it is recommended to
43 install pip to get the newest versions.
45 To install all necessary packages run:
48 sudo apt install php-cgi phpunit php-codesniffer \
49 python3-pip python3-setuptools python3-dev
51 pip3 install --user behave mkdocs
54 The `mkdocs` executable will be located in `.local/bin`. You may have to add
55 this directory to your path, for example by running:
58 echo 'export PATH=~/.local/bin:$PATH' > ~/.profile
61 If your distribution does not have PHPUnit 7.3+, you can install it (as well
62 as CodeSniffer) via composer:
65 sudo apt-get install composer
66 composer global require "squizlabs/php_codesniffer=*"
67 composer global require "phpunit/phpunit=8.*"
70 The binaries are found in `.config/composer/vendor/bin`. You need to add this
74 echo 'export PATH=~/.config/composer/vendor/bin:$PATH' > ~/.profile
80 All tests are located in the `/test` directory.
82 To run all tests just go to the build directory and run make:
89 For more information about the structure of the tests and how to change and
90 extend the test suite, see the [Testing chapter](Testing.md).
92 ## Documentation Pages
94 The [Nominatim documentation](https://nominatim.org/release-docs/develop/) is
95 built using the [MkDocs](https://www.mkdocs.org/) static site generation
96 framework. The master branch is automatically deployed every night on
97 [https://nominatim.org/release-docs/develop/](https://nominatim.org/release-docs/develop/)
99 To build the documentation, go to the build directory and run
103 INFO - Cleaning site directory
104 INFO - Building documentation to directory: /home/vagrant/build/site-html
107 This runs `mkdocs build` plus extra transformation of some files and adds
108 symlinks (see `CMakeLists.txt` for the exact steps).
110 Now you can start webserver for local testing
114 [server:296] Serving on http://127.0.0.1:8000
115 [handlers:62] Start watching changes
118 If you develop inside a Vagrant virtual machine, use a port that is forwarded
122 build> mkdocs serve --dev-addr 0.0.0.0:8088
123 [server:296] Serving on http://0.0.0.0:8088
124 [handlers:62] Start watching changes