3 # Installing the Required Software
4 # ================================
6 # *Note:* these installation instructions are also available in executable
7 # form for use with vagrant in the vagrant/ directory.
9 # These instructions expect that you have a freshly installed CentOS version 7.
10 # Make sure all packages are are up-to-date by running:
14 # Setting up Repositories
15 # -----------------------
17 # The standard CentOS repositories don't contain all the required packages,
18 # you need to enable the EPEL repository as well. To enable it on CentOS,
19 # install the epel-release RPM by running:
21 sudo yum install -y epel-release
24 # Getting the Software Packages
25 # -----------------------------
27 # Now you can install all packages needed for Nominatim:
29 sudo yum install -y postgresql-server postgresql-contrib postgresql-devel postgis postgis-utils \
30 git cmake make gcc gcc-c++ libtool policycoreutils-python \
31 php-pgsql php php-pear php-pear-DB libpqxx-devel proj-epsg \
32 bzip2-devel proj-devel geos-devel libxml2-devel boost-devel expat-devel zlib-devel
35 # System Configuration
36 # ====================
38 # The following steps are meant to configure a fresh CentOS installation
39 # for use with Nominatim. You may skip some of the steps if you have your
40 # OS already configured.
42 # Creating Dedicated User Accounts
43 # --------------------------------
45 # Nominatim will run as a global service on your machine. It is therefore
46 # best to install it under its own separate user account. In the following
47 # we assume this user is called nominatim and the installation will be in
48 # /srv/nominatim. To create the user and directory run:
50 # sudo useradd -d /srv/nominatim -s /bin/bash -m nominatim
52 # You may find a more suitable location if you wish.
54 # To be able to copy and paste instructions from this manual, export
55 # user name and home directory now like this:
57 export USERNAME=vagrant #DOCS: export USERNAME=nominatim
58 export USERHOME=/home/vagrant #DOCS: export USERHOME=/srv/nominatim
60 # **Never, ever run the installation as a root user.** You have been warned.
62 # Setting up PostgreSQL
63 # ---------------------
65 # CentOS does not automatically create a database cluster. Therefore, start
66 # with initializing the database, then enable the server to start at boot:
68 sudo postgresql-setup initdb
69 sudo systemctl enable postgresql
72 # Next tune the postgresql configuration, which is located in
73 # `/var/lib/pgsql/data/postgresql.conf`. See
74 # [the wiki](http://wiki.openstreetmap.org/wiki/Nominatim/Installation#PostgreSQL_Tuning_and_Configuration) for the parameters to change.
76 # Now start the postgresql service after updating this config file.
78 sudo systemctl restart postgresql
81 # Finally, we need to add two postgres users: one for the user that does
82 # the import and another for the webserver ro access the database:
85 sudo -u postgres createuser -s $USERNAME
86 sudo -u postgres apache
89 # Setting up the Apache Webserver
90 # -------------------------------
92 # You need to create an alias to the website directory in your apache
93 # configuration. This can be most easily done by XXX
96 # Adding SELinux Security Settings
97 # --------------------------------
99 # It is a good idea to leave SELinux enabled and enforcing, particularly
100 # with a web server accessible from the Internet. At a minimum the
101 # following SELinux labeling should be done for Nominatim:
103 sudo semanage fcontext -a -t httpd_sys_content_t "$USERHOME/Nominatim/(website|lib|settings)(/.*)?"
104 sudo semanage fcontext -a -t lib_t "$USERHOME/Nominatim/module/nominatim.so"
105 sudo restorecon -R -v $USERHOME/Nominatim
108 # Installing Nominatim
109 # ====================
111 # Building and Configuration
112 # --------------------------
114 # Get the source code from Github and change into the source directory
118 sudo -u $USERNAME git clone --recursive git://github.com/twain47/Nominatim.git
120 # The code is built in a special directory. Create this directory,
121 # then configure and build Nominatim in there:
124 sudo -u $USERNAME mkdir build
126 sudo -u $USERNAME cmake ../Nominatim
127 sudo -u $USERNAME make
129 # You need to create a minimal configuration file that tells nominatim
130 # the name of your webserver user:
133 sudo -u $USERNAME tee << EOF
135 @define('CONST_Database_Web_User', 'apache');
139 # There are lots of configuration settings you can tweak. Have a look
140 # at `settings/settings.php` for a full list. Most should have a sensible default.
141 # If you plan to import a large dataset (e.g. Europe, North America, planet),
142 # you should also enable flatnode storage of node locations. With this
143 # setting enabled, node coordinates are stored in a simple file instead
144 # of the database. This will save you import time and disk storage.
145 # Add to your settings/local.php:
147 # @define('CONST_Osm2pgsql_Flatnode_File', '/path/to/flatnode.file');
150 # Downloading additional data
151 # ---------------------------
153 # The following data is optional but download is strongly recommended:
155 # sudo -u $USERNAME wget -O data/wikipedia_article.sql.bin http://www.nominatim.org/data/wikipedia_article.sql.bin
156 # sudo -u $USERNAME wget -O data/wikipedia_redirect.sql.bin http://www.nominatim.org/data/wikipedia_redirect.sql.bin
157 # sudo -u $USERNAME wget -O data/gb_postcode_data.sql.gz http://www.nominatim.org/data/gb_postcode_data.sql.gz
160 # Initial Import of the Data
161 # --------------------------
163 # **Attention:** first try the import with a small excerpt, for example from Geofabrik.
165 # Download the data to import and load the data with the following command:
167 # ./utils/setup.php --osm-file <your data file> --all [--osm2pgsql-cache 28000] 2>&1 | tee setup.log
169 # The --osm2pgsql-cache parameter is optional but strongly recommended for
170 # planet imports. It sets the node cache size for the osm2pgsql import part
171 # (see -C parameter in osm2pgsql help). 28GB are recommended for a full planet
172 # imports, for excerpts you can use less.
173 # Adapt to your available RAM to avoid swapping.
175 # The import will take as little as an hour for a small country extract
176 # and as much as 10 days for a full-scale planet import on less powerful
180 # Loading Additional Datasets
181 # ---------------------------
183 # The following commands will create additional entries for countries and POI searches:
185 # ./utils/specialphrases.php --countries > data/specialphrases_countries.sql
186 # psql -d nominatim -f data/specialphrases_countries.sql
187 # ./utils/specialphrases.php --wiki-import > data/specialphrases.sql
188 # psql -d nominatim -f data/specialphrases.sql