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 # Setting up PostgreSQL
56 # ---------------------
58 # CentOS does not automatically create a database cluster. Therefore, start
59 # with initializing the database, then enable the server to start at boot:
61 sudo postgresql-setup initdb
62 sudo systemctl enable postgresql
65 # Next tune the postgresql configuration, which is located in
66 # `/var/lib/pgsql/data/postgresql.conf`. See
67 # [the wiki](http://wiki.openstreetmap.org/wiki/Nominatim/Installation#PostgreSQL_Tuning_and_Configuration) for the parameters to change.
69 # Now start the postgresql service after updating this config file.
71 sudo systemctl restart postgresql
74 # Finally, we need to add two postgres users: one for the user that does
75 # the import and another for the webserver ro access the database:
78 sudo -u postgres createuser -s $USERNAME
79 sudo -u postgres createuser apache
82 # Setting up the Apache Webserver
83 # -------------------------------
85 # You need to create an alias to the website directory in your apache
86 # configuration. Add a separate nominatim configuration to your webserver:
89 sudo cat > /etc/httpd/conf.d/nominatim.conf << EOFAPACHECONF
90 <Directory "$USERHOME/build/website"> #DOCS:<Directory "$USERHOME/Nominatim/build/website">
91 Options FollowSymLinks MultiViews
92 AddType text/html .php
95 Alias /nominatim $USERHOME/build/website #DOCS:Alias /nominatim $USERHOME/Nominatim/build/website
99 sudo sed -i 's:#.*::' /etc/httpd/conf.d/nominatim.conf #DOCS:
105 sudo systemctl restart httpd
108 # Adding SELinux Security Settings
109 # --------------------------------
111 # It is a good idea to leave SELinux enabled and enforcing, particularly
112 # with a web server accessible from the Internet. At a minimum the
113 # following SELinux labeling should be done for Nominatim:
115 sudo semanage fcontext -a -t httpd_sys_content_t "$USERHOME/Nominatim/(website|lib|settings)(/.*)?"
116 sudo semanage fcontext -a -t lib_t "$USERHOME/Nominatim/module/nominatim.so"
117 sudo restorecon -R -v $USERHOME/Nominatim
120 # Installing Nominatim
121 # ====================
123 # Building and Configuration
124 # --------------------------
126 # Get the source code from Github and change into the source directory
128 if [ "x$CHECKOUT" == "xy" ]; then #DOCS:
131 sudo -u $USERNAME git clone --recursive git://github.com/twain47/Nominatim.git
138 # The code is built in a special directory. Create this directory,
139 # then configure and build Nominatim in there:
141 sudo -u $USERNAME mkdir build
143 sudo -u $USERNAME cmake $USERHOME/Nominatim
144 sudo -u $USERNAME make
146 # You need to create a minimal configuration file that tells nominatim
147 # the name of your webserver user:
150 sudo -u $USERNAME cat > settings/local.php << EOF
152 @define('CONST_Database_Web_User', 'apache');
157 Nominatim is now ready to use. Continue with
158 [importing a database from OSM data](Import_and_update.md).