You need to perform the following steps:
- Install postgres database with postgis extension
- Download osmosis and create the OpenStreetMap schema in the database
- Load a OSM dataset
- Run additional LinkedGeoData SQL scripts
- Install additional packages
- Configure done.
1) Install postgres database with postgis extension
Automated install-script for postgis-1.5.1 ```
Install postgres itself
sudo apt-get install postgresql
Install required libraries (easy part)
sudo apt-get install build-essential postgresql postgresql-server-dev-8.4 libxml2-dev libgeos-dev libproj-dev php5-pgsql
Restart the Apache Server
service apache2 restart
Go to the tmp directory
cd /tmp
Download more libraries
wget http://download.osgeo.org/geos/geos-3.2.2.tar.bz2 wget http://postgis.refractions.net/download/postgis-1.5.1.tar.gz
Extract and install geos
bzip2 -d geos-3.2.2.tar.bz2 tar -xvf geos-3.2.2.tar cd geos-3.2.2/ ./configure make make check sudo make install sudo ldconfig cd ..
Extract and install postgis
tar -zxvf postgis-1.5.1.tar.gz cd postgis-1.5.1/ ./configure make sudo make install sudo ldconfig ```
```
Ahhh! BUG! The sudo does not seem to work on the script
but rather the shell that invoked it,
so the subsequent statements fail
Set up templates
cd /usr/share/postgresql/8.4/contrib/postgis-1.5/
sudo su postgres createdb template_postgis_1_5 createlang plpgsql template_postgis_1_5 psql -d template_postgis_1_5 -fpostgis.sql psql -d template_postgis_1_5 -fspatial_ref_sys.sql
Done!
```
2) Download osmosis and create the OpenStreetMap schema in the database http://dev.openstreetmap.org/~bretth/osmosis-build/osmosis-latest.tgz
First we need create the LGD database
createdb lgd -T template_postgis_1_5
The scripts for the SQL schema are located in
<osmosis-root>
/scripts.
psql -dlgd -f pgsql_simple_schema_0.6.sql
psql -dlgd -f pgsql_simple_schema_0.6_linestring.sql
3) Load a OSM dataset
for instances the one that is already in the svn:
<svnroot>/data/test/osm/bremen.osm.bz2
Loading the file with osmosis: ```
maybe you need to set the password first
psql -Upostgres ALTER USER postgres WITH PASSWORD "postgres"; ALTER TABLE node_tags ADD COLUMN geom Geography; UPDATE node_tags nt SET geom = (SELECT n.geom FROM nodes n WHERE n.id = nt.node_id); CREATE INDEX idx_node_tags_geom ON node_tags USING GIST(geom); \q bzcat | osmosis --read-xml - --write-pgsql host="localhost" database="lgd" user="postgres" password="postgres" ```
4) Run additional LinkedGeoData SQL scripts
These scripts are located in <svnroot>/data/lgd/sql
```
psql -dlgd -f Core.sql
psql -dlgd -f GeographyConversion.sql
psql -dlgd -f Tiles.sql psql -dlgd -f tilekv.sql psql -dlgd -f tilek.sql ```
5) Install additional packages
The browser requires the PHP package that provides the PDO database abstraction class.
sudo apt-get install php-db php5-pgsql
6 Configure
The database connection for the browser is (currently) configured in
<svnroot>/main/php/lgdbrowser/inc.php
This needs to be changed accordingly.