3 # *Note:* these installation instructions are also available in executable
4 # form for use with vagrant under `vagrant/Install-on-Centos-7.sh`.
6 # Installing the Required Software
7 # ================================
10 # These instructions are currently broken because they do not
11 # include installation of the required PHP library symfony-dotenv.
13 # These instructions expect that you have a freshly installed CentOS version 7.
14 # Make sure all packages are up-to-date by running:
18 # The standard CentOS repositories don't contain all the required packages,
19 # you need to enable the EPEL repository as well. To enable it on CentOS,
20 # install the epel-release RPM by running:
22 sudo yum install -y epel-release
24 # More repositories for postgresql 11 (CentOS default 'postgresql' is 9.2), postgis
25 # and llvm-toolset (https://github.com/theory/pg-semver/issues/35)
27 sudo yum install -y https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
28 sudo yum install -y centos-release-scl-rh
30 # More repositories for PHP 7 (default is PHP 5.4)
32 sudo yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm
33 sudo yum-config-manager --enable remi-php72
36 # Now you can install all packages needed for Nominatim:
40 sudo yum install -y postgresql11-server postgresql11-contrib postgresql11-devel \
41 postgis25_11 postgis25_11-utils \
42 wget git cmake make gcc gcc-c++ libtool policycoreutils-python \
43 devtoolset-7 llvm-toolset-7 \
44 php-pgsql php php-intl libpqxx-devel \
45 proj-epsg bzip2-devel proj-devel boost-devel \
46 python3-pip python3-setuptools python3-devel \
47 expat-devel zlib-devel
49 pip3 install --user psycopg2
53 # System Configuration
54 # ====================
56 # The following steps are meant to configure a fresh CentOS installation
57 # for use with Nominatim. You may skip some of the steps if you have your
58 # OS already configured.
60 # Creating Dedicated User Accounts
61 # --------------------------------
63 # Nominatim will run as a global service on your machine. It is therefore
64 # best to install it under its own separate user account. In the following
65 # we assume this user is called nominatim and the installation will be in
66 # /srv/nominatim. To create the user and directory run:
68 sudo mkdir -p /srv/nominatim #DOCS: sudo useradd -d /srv/nominatim -s /bin/bash -m nominatim
69 sudo chown vagrant /srv/nominatim #DOCS:
71 # You may find a more suitable location if you wish.
73 # To be able to copy and paste instructions from this manual, export
74 # user name and home directory now like this:
76 export USERNAME=vagrant #DOCS: export USERNAME=nominatim
77 export USERHOME=/srv/nominatim
79 # **Never, ever run the installation as a root user.** You have been warned.
81 # Make sure that system servers can read from the home directory:
85 # Setting up PostgreSQL
86 # ---------------------
88 # CentOS does not automatically create a database cluster. Therefore, start
89 # with initializing the database, then enable the server to start at boot:
91 sudo /usr/pgsql-11/bin/postgresql-11-setup initdb
92 sudo systemctl enable postgresql-11
95 # Next tune the postgresql configuration, which is located in
96 # `/var/lib/pgsql/data/postgresql.conf`. See section *Postgres Tuning* in
97 # [the installation page](../admin/Installation.md#postgresql-tuning)
98 # for the parameters to change.
100 # Now start the postgresql service after updating this config file.
102 sudo systemctl restart postgresql-11
105 # Finally, we need to add two postgres users: one for the user that does
106 # the import and another for the webserver which should access the database
110 sudo -u postgres createuser -s $USERNAME
111 sudo -u postgres createuser apache
114 # Setting up the Apache Webserver
115 # -------------------------------
117 # You need to create an alias to the website directory in your apache
118 # configuration. Add a separate nominatim configuration to your webserver:
121 sudo tee /etc/httpd/conf.d/nominatim.conf << EOFAPACHECONF
122 <Directory "$USERHOME/build/website">
123 Options FollowSymLinks MultiViews
124 AddType text/html .php
125 DirectoryIndex search.php
129 Alias /nominatim $USERHOME/build/website
133 sudo sed -i 's:#.*::' /etc/httpd/conf.d/nominatim.conf #DOCS:
139 sudo systemctl enable httpd
140 sudo systemctl restart httpd
144 # Installing Nominatim
145 # ====================
147 # Building and Configuration
148 # --------------------------
150 # Get the source code from Github and change into the source directory
152 if [ "x$1" == "xyes" ]; then #DOCS: :::sh
154 git clone --recursive git://github.com/openstreetmap/Nominatim.git
157 cd $USERHOME/Nominatim #DOCS:
160 # When installing the latest source from github, you also need to
161 # download the country grid:
163 if [ ! -f data/country_osm_grid.sql.gz ]; then #DOCS: :::sh
164 wget --no-verbose -O data/country_osm_grid.sql.gz https://www.nominatim.org/data/country_grid.sql.gz
167 # The code must be built in a separate directory. Create this directory,
168 # then configure and build Nominatim in there:
174 cmake $USERHOME/Nominatim
178 # Adding SELinux Security Settings
179 # --------------------------------
181 # It is a good idea to leave SELinux enabled and enforcing, particularly
182 # with a web server accessible from the Internet. At a minimum the
183 # following SELinux labeling should be done for Nominatim:
185 sudo semanage fcontext -a -t httpd_sys_content_t "$USERHOME/Nominatim/(website|lib|settings)(/.*)?"
186 sudo semanage fcontext -a -t httpd_sys_content_t "$USERHOME/build/(website|lib|settings)(/.*)?"
187 sudo semanage fcontext -a -t lib_t "$USERHOME/build/module/nominatim.so"
188 sudo restorecon -R -v $USERHOME/Nominatim
189 sudo restorecon -R -v $USERHOME/build
192 # You need to create a minimal configuration file that tells nominatim
193 # the name of your webserver user:
196 echo NOMINATIM_DATABASE_WEBUSER="apache" | tee .env
200 # Nominatim is now ready to use. Continue with
201 # [importing a database from OSM data](../admin/Import.md).