source: subversion/sites/rails_port/db/README @ 14586

Last change on this file since 14586 was 14586, checked in by tomhughes, 11 years ago

Merge api06 branch to trunk.

File size: 2.0 KB
Line 
1Creating database
2===================
3
4OSM server uses a database with the following name:
5
6openstreetmap
7
8You may create it with your preferable client or run next (linux) command:
9
10$ mysql -u <uid> -p
11
12(change <uid> with appropriate username of administrative user eg. root )
13
14> create database openstreetmap default character set utf8;
15> exit
16
17Creating user, password, and access rights
18============================================
19
20$ mysql -u <uid> -p
21
22(change <uid> with appropriate username of administrative user eg. root )
23
24> grant all privileges on openstreetmap.* to 'openstreetmap'@'localhost' identified by 'openstreetmap';
25> flush privileges;
26> exit
27
28Creating functions For MySQL
29==============================
30
31Run this command in the db/functions directory:
32
33$ make libmyosm.so
34
35Make sure the db/functions directory is on the MySQL server's library
36path and restart the MySQL server.
37
38On Linux the easiest way to do this is to create /etc/ld.so.conf.d/osm.conf, and place the path to the db/functions directory in it and then run the ldconfig command as root.
39
40On OS X: sudo ln -s /path_to_your_osm_install/sites/rails_port/db/functions/libmyosm.so /usr/local/lib/libmyosm.so
41
42Now create the functions as follows:
43
44$ mysql -u <uid> -p openstreetmap
45
46(change <uid> with appropriate username of administrative user eg. root )
47
48> create function tile_for_point returns integer soname 'libmyosm.so';
49> create function maptile_for_point returns integer soname 'libmyosm.so';
50> exit
51
52Creating functions for PgSQL
53==============================
54
55Run this command in the db/functions directory:
56
57$ make libpgosm.so
58
59Now create the function as follows:
60
61$ psql openstreetmap
62(This may need authentication or a -u <dbowneruid>)
63
64> CREATE FUNCTION maptile_for_point(int8, int8, int4) RETURNS int4
65  AS '/path/to/rails-port/db/functions/libpgosm.so', 'maptile_for_point'
66  LANGUAGE C STRICT;
67
68Creating database skeleton tables
69===================================
70
71Run this command from the root of your rails directory:
72
73$ rake db:migrate
74
75This will create the db for you
Note: See TracBrowser for help on using the repository browser.