Linux: Difference between revisions

From NEOSYS Dev Wiki
Jump to navigationJump to search
No edit summary
Line 1: Line 1:
== Building and Installing libexodus ==
== Building and Installing Exodus ==
 
requires Boost >= 1.32 and Postgres >= 8.1
 
Following steps are from Centos 5.2/Boost 1.38/Postgres 8.3/Gnu Compiler 4.1.2
 
alternatively:


[[Log of an installation of libexodus on Ubuntu 8.04.1 LTS]]
[[Log of an installation of libexodus on Ubuntu 8.04.1 LTS]]
Line 13: Line 7:
[[Log of an installation of libexodus on Centos 5.3]]
[[Log of an installation of libexodus on Centos 5.3]]


=== libexodus Dependencies ===
=== exodus Dependencies ===
 
==== Installing g++ compiler ====


yum list|grep gcc
==== Building Boost from Source ====


yum install gcc-c++.i386
Boost binaries are available for most platform but it can be easier to build from source as follows:


or for Ubuntu
Minimum required is boost 1_32. Here we install 1.38.
sudo aptitude install build-essential
 
==== Installing Boost ====
 
Minimum required is boost 1_35. Here we install 1.38.
 
---


Optionally get ICU to fully support unicode in boost regex
Optionally get ICU to fully support unicode in boost regex


Centos
  yum install libicu-devel
  yum install libicu-devel
 
Ubuntu
or on Ubuntu
 
  apt-get install libicu-dev
  apt-get install libicu-dev


Line 53: Line 37:
  BJAM_CONFIG= xxxxxxxxxxxxx -j4 variant=release link=shared
  BJAM_CONFIG= xxxxxxxxxxxxx -j4 variant=release link=shared


Build Boost
Build and install Boost


  make
  make
sudo make install


Install Boost after becoming superuser
Centos - Add "/usr/local/lib" to the list of lib directories to ensure that the boost libs can be found.
 
su
 
make install
 
Skip to the next section if on Ubuntu, this part is unnecessary.
 
Add "/usr/local/lib" to the list of lib directories to ensure that the boost libs can be found.


  nano /etc/ld.so.conf
  sudo nano /etc/ld.so.conf


Ensure the new config is operational.
Ensure the new boost libraries are registered for use.


  ldconfig
  sudo /sbin/ldconfig


Ensure boost includes can be found. This step might be eliminated in a better Exodos installer.
Ensure boost includes can be found. This step might be eliminated in a better Exodos installer.


  ln -s /usr/local/include/boost-1_38/boost /usr/local/include/boost
  sudo ln -s /usr/local/include/boost-1_38/boost /usr/local/include/boost
 
Quit superuser
 
exit
 
==== Installing Postgres ====
 
Version 8.3
 
yum install postgresql-devel
 
or on Ubuntu
 
sudo aptitude install libpq-dev
 
Locate libpq-fe.h to check. Probably in /usr/include/postgresql/ or /usr/include/postgresql/8.3/server/ on Ubuntu
 
updatedb
locate libpq-fe.h
 
=== Downloading and Building libexodus ===
 
libexodus.so is a shared library that allows you to write c++ programs with the style and semantics of pick basic. If you want traditional pick-like dictionary based sort/select/index it requires pgexodus to be built and installed too.
 
To give some insight into the automatic procedure see [[Manual Building with g++]]
 
Either download Exodus using Subversion (recommended - latest version)
 
cd ~
mkdir exodus
cd exodus
svn co http://svn.neosys.com/svn/trunk
cd trunk/exodus/exodus
 
or download a tarball (may be out of date)
 
cd ~
wget http://devwiki.neosys.com/images/2/2a/Exodus-9.6.0.tar.gz
tar xvfz Exodus-9.6.0.tar.gz
cd exodus-9.6.0
 
Build and Install
 
./configure
make
make install
 
A couple of installation steps that unfortunately have to be done by hand at the moment.
 
ldconfig
ln -s /usr/local/include/exodus-9.6/exodus /usr/local/include/exodus
 
Test that you can down develop in c++ with Exodus. The libs and includes will no longer be required with a better installer.
 
nano tester.cpp
 
<pre>
#include <exodus/exodus.h>
int main() {
date().oconv("D").outputln();
}
</pre>
 
g++ tester.cpp -lexodus -I/usr/local/include/exodus
./a.out
25 JUN 2009
 
== Building and Installing pgexodus ==
 
pgexodus.so is a shared library addin c function for postgres to perform sort/select/index functions otherwise it is not required.
 
=== pgexodus Dependencies ===
 
==== Installing Postgres ====
 
Version 8.3
 
yum install postgresql
yum install postgresql-devel
 
or on Ubuntu
 
sudo aptitude install postgresql-8.3
sudo aptitude install postgresql-dev
sudo aptitude install libpq-dev
 
Locate fmgr.h to check. Probably in /usr/include/postgresql/ or /usr/include/postgresql/8.3/server/ on Ubuntu
 
updatedb
locate fmgr.h
 
=== Building pgexodus ===
 
Currently hand built without even a make file.  standard configure/make using autoconf/automake will be available soon http://www.lrde.epita.fr/~adl/dl/autotools.pdf
 
here are some old manual  [[pgexodus handbuilding instructions]]
 
check you have access to the pg_config program
 
pg_config
 
if not, do something like the following, depending on where your Postgres is installed.
 
PATH=/Library/PostgreSQL/8.3/bin/:$PATH
pg_config
 
Do the classic configure, make, make install procedure
 
cd ~/exodus/trunk/exodus/pgexodus
./configure
make
sudo make install
 
=== Installing pgexodus ===
 
Register the c functions in postgres
 
sudo su - postgres
 
psql
\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>
 
Quit postgres command prompt and quite postgres user
 
\q
exit
 
For more information see http://www.postgresql.org/docs/8.1/static/app-psql.html
 
=== 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;
 
#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
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
 
for redhat/centos
service postgresql reload
or for Ubuntu
sudo /etc/init.d/postgresql restart
or
sudo /etc/init.d/postgresql-8.3 restart


== Building service ==
== Building service ==

Revision as of 21:56, 11 July 2009

Building and Installing Exodus

Log of an installation of libexodus on Ubuntu 8.04.1 LTS

Log of an installation of libexodus on Ubuntu 9.04 Jaunty Jackalope

Log of an installation of libexodus on Centos 5.3

exodus Dependencies

Building Boost from Source

Boost binaries are available for most platform but it can be easier to build from source as follows:

Minimum required is boost 1_32. Here we install 1.38.

Optionally get ICU to fully support unicode in boost regex

Centos

yum install libicu-devel

Ubuntu

apt-get install libicu-dev

Download and unpack Boost Source

wget http://downloads.sourceforge.net/boost/boost_1_38_0.tar.bz2
tar xvf boost_1_38_0.tar.bz2
cd boost_1_38_0
./configure --help
./configure --with-libraries=date_time,filesystem,iostreams,program_options,regex,system,thread

Speed up the build of Boost by only doing the libraries and versions required. ADD additional config to the BJAM_CONFIG line as follows:

nano Makefile
BJAM_CONFIG= xxxxxxxxxxxxx -j4 variant=release link=shared

Build and install Boost

make
sudo make install

Centos - Add "/usr/local/lib" to the list of lib directories to ensure that the boost libs can be found.

sudo nano /etc/ld.so.conf

Ensure the new boost libraries are registered for use.

sudo /sbin/ldconfig

Ensure boost includes can be found. This step might be eliminated in a better Exodos installer.

sudo ln -s /usr/local/include/boost-1_38/boost /usr/local/include/boost

Building service

service is an incomplete multithreaded framework to support dynamic loading of library routines and serving a request/response queue.

www provides an optional web interface to the request/response queue. Windows only at the moment due to a single asp files but could be ported to php.

Building service

cd ~/exodus/trunk/service/service
g++ -fPIC -c *.cpp -I/usr/local/include/boost-1_38 -I../../exodus/mv/src
g++ -shared -o libservice.so -lc *.o
g++ -o service main.cpp -I/usr/local/include/boost-1_38 -L. -L/usr/local/lib -lexodus -lpq -lboost_filesystem-gcc41-mt\
-lboost_regex-gcc41-mt -lboost_thread-gcc41-mt -L../../exodus/mv/src -I../../exodus/mv/src -L./ -lservice

Running service

export LD_LIBRARY_PATH=../../exodus/mv/src:.:/usr/local/lib:$LD_LIBRARY_PATH
./service

Developing libexodus/pgexosdus/service

Committing your developments

First get a username and password by running the following unix command and send the output to an exodus subversion administrator eg steve.bush@neosys.com

htpasswd -nm YOURDESIREDUSERNAME

The administrator needs to run the following command as root and enter the encrypted pass (the bit AFTER the :) ignoring the warning about plain text password because it is already encrypted.

htpasswd -p /etc/apache2/dav_svn.passwd YOURDESIREDUSERNAME