3 # *Note:* these installation instructions are also available in executable
4 # form for use with vagrant in the vagrant/ directory.
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 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 postgis postgis-utils \
23 git cmake make gcc gcc-c++ libtool policycoreutils-python \
24 php-pgsql php php-pear php-pear-DB libpqxx-devel proj-epsg \
25 bzip2-devel proj-devel geos-devel libxml2-devel boost-devel expat-devel zlib-devel
28 # System Configuration
29 # ====================
31 # The following steps are meant to configure a fresh CentOS installation
32 # for use with Nominatim. You may skip some of the steps if you have your
33 # OS already configured.
35 # Creating Dedicated User Accounts
36 # --------------------------------
38 # Nominatim will run as a global service on your machine. It is therefore
39 # best to install it under its own separate user account. In the following
40 # we assume this user is called nominatim and the installation will be in
41 # /srv/nominatim. To create the user and directory run:
43 # sudo useradd -d /srv/nominatim -s /bin/bash -m nominatim
45 # You may find a more suitable location if you wish.
47 # To be able to copy and paste instructions from this manual, export
48 # user name and home directory now like this:
50 export USERNAME=vagrant #DOCS: export USERNAME=nominatim
51 export USERHOME=/home/vagrant #DOCS: export USERHOME=/srv/nominatim
53 # **Never, ever run the installation as a root user.** You have been warned.
55 # Make sure that system servers can read from the home directory:
59 # Setting up PostgreSQL
60 # ---------------------
62 # CentOS does not automatically create a database cluster. Therefore, start
63 # with initializing the database, then enable the server to start at boot:
65 sudo postgresql-setup initdb
66 sudo systemctl enable postgresql
69 # Next tune the postgresql configuration, which is located in
70 # `/var/lib/pgsql/data/postgresql.conf`. See
71 # [the wiki](http://wiki.openstreetmap.org/wiki/Nominatim/Installation#PostgreSQL_Tuning_and_Configuration) for the parameters to change.
73 # Now start the postgresql service after updating this config file.
75 sudo systemctl restart postgresql
78 # Finally, we need to add two postgres users: one for the user that does
79 # the import and another for the webserver ro access the database:
82 sudo -u postgres createuser -s $USERNAME
83 sudo -u postgres createuser apache
86 # Setting up the Apache Webserver
87 # -------------------------------
89 # You need to create an alias to the website directory in your apache
90 # configuration. Add a separate nominatim configuration to your webserver:
93 sudo cat > /etc/httpd/conf.d/nominatim.conf << EOFAPACHECONF
94 <Directory "$USERHOME/build/website"> #DOCS:<Directory "$USERHOME/Nominatim/build/website">
95 Options FollowSymLinks MultiViews
96 AddType text/html .php
100 Alias /nominatim $USERHOME/build/website #DOCS:Alias /nominatim $USERHOME/Nominatim/build/website
104 sudo sed -i 's:#.*::' /etc/httpd/conf.d/nominatim.conf #DOCS:
110 sudo systemctl restart httpd
113 # Adding SELinux Security Settings
114 # --------------------------------
116 # It is a good idea to leave SELinux enabled and enforcing, particularly
117 # with a web server accessible from the Internet. At a minimum the
118 # following SELinux labeling should be done for Nominatim:
120 sudo semanage fcontext -a -t httpd_sys_content_t "$USERHOME/Nominatim/(website|lib|settings)(/.*)?"
121 sudo semanage fcontext -a -t lib_t "$USERHOME/Nominatim/module/nominatim.so"
122 sudo restorecon -R -v $USERHOME/Nominatim
125 # Installing Nominatim
126 # ====================
128 # Building and Configuration
129 # --------------------------
131 # Get the source code from Github and change into the source directory
133 if [ "x$CHECKOUT" == "xy" ]; then #DOCS:
136 sudo -u $USERNAME git clone --recursive git://github.com/twain47/Nominatim.git
143 # The code is built in a special directory. Create this directory,
144 # then configure and build Nominatim in there:
146 sudo -u $USERNAME mkdir build
148 sudo -u $USERNAME cmake $USERHOME/Nominatim
149 sudo -u $USERNAME make
151 # You need to create a minimal configuration file that tells nominatim
152 # the name of your webserver user:
155 sudo -u $USERNAME cat > settings/local.php << EOF
157 @define('CONST_Database_Web_User', 'apache');
162 Nominatim is now ready to use. Continue with
163 [importing a database from OSM data](Import_and_update.md).