These instructions are intended for people who want to install PostgreSQL from source and the SQL Logger components on Panther. It covers almost everything.
The first step is to install Fink. You can get it from http://fink.sourceforge.net
After fink is set up properly, install a couple programs to make PostgreSQL work better. You can also use DarwinPorts (http://darwinports.opendarwin.org/ports/ for this purpose, if you have the desire.
fink install readline fink install ant
If you are using darwinports:
sudo port install readline sudo port install apache-ant
Readline is a library which allows history in the PostgreSQL prompt. Ant lets PostgreSQL compile the Java library.
Download the newest source from http://www.postgresql.org. If you are on Panther, download the newest 7.4 release. Compiling Postgres follows the normal pattern, with a lot of options to configure (several of these are not necessary for our purposes, but are included in case they are useful in the future):
./configure --bindir=/usr/local/bin --mandir=/usr/local/share/man/ \ --enable-recode --with-CXX --enable-odbc --with-java \ --enable-syslog --enable-unicode-conversion --enable-multibyte \ --with-includes=/sw/include --with-libs=/sw/lib make sudo make install
If you are using darwin ports, you need to change the --with-includes and
--with-libs flag to --with-includes=/opt/local/include
and --with-libs=/opt/local/lib
.
That's all it takes to compile and install PostgreSQL. To set it up, you need to create a new user for Postgres to run as. I used NetInfo Manager to do this. After authenticating, select the "www" user and duplicate it. A few things need to be changed after duplicating the user.
Now, PostgreSQL can be set up.
jmelloy $] su root #] mkdir /usr/local/pgsql/data root #] chown -R postgres /usr/local/pgsql root #] su postgres postgres $] /usr/local/bin/initdb -D /usr/local/pgsql/data
This initially sets up PostgreSQL. For the Perl script and JSP stuff to
work, the file /usr/local/pgsql/data/postgresql.conf
needs to
be edited. Type pico /usr/local/pgsql/data/postgresql.conf
(as
postgres or root) and change the line that says tcpip_socket
to
true. If the line starts with #, remove the hash.
This step is not necessary with PostgreSQL 8.0.
Now Postgres is ready to be started. USERNAME refers to your unix username, which is also known as your short name. The prompt should say your unix username.
postgres $] /usr/local/bin/pg_ctl -D /usr/local/pgsql/data \ -l /usr/local/pgsql/logfile start postgres $] /usr/local/bin/createdb USERNAME postgres $] /usr/local/bin/createuser USERNAME postgres $] su username
At this point you need to determine what shell you're using. The default is Bash, but some people use TCSH. Don't worry about which you're using; it doesn't matter. As yourself:
Type echo $SHELL
. It should return either Bash or TCSH.
Edit your ~/.bash_profile script using pico
or open -e
. Add the following lines:
PATH=$PATH:/usr/local/bin CLASSPATH=/usr/local/pgsql/share/java/postgresql.jar:$CLASSPATH export PATH CLASSPATH
Edit ~/.tcshrc with pico
or open -e
. Add the
following lines:
setenv PATH /usr/local/bin:$PATH setenv CLASSPATH /usr/local/pgsql/share/java/postgresql.jar:$CLASSPATH
Now you're ready to use the SQL Logger stuff.
cd ~/Desktop/sqllogger/sql psql < create.sql
At this point, it is helpful to edit the search path of the database.
jmelloy $] psql Welcome to psql 7.4, the PostgreSQL interactive terminal. Type: \copyright for distribution terms \h for help with SQL commands \? for help on internal slash commands \g or terminate with semicolon to execute query \q to quit jmelloy=# alter user username set search_path=im,public;
At this point, you're ready to import your logs into the database. Simply use the log_import.pl script, and it will import all of your adium 2.x logfiles.
jmelloy $] cd .. jmelloy $] adium/log_import.pl
Note: All steps but the last two may be completed while the import script is running. The final step should be run after the importer script has finished.
jmelloy $] cd POSTGRES_SOURCE_LOCATION/contrib/tsearch2 jmelloy $] make jmelloy $] sudo make install jmelloy $] psql < tsearch2.sql jmelloy $] cd ~/Desktop/sqllogger/sql jmelloy $] psql < tsearch2.sql
Now you need to install Resin if you wish to view the logs with the web interface. The web interface is currently more powerful than the built-in log viewer. Download Resin from http://www.caucho.com. Get the latest 3.0 release. Change directories into the Resin folder.
On PostgreSQL 8.0 and later, the JDBC driver necessary to use PostgreSQL
with Resin is not included. Get it from http://www.postgresql.org and put it
in /usr/local/pgsql/share/java/
.
The configuration file needs to be edited. Resin needs to be told how to connect to PostgreSQL and where you have put the JSP files.
pico conf/resin.conf
To configure the database, find the section that looks like this:
<!-- - Sample database pool configuration - - The JDBC name is java:comp/env/jdbc/test - <database> <jndi-name>jdbc/mysql</jndi-name> <driver type="org.gjt.mm.mysql.Driver"> <url>jdbc:mysql://localhost:3306/test</url> <user></user> <password></password> </driver> <max-connections>20</max-connections> <max-idle-time>30s</max-idle-time> </database> -->
And change it to look like this:
<!-- - Sample database pool configuration - - The JDBC name is java:comp/env/jdbc/test - --> <database> <jndi-name>jdbc/postgresql</jndi-name> <driver type="org.postgresql.Driver"> <url>jdbc:postgresql:USERNAME</url> <user>USERNAME</user> <password></password> </driver> <max-connections>20</max-connections> <max-idle-time>30s</max-idle-time> </database>
That's all it takes to set Resin up. Simply drop sqllogger.war in the
webapps
directory, and you're done.
bin/httpd.sh
To test it out, fire up a web browser and go to http://localhost:8080/sqllogger/. You should see the sql logger page.
All that is left is installing the plugin itself.