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 # ================================
9 # These instructions expect that you have a freshly installed CentOS version 7.
10 # Make sure all packages are up-to-date by running:
14 # The standard CentOS repositories don't contain all the required packages,
15 # you need to enable the EPEL repository as well. To enable it on CentOS,
16 # install the epel-release RPM by running:
18 sudo yum install -y epel-release
20 # Now you can install all packages needed for Nominatim:
22 sudo yum install -y postgresql-server postgresql-contrib postgresql-devel \
23 postgis postgis-utils \
24 git cmake make gcc gcc-c++ libtool policycoreutils-python \
25 php-pgsql php php-pear php-pear-DB php-intl libpqxx-devel \
26 proj-epsg bzip2-devel proj-devel libxml2-devel boost-devel \
27 expat-devel zlib-devel
29 # If you want to run the test suite, you need to install the following
30 # additional packages:
32 sudo yum install -y python34-pip python34-setuptools python34-devel \
34 pip3 install --user behave nose pytidylib psycopg2
35 sudo pear install PHP_CodeSniffer
38 # System Configuration
39 # ====================
41 # The following steps are meant to configure a fresh CentOS installation
42 # for use with Nominatim. You may skip some of the steps if you have your
43 # OS already configured.
45 # Creating Dedicated User Accounts
46 # --------------------------------
48 # Nominatim will run as a global service on your machine. It is therefore
49 # best to install it under its own separate user account. In the following
50 # we assume this user is called nominatim and the installation will be in
51 # /srv/nominatim. To create the user and directory run:
53 # sudo useradd -d /srv/nominatim -s /bin/bash -m nominatim
55 # You may find a more suitable location if you wish.
57 # To be able to copy and paste instructions from this manual, export
58 # user name and home directory now like this:
60 export USERNAME=vagrant #DOCS: export USERNAME=nominatim
61 export USERHOME=/home/vagrant #DOCS: export USERHOME=/srv/nominatim
63 # **Never, ever run the installation as a root user.** You have been warned.
65 # Make sure that system servers can read from the home directory:
69 # Setting up PostgreSQL
70 # ---------------------
72 # CentOS does not automatically create a database cluster. Therefore, start
73 # with initializing the database, then enable the server to start at boot:
75 sudo postgresql-setup initdb
76 sudo systemctl enable postgresql
79 # Next tune the postgresql configuration, which is located in
80 # `/var/lib/pgsql/data/postgresql.conf`. See section *Postgres Tuning* in
81 # [the installation page](../admin/Installation.md#postgresql-tuning)
82 # for the parameters to change.
84 # Now start the postgresql service after updating this config file.
86 sudo systemctl restart postgresql
89 # Finally, we need to add two postgres users: one for the user that does
90 # the import and another for the webserver which should access the database
94 sudo -u postgres createuser -s $USERNAME
95 sudo -u postgres createuser apache
98 # Setting up the Apache Webserver
99 # -------------------------------
101 # You need to create an alias to the website directory in your apache
102 # configuration. Add a separate nominatim configuration to your webserver:
105 sudo tee /etc/httpd/conf.d/nominatim.conf << EOFAPACHECONF
106 <Directory "$USERHOME/build/website"> #DOCS:<Directory "$USERHOME/Nominatim/build/website">
107 Options FollowSymLinks MultiViews
108 AddType text/html .php
109 DirectoryIndex search.php
113 Alias /nominatim $USERHOME/build/website #DOCS:Alias /nominatim $USERHOME/Nominatim/build/website
117 sudo sed -i 's:#.*::' /etc/httpd/conf.d/nominatim.conf #DOCS:
123 sudo systemctl restart httpd
126 # Adding SELinux Security Settings
127 # --------------------------------
129 # It is a good idea to leave SELinux enabled and enforcing, particularly
130 # with a web server accessible from the Internet. At a minimum the
131 # following SELinux labeling should be done for Nominatim:
133 sudo semanage fcontext -a -t httpd_sys_content_t "$USERHOME/Nominatim/(website|lib|settings)(/.*)?"
134 sudo semanage fcontext -a -t lib_t "$USERHOME/Nominatim/module/nominatim.so"
135 sudo restorecon -R -v $USERHOME/Nominatim
138 # Installing Nominatim
139 # ====================
141 # Building and Configuration
142 # --------------------------
144 # Get the source code from Github and change into the source directory
146 if [ "x$1" == "xyes" ]; then #DOCS:
149 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:
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:
169 cmake $USERHOME/Nominatim
172 # You need to create a minimal configuration file that tells nominatim
173 # the name of your webserver user and the URL of the website:
176 tee settings/local.php << EOF
178 @define('CONST_Database_Web_User', 'apache');
179 @define('CONST_Website_BaseURL', '/nominatim/');
184 # Nominatim is now ready to use. Continue with
185 # [importing a database from OSM data](../admin/Import-and-Update.md).