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 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
27 # If you want to run the test suite, you need to install the following
28 # additional packages:
30 sudo yum install -y python-pip python-Levenshtein python-psycopg2 \
31 python-numpy php-phpunit-PHPUnit
32 pip install --user --upgrade pip setuptools lettuce==0.2.18 six==1.9 \
33 haversine Shapely pytidylib
36 # System Configuration
37 # ====================
39 # The following steps are meant to configure a fresh CentOS installation
40 # for use with Nominatim. You may skip some of the steps if you have your
41 # OS already configured.
43 # Creating Dedicated User Accounts
44 # --------------------------------
46 # Nominatim will run as a global service on your machine. It is therefore
47 # best to install it under its own separate user account. In the following
48 # we assume this user is called nominatim and the installation will be in
49 # /srv/nominatim. To create the user and directory run:
51 # sudo useradd -d /srv/nominatim -s /bin/bash -m nominatim
53 # You may find a more suitable location if you wish.
55 # To be able to copy and paste instructions from this manual, export
56 # user name and home directory now like this:
58 export USERNAME=vagrant #DOCS: export USERNAME=nominatim
59 export USERHOME=/home/vagrant #DOCS: export USERHOME=/srv/nominatim
61 # **Never, ever run the installation as a root user.** You have been warned.
63 # Make sure that system servers can read from the home directory:
67 # Setting up PostgreSQL
68 # ---------------------
70 # CentOS does not automatically create a database cluster. Therefore, start
71 # with initializing the database, then enable the server to start at boot:
73 sudo postgresql-setup initdb
74 sudo systemctl enable postgresql
77 # Next tune the postgresql configuration, which is located in
78 # `/var/lib/pgsql/data/postgresql.conf`. See section *Postgres Tuning* in
79 # [the installation page](Installation.md) for the parameters to change.
81 # Now start the postgresql service after updating this config file.
83 sudo systemctl restart postgresql
86 # Finally, we need to add two postgres users: one for the user that does
87 # the import and another for the webserver which should access the database
91 sudo -u postgres createuser -s $USERNAME
92 sudo -u postgres createuser apache
95 # Setting up the Apache Webserver
96 # -------------------------------
98 # You need to create an alias to the website directory in your apache
99 # configuration. Add a separate nominatim configuration to your webserver:
102 sudo tee /etc/httpd/conf.d/nominatim.conf << EOFAPACHECONF
103 <Directory "$USERHOME/build/website"> #DOCS:<Directory "$USERHOME/Nominatim/build/website">
104 Options FollowSymLinks MultiViews
105 AddType text/html .php
109 Alias /nominatim $USERHOME/build/website #DOCS:Alias /nominatim $USERHOME/Nominatim/build/website
113 sudo sed -i 's:#.*::' /etc/httpd/conf.d/nominatim.conf #DOCS:
119 sudo systemctl restart httpd
122 # Adding SELinux Security Settings
123 # --------------------------------
125 # It is a good idea to leave SELinux enabled and enforcing, particularly
126 # with a web server accessible from the Internet. At a minimum the
127 # following SELinux labeling should be done for Nominatim:
129 sudo semanage fcontext -a -t httpd_sys_content_t "$USERHOME/Nominatim/(website|lib|settings)(/.*)?"
130 sudo semanage fcontext -a -t lib_t "$USERHOME/Nominatim/module/nominatim.so"
131 sudo restorecon -R -v $USERHOME/Nominatim
134 # Installing Nominatim
135 # ====================
137 # Building and Configuration
138 # --------------------------
140 # Get the source code from Github and change into the source directory
142 if [ "x$1" == "xyes" ]; then #DOCS:
145 git clone --recursive git://github.com/twain47/Nominatim.git
152 # The code must be built in a separate directory. Create this directory,
153 # then configure and build Nominatim in there:
157 cmake $USERHOME/Nominatim
160 # You need to create a minimal configuration file that tells nominatim
161 # the name of your webserver user and the URL of the website:
164 tee settings/local.php << EOF
166 @define('CONST_Database_Web_User', 'apache');
167 @define('CONST_Website_BaseURL', '/nominatim/');
172 # Nominatim is now ready to use. Continue with
173 # [importing a database from OSM data](Import_and_update.md).