I. software required:
To compile and run nominatim software in Ubuntu, you must install the following software:
1. GCC compiler
2. PostgreSQL database
3. proj4
4. geos
5. postgis
6. php
7. php-pgsql
8. Pear: DB
9. protobuf
10. wget
11. osmis
2. install necessary software packages
Apt-Get install build-essential libxml2-dev libgeos-dev libpq-devlibbz2-dev
Apt-Get install GCC proj-bin libgeos-c1 osmis
Apt-Get install PhP5 PHP-pear php5-pgsql php5-json PHP-DB
Apt-Get install PostgreSQL postgis postgresql-contribpostgresql-9.3-postgis
Because the imported geographic data format is PBF, PBF support software must be installed.
Apt-Get install libprotobuf-c0-dev protobuf-C-Compiler
In the Debian system, another package is required for running geos.
Apt-Get install libgeos ++-Dev
PostgreSQL Configuration:
Open the PostgreSQL. conf file in/etc/PostgreSQL/9.3/main and set the following attributes:
Fsync = off
Full_page_writes = off
The specific command is:
PostgreSQL. conf in sudo Vim/etc/PostgreSQL/9.3/main
3. Install nominatim1. download source code
Wget http://www.nominatim.org/release/Nominatim-2.2.0.tar.bz2
Tar xvf Nominatim-2.2.0.tar.bz2
CD Nominatim-2.2.0
./Sutogen. Sh
./Configure
Make
2. Create a local. php file in the settings directory of the nominatim directory,
The configuration is as follows:
<? PHP
// Paths
@ Define ('const _ postgresql_version ', '9. 3 ');
@ Define ('const _ postgis_version ', '2. 1 ');
@ Define ('const _ website_baseurl', 'HTTP: // localhost/nominatim /');
3. Create an ipvs User Account:
1. Create an import account
Adduser <user name, example: mypg>
Passwd <password>
Su-Postgres
Psql-template1
Switch to the database interaction interface and run the following command:
Create user <user name, example: mypg> with password <password>
Exit the database interaction interface and enter the command \ Q.
Switch to root
Create a Website user:
Createuser-SDR www-Data
Change the read permission of nominatim:
Chmod + x/soft_src
Chmod + x/soft_src/Nominatim-2.2.0
Chmod + x/soft_src/Nominatim-2.2.0/Module
Import the downloaded OSM data and create an index for it:
The data download address is (PBF format ):
Http://download.geofabrik.de/openstreetmap/
Import PBF data:
./Nominatim-2.2.0/utils/setup. php -- OSM-file <self-downloaded PBF data, Shanghai. OSM. PBF> -- all [-- osm2pgsql-cache]
Add additional fields:
../Nominatim-2.2.0/utils/specialphrases. php-countries> specialphrases_countries. SQL
Psql-D nominatim-F specialphrases_countries. SQL
./Nominatim-2.2.0/utils/specialphrases. php-wiki-import> specialphrases. SQL
Psql-D nominatim-F specialphrases. SQL
Website creation:
Sudo mkdir-M 755/var/www/nominatim
Sudo chown <your username>/var/www/nominatim
./Utils/setup. php -- create-website/var/www/nominatim
Configure the Apache environment:
Open/etc/apache2/sites-enabled/000-default and add the following content at the end:
<Directory "/var/www/nominatim/">
Options followsymlinks Multiviews
Addtype text/html. php
</Directory>
Restart the apache service:
Service apache2 restart
Add the database nominatim permission of mypg:
Su-Postgres
Psql template1
Grant all privileges on Database nominatim to mypg
\ Q
4. Run nominatim
Browser Logon: http: // localhost/nominatim/
Check whether the WWW-data user has the database read and write permissions. If not, open/etc/apache2/envvars and modify
Export apache_run_user = mypg
Export apache_run_group = mypg