-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.xml
executable file
·184 lines (177 loc) · 8.8 KB
/
install.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<h1>Installation Instructions</h1>
<p>These instructions are intended for people who want to install
PostgreSQL from source and the SQL Logger components on Panther. It covers almost
everything.</p>
<h3>Installing PostgreSQL</h3>
<p>The first step is to install Fink. You can get it from <a
class="offsite"
href="http://fink.sourceforge.net">http://fink.sourceforge.net</a></p>
<p>After fink is set up properly, install a couple programs to make
PostgreSQL work better. You can also use DarwinPorts (<a class="offsite"
href="http://darwinports.opendarwin.org/">http://darwinports.opendarwin.org/</a> for this purpose, if
you have the desire.</p>
<div class="tutorialcode"><pre>fink install readline
fink install ant</pre></div>
<p>If you are using darwinports:</p>
<div class="tutorialcode"><pre>sudo port install readline
sudo port install apache-ant</pre></div>
<p>Readline is a library which allows history in the PostgreSQL prompt. Ant
lets PostgreSQL compile the Java library.</p>
<p>Download the newest source from <a href="http://www.postgresql.org"
class="offsite">http://www.postgresql.org</a>. 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):</p>
<div class="tutorialcode"><pre>./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</pre>
</div>
<p>If you are using darwin ports, you need to change the --with-includes and
--with-libs flag to <code>--with-includes=/opt/local/include</code>
and <code>--with-libs=/opt/local/lib</code>:</p>
<div class="tutorialcode"><pre>./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=/opt/local/include --with-libs=/opt/local//lib
make
sudo make install</pre></div>
<h3>Configuring PostgreSQL</h3>
<p>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.</p>
<ul>
<li>Change the short
username to "postgres", and the long name to "PostgreSQL Server".</li>
<li>The uid
and gid values need to be changed. It doesn't matter what they're changed
to, as long as it is unique. If the uid is less than 500, the user will not
show up on the Login panel. </li>
<li>The shell needs to be changed from null to /bin/bash</li>
</ul>
<p>Now, PostgreSQL can be set up.</p>
<div class="tutorialcode"><pre>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</pre></div>
<p>This initially sets up PostgreSQL. For the Perl script and JSP stuff to
work, the file <code>/usr/local/pgsql/data/postgresql.conf</code> needs to
be edited. Type <code>pico /usr/local/pgsql/data/postgresql.conf</code> (as
postgres or root) and change the line that says <code>tcpip_socket</code> to
true. If the line starts with #, remove the hash.</p>
<p>This step is not necessary with PostgreSQL 8.0.</p>
<p>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.</p>
<div class="tutorialcode"><pre>postgres $] /usr/local/bin/pg_ctl -D /usr/local/pgsql/data \
-l /usr/local/pgsql/logfile start
postgres $] /usr/local/bin/createdb <i>USERNAME</i>
postgres $] /usr/local/bin/createuser <i>USERNAME</i>
postgres $] su <i>username</i></pre></div>
<h3>Configuring Your Shell</h3>
<p>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:</p>
<p>Type <code>echo $SHELL</code>. It should return either Bash or TCSH.</p>
<h4>For Bash users</h4>
<p>Edit your ~/.bash_profile script using <code>pico</code> or <code>open -e</code>. Add the following lines:</p>
<div class="tutorialcode"><pre>PATH=$PATH:/usr/local/bin
CLASSPATH=/usr/local/pgsql/share/java/postgresql.jar:$CLASSPATH
export PATH CLASSPATH</pre></div>
<h4>For TCSH</h4>
<p>Edit ~/.tcshrc with <code>pico</code> or <code>open -e</code>. Add the
following lines:</p>
<div class="tutorialcode"><pre>setenv PATH /usr/local/bin:$PATH
setenv CLASSPATH /usr/local/pgsql/share/java/postgresql.jar:$CLASSPATH</pre>
</div>
<p>Now you're ready to use the SQL Logger stuff.</p>
<div class="tutorialcode"><pre>cd ~/Desktop/sqllogger/sql
psql < create.sql</pre></div>
<p>At this point, it is helpful to edit the search path of the database.</p>
<div class="tutorialcode"><pre>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 <i>username</i> set search_path=im,public;</pre></div>
<p>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.</p>
<div class="tutorialcode"><pre>jmelloy $] cd ..
jmelloy $] adium/log_import.pl</pre></div>
<h3>Installing tsearch for fast searching</h3>
<p>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.</p>
<div class="tutorialcode"><pre>jmelloy $] cd <i>POSTGRES_SOURCE_LOCATION</i>/contrib/tsearch2
jmelloy $] make
jmelloy $] sudo make install
jmelloy $] psql < tsearch2.sql
jmelloy $] cd ~/Desktop/sqllogger/sql
jmelloy $] psql < tsearch2.sql</pre></div>
<p>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 <a href="http://www.caucho.com/"
class="offsite">http://www.caucho.com</a>. Get the latest 3.0 release. Change directories into the Resin folder.</p>
<p>On PostgreSQL 8.0 and later, the JDBC driver necessary to use PostgreSQL
with Resin is not included. Get it from <a
href="http://jdbc.postgresql.org">http://www.postgresql.org</a> and put it
in <code>/usr/local/pgsql/share/java/</code>.</p>
<h3>Resin 3.0.x: </h3>
<p>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.</p>
<div class="tutorialcode"><pre>pico conf/resin.conf</pre></div>
<p>To configure the database, find the section that looks like this:</p>
<div class="tutorialcode">
<pre><!--
- 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>
--></pre></div>
<p>And change it to look like this:</p>
<div class="tutorialcode">
<pre><!--
- Sample database pool configuration
-
- The JDBC name is java:comp/env/jdbc/test
-
<b> --></b>
<database>
<jndi-name><b>jdbc/postgresql</b></jndi-name>
<driver type="<b>org.postgresql.Driver</b>">
<url><b>jdbc:postgresql:<i>USERNAME</i></b></url>
<user><b><i>USERNAME</i></b></user>
<password></password>
</driver>
<max-connections>20</max-connections>
<max-idle-time>30s</max-idle-time>
</database></pre></div><br />
<div class="important">Make sure you move the "-->" to above the
<database>. Otherwise you will comment out the entire file.</div>
<p>That's all it takes to set Resin up. Simply drop sqllogger.war in the
<code>webapps</code> directory, and you're done.</p>
<div class="tutorialcode">
<pre>bin/httpd.sh</pre>
</div>
<p>To test it out, fire up a web browser and go to <a
href="http://localhost:8080/sqllogger/">http://localhost:8080/sqllogger/</a>.
You should see the sql logger page.</p>
<h3>Installing the Plugin</h3>
<p>All that is left is installing the plugin itself.</p>