閱讀787 返回首頁    go 阿裏雲 go 技術社區[雲棲]


Ubuntu 14.04安裝地裏編碼軟件Nominatim過程

.必須軟件:

Ubuntu係統編譯運行Nominatim軟件係統必須安裝的軟件有:

1.GCC 編譯器

2.postgresql 數據庫

3.proj4

4.geos

5.postgis

6.PHP

7.PHP-pgsql

8.PEAR::DB

9.protobuf

10.wget

11.osmis

.安裝必須的軟件包

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

由於導入的地理數據格式為pbf,所以需要安裝pbf支持軟件

apt-get install libprotobuf-c0-dev protobuf-c-compiler

debian係統中,geos運行需要另一個包

apt-get install libgeos++-dev

postgresql配置:

打開/etc/postgresql/9.3/main中的postgresql.conf文件,設置如下屬性:

fsync = off

full_page_writes = off

具體命令為:

sudo vim /etc/postgresql/9.3/main中的postgresql.conf

.安裝Nominatim

1.下載源碼

wget https://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.Nominatim目錄中的settings目錄裏新建local.php文件,

配置如下:

<?php

// Paths

@define('CONST_Postgresql_Version', '9.3');

@define('CONST_Postgis_Version', '2.1');

@define('CONST_Website_BaseURL', 'https://localhost/nominatim/');



3.新建postgres用戶賬戶:

1.新建導入賬戶

adduser <自己的用戶名,example:mypg>

passwd <密碼>

su – postgres

psql -template1

界麵切換到數據庫的交互界麵,敲入如下命令:

CREATE USER <自己的用戶名,example:mypg>WITH PASSWORD <密碼>

退出數據庫交互界麵,敲入命令:\q

切換到root

新建網站用戶:

createuser -SDR www-data

更改nominatim的讀取權限:

chmod +x /soft_src

chmod +x /soft_src/Nominatim-2.2.0

chmod +x /soft_src/Nominatim-2.2.0/module

倒入下載的OSM數據,並為其建立索引:

下載數據地址為(pbf格式):

https://download.geofabrik.de/openstreetmap/

導入pbf數據:

./Nominatim-2.2.0/utils/setup.php --osm-file<自己下載的pbf數據,shanghai.osm.pbf>--all [--osm2pgsql-cache ]

添加額外字段:

./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

建立網站:

sudo mkdir -m 755 /var/www/nominatim

sudo chown <your username> /var/www/nominatim

./utils/setup.php --create-website /var/www/nominatim

配置apache環境:

打開/etc/apache2/sites-enabled/000-default,在最後添加如下內容:

<Directory "/var/www/nominatim/">

Options FollowSymLinks MultiViews

AddType text/html .php

</Directory>

重啟apache服務:

service apache2 restart

增加mypg對數據庫nominatim的權限:

su – postgres

psql template1

GRANT ALL PRIVILEGES ON DATABASE nominatim to mypg

\q



4.運行nominatim

瀏覽器登陸:https://https://localhost/nominatim/

www-data用戶有沒有數據庫讀寫權限,若沒有,則打開/etc/apache2/envvars,修改

export APACHE_RUN_USER=mypg

export APACHE_RUN_GROUP=mypg

最後更新:2017-04-03 05:39:50

  上一篇:go HDU1203-I NEED A OFFER!
  下一篇:go RAPIDIO高速串行協議