Log of an installation of libexodus on Centos 5.3: Difference between revisions
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
sudo yum update | sudo yum update | ||
sudo yum install boost-devel postgresql-devel gcc-c++ subversion postgresql-server | sudo yum install boost-devel postgresql-devel gcc-c++ subversion postgresql-server | ||
sudo | sudo /etc/init.d/ postgresql start | ||
=== Exodus === | === Exodus === | ||
Line 49: | Line 49: | ||
27 JUN 2009 | 27 JUN 2009 | ||
27 JUN 2009 | 27 JUN 2009 | ||
=== Setting up Postgres for Exodus === | |||
become user postgres and get into postgres command prompt | |||
sudo su - postgres | |||
psql | |||
create a user and database for exodus. Use the given password for now. | |||
CREATE ROLE exodus LOGIN | |||
PASSWORD 'somesillysecret' | |||
CREATEDB CREATEROLE; | |||
CREATE DATABASE exodus | |||
WITH ENCODING='UTF8' | |||
OWNER=exodus; | |||
\connect exodus | |||
{{postgres function installation}} | |||
Check the functions loaded properly (count them) | |||
\df exodus* | |||
<pre> | |||
List of functions | |||
Schema | Name | Result data type | Argument data types | |||
--------+-------------------------+-----------------------------+----------------------------------------------------- | |||
public | exodus_call | bytea | bytea, bytea, bytea, bytea, bytea, integer, integer | |||
public | exodus_extract_bytea | bytea | bytea, integer, integer, integer | |||
public | exodus_extract_date | date | bytea, integer, integer, integer | |||
public | exodus_extract_datetime | timestamp without time zone | bytea, integer, integer, integer | |||
public | exodus_extract_sort | text | bytea, integer, integer, integer | |||
public | exodus_extract_text | text | bytea, integer, integer, integer | |||
public | exodus_extract_text2 | text | bytea, integer, integer, integer | |||
public | exodus_extract_time | time without time zone | bytea, integer, integer, integer | |||
(8 rows) | |||
</pre> | |||
For more information see http://www.postgresql.org/docs/8.1/static/app-psql.html | |||
Quit postgres command prompt | |||
\q | |||
Unless you are only going to run Exodus as user "exodus" from the local machine, grant login from 127.0.0.1 using username/unencrypted password (instead of only logged-in username without password) | |||
For more info see http://developer.postgresql.org/pgdocs/postgres/auth-pg-hba-conf.html | |||
nano ~/data/pg_hba.conf | |||
or for Ubuntu | |||
sudo nano /etc/postgresql/8.3/main/pg_hba.conf | |||
comment out the following lines. NB DONT comment out any other similar lines esp. ones containining "postgres" | |||
#local all all ident sameuser | |||
#host all all 127.0.0.1/32 ident sameuser | |||
and add these lines | |||
local all all password | |||
host all all 127.0.0.1/32 password | |||
hostssl all all 0.0.0.0/0 password | |||
quit postgres user | |||
exit | |||
Reload Postgres | |||
sudo /etc/init.d/postgresql reload | |||
or | |||
sudo /etc/init.d/postgresql-8.3 restart |
Revision as of 15:10, 11 July 2009
Preparation
sudo yum update sudo yum install boost-devel postgresql-devel gcc-c++ subversion postgresql-server sudo /etc/init.d/ postgresql start
Exodus
cd ~ mkdir exodus cd exodus svn co http://svn.neosys.com/svn/trunk cd trunk/exodus
./configure make sudo make install
sudo nano /etc/ld.so.conf
... and add the following line (note: NO preceding word include)
/usr/local/lib
register the new libraries
sudo /sbin/ldconfig
make a pointer to the include files
sudo ln -s /usr/local/include/exodus-9.6/exodus /usr/local/include/exodus
Testing
nano tester.cpp
#include <exodus/exodus.h> int main() { date().oconv("D").outputln(); print(oconv(date(),"D")); }
g++ tester.cpp -lexodus -I/usr/local/include/exodus
./a.out
27 JUN 2009 27 JUN 2009
Setting up Postgres for Exodus
become user postgres and get into postgres command prompt
sudo su - postgres
psql
create a user and database for exodus. Use the given password for now.
CREATE ROLE exodus LOGIN PASSWORD 'somesillysecret' CREATEDB CREATEROLE; CREATE DATABASE exodus WITH ENCODING='UTF8' OWNER=exodus;
\connect exodus
-- cut and paste the following SQL to register the functions into postgres --
CREATE OR REPLACE FUNCTION exodus_call(bytea, bytea, bytea, bytea, bytea, int4, int4) RETURNS bytea AS 'pgexodus', 'exodus_call' LANGUAGE C IMMUTABLE;
CREATE OR REPLACE FUNCTION exodus_extract_bytea(bytea, int4, int4, int4) RETURNS bytea AS 'pgexodus', 'exodus_extract_bytea' LANGUAGE C IMMUTABLE;
CREATE OR REPLACE FUNCTION exodus_extract_text(bytea, int4, int4, int4) RETURNS text AS 'pgexodus', 'exodus_extract_text' LANGUAGE C IMMUTABLE;
CREATE OR REPLACE FUNCTION exodus_extract_sort(bytea, int4, int4, int4) RETURNS text AS 'pgexodus', 'exodus_extract_sort' LANGUAGE C IMMUTABLE;
-- Remaining functions are STRICT therefore never get called with NULLS -- also return NULL if passed zero length strings
CREATE OR REPLACE FUNCTION exodus_extract_text2(bytea, int4, int4, int4) RETURNS text AS 'pgexodus', 'exodus_extract_text2' LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION exodus_extract_date(bytea, int4, int4, int4) RETURNS date AS 'pgexodus', 'exodus_extract_date' LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION exodus_extract_time(bytea, int4, int4, int4) RETURNS time AS 'pgexodus', 'exodus_extract_time' LANGUAGE C IMMUTABLE STRICT;
CREATE OR REPLACE FUNCTION exodus_extract_datetime(bytea, int4, int4, int4) RETURNS timestamp AS 'pgexodus', 'exodus_extract_datetime' LANGUAGE C IMMUTABLE STRICT;
Check the functions loaded properly (count them)
\df exodus*
List of functions Schema | Name | Result data type | Argument data types --------+-------------------------+-----------------------------+----------------------------------------------------- public | exodus_call | bytea | bytea, bytea, bytea, bytea, bytea, integer, integer public | exodus_extract_bytea | bytea | bytea, integer, integer, integer public | exodus_extract_date | date | bytea, integer, integer, integer public | exodus_extract_datetime | timestamp without time zone | bytea, integer, integer, integer public | exodus_extract_sort | text | bytea, integer, integer, integer public | exodus_extract_text | text | bytea, integer, integer, integer public | exodus_extract_text2 | text | bytea, integer, integer, integer public | exodus_extract_time | time without time zone | bytea, integer, integer, integer (8 rows)
For more information see http://www.postgresql.org/docs/8.1/static/app-psql.html
Quit postgres command prompt
\q
Unless you are only going to run Exodus as user "exodus" from the local machine, grant login from 127.0.0.1 using username/unencrypted password (instead of only logged-in username without password)
For more info see http://developer.postgresql.org/pgdocs/postgres/auth-pg-hba-conf.html
nano ~/data/pg_hba.conf
or for Ubuntu
sudo nano /etc/postgresql/8.3/main/pg_hba.conf
comment out the following lines. NB DONT comment out any other similar lines esp. ones containining "postgres"
#local all all ident sameuser #host all all 127.0.0.1/32 ident sameuser
and add these lines
local all all password host all all 127.0.0.1/32 password hostssl all all 0.0.0.0/0 password
quit postgres user
exit
Reload Postgres
sudo /etc/init.d/postgresql reload or sudo /etc/init.d/postgresql-8.3 restart