E R P

     
 
SQL-Ledger - Install on OS X Tiger 10.4

     
   

How To Install SQL Ledger on Mac OS X 10.4 (Tiger)

Written and tested by Paul J. Teeter

This set of instructions assumes several software versions. They are listed below:

  • Mac OS X Client 10.4.9 (Tiger)
  • Apple's Xcode Developer Tools 2.4.1
  • perl 5.8.6, as installed with Tiger
  • Apache 1.3.33
  • readline 5.2
  • PostgreSQL 8.2.4
  • fink 0.8.1
  • SQL Ledger 2.8.2

This set of instructions also assumes a good working understanding of the Terminal command line interface. My hope is that if you are planning to install SQL Ledger on Mac OS X you are already a bit of a Unix geek. If you're not, you can probably get by with the command+syntax combinations I'll include. You will need to enable the root account on your OS X machine (sudo passwd root) and will need to have the ability to become the root user (su -).

By default, the user shell in OS X is bash. My personal preference is tcsh. The shell commands and environment variable discussions assume this personal preference for tcsh. Just something to keep in mind. Enjoy.

 

Readline

  1. Acquire compressed source code for readline 5.2 (ftp://ftp.gnu.org/gnu/readline/readline-5.2.tar.gz) . This software allows for command line history recall within the "psql" command line utility. Skip this section if you have no intention of using "psql".
  2. I like to store compressed tar balls in /usr/local/src. You can do whatever you like. You may need to create /usr/local/src:  sudo mkdir /usr/local/src, if so then it is probably best to add yourself to the wheel group via NetInfo Manager. Then change the permissions on /usr/local/src to 775: sudo chmod 775 /usr/local/src . Now feel free to uncompress the source code and change into the newly created directory: tar xvfz readline-5.2.tar.gz .
  3. Configure the code for your environment, make it, and install it (./configure; make; sudo make install).
  4. Feel free to delete the uncompressed readline 5.2 source code directory, or leave it where you unpacked.

PostgreSQL

  1. Acquire compressed source code for PostgreSQL 8.2.4.
  2. Like I said before, I typically work from /usr/local/src. Do what you like but uncompress the source code and change into the newly created directory: tar xvfz postgresql-8.4.2.tar.gz.
  3. Configure PostgreSQL with whatever options you desire though I found that "--with-openssl" tends to break DBD::Pg later in this process. I'm sure it's possible to get it working, I just skipped it. My configure statement for SQL Ledger was:
    ./configure --prefix=/usr/local/pgsql --with-perl
  4. Make PostgreSQL and install it (make; sudo make install).
  5. Create a "postgres" user via System Preferences and add him/her to the postgres (502) group via NetInfo Manager, if necessary. (OS X 10.4 will automatically create a group named after a new user, in which case explicitly adding postgres to the postgres group is not necessary.) Choose a unique, well-formed password. Or choose something easy to remember.
  6. In the "/usr/local/pgsql" directory recursively chgrp everything to "postgres". Then chmod pgsql to 775 (chgrp -R postgres /usr/local/pgsql; chmod 775 /usr/local/pgsql).
  7. Either via an environment initialization script or simply from the shell (I use tcsh, you can use whatever shell you like), add "/usr/local/pgsql/bin" to the postgres user's PATH.
  8. Su to the postgres user and invoke your shell of choice. Initialize PostgreSQL with the "initdb" command, the typical location for the datastore is "/usr/local/pgsql/data" (initdb -D /usr/local/pgsql/data). Stop being the postgres user.
  9. Create a log file directory and a log file. "/var/log/pgsql" seems like as good a place as any. OS X keeps almost all of it's logs in /var/log, so why not add another? Make postgres the owner and group owner. Chmod the directory to 700, chmod the file to 600 (sudo mkdir /var/log/pgsql; sudo touch /var/log/pgsql/logfile; sudo chown -R postgres:postgres /var/log/pgsql; sudo chmod 700 /var/log/pgsql; sudo chmod 600 /var/log/pgsql/logfile).
  10. Add a PostgreSQL directive to /etc/hostconfig if you want PostgreSQL to start when your server is rebooted (sudo echo "POSTGRES=-YES-" >> /etc/hostconfig).
  11. Acquire Marc Liyanage's handy PostgreSQL startup script package (http://www2.entropy.ch/download/pgsql-startupitem-1.2.pkg.tar.gz).
  12. Uncompress it and install it. You can do this installation from your Desktop, no source code needed. Or use this command: sudo installer -verbose -pkg /path/to/pgsql-startupitem-1.2.pkg -target /
  13. If you followed the PostgreSQL instructions verbatim, you'll need to edit this just installed startup script. It can be found in /Library/StartupItems/PostgreSQL and is titled "PostgreSQL". Ensure that all paths reference the correct locations - /usr/local/pgsql/bin/pg_ctl, /usr/local/pgsql/data,and /var/log/pgsql/logfile.
  14. Depending on your network architecture and need for access control on the PostgreSQL databases, add an entry to the end of the /usr/local/pgsql/data/pg_hba.conf file for your local or remote network that forces md5 (encrypted password) authentication.
  15. Depending on your need for auditing and PostgreSQL log monitoring, edit /usr/local/pgsql/data/postgresql.conf to include increased logging level.
  16. As the postgres user (in OS X) add users to your PostgreSQL installation as needed. su - postgres; /usr/local/pgsql/bin/createuser -P -E <username>
  17. Add /usr/local/pgsql/bin to the environment paths for root, postgres, and whichever other users that will be using the PostgreSQL installed binary executables - initdb, createdb, psql, createuser, pg_ctl, etc.
  18. Create a database in your new PostgreSQL installation - createdb <dbname>
  19. To add the necessary procedural language to the "template1" default database in PostgreSQL, execute the following command from the OS X command line: createlang plpgsql template1

Fink

  1. Acquire the fink installer (PowerPC or Intel), save the .dmg file to your desktop.
  2. Mount the disk image by double-clicking it. Run the installer by double-clicking on Fink 0.8.1-PowerPC Installer.pkg. Check this link for additional information on installing Fink.
  3. Open the Fink Commander. From the Source menu, choose 'scanpackages'. From the Source menu, choose Utilities, then choose 'index'.
  4. Update Fink from source. Source->Selfupdate-rsync.
  5. Add the /sw/bin directory to whichever users might need it.
  6. You should have success installing the following packages via Fink Commander - ghostscript-fonts, ghostscript6, tetex-base, textutils, latex2html, pdfscreen, pdfslide, and xdvi. Accept defaults wherever prompted. Take a seat and be prepared to wait...a lot of dependencies need to be installed too.
  7. In lieu of using Perl's CPAN modules, install DBI and DBD::Pg via Fink Commander as well. The specific packages in Fink Commander to install are: dbi-pm586 and dbd-pg-unified-pm586.

SQL-Ledger

  1. Acquire the sql-ledger source code, drop it in /usr/local/src .
  2. Uncompress the source code into the OS X Apache document root - /Library/WebServer/Documents - to create the new directory /Library/WebServer/Documents/sql-ledger .
  3. Change ownership of /Library/WebServer/Documents/sql-ledger/users, templates, spool, and css to www:www. Exact command syntax is: cd /Library/WebServer/Documents/sql-ledger; chown www:www users templates spool css
  4. Apache, as it is installed with OS X, will read not only /etc/httpd/httpd.conf but also all config files in /etc/httpd/users. SQL-Ledger can take advantage of this configuration choice. Create a file in /etc/httpd/users called sql-ledger-httpd.conf: cd /etc/httpd/users; sudo touch sql-ledger.conf. Make sure the ownership of this file is root:wheel and the permissions are 644: sudo chmod 644 sql-ledger.conf; sudo chown root:wheel sql-ledger.conf.
  5. The contents of sql-ledger.conf should be the following:
  6. Alias /sql-ledger/ /Library/WebServer/Documents/sql-ledger/
     
    <Directory /Library/WebServer/Documents/sql-ledger/>

    AllowOverride All
    AddHandler cgi-script .pl
    Options ExecCGI Includes FollowSymlinks
    Order Allow,Deny
    Allow from All

    </Directory>

    <Directory /Library/WebServer/Documents/sql-ledger/users>

    Order Deny,Allow
    Deny from All

    </Directory>

  7. Add an 'sql-ledger' user to PostgreSQL: createuser -d -A -P sql-ledger . Supply a well-formed, cryptic password.
  8. Because DBI and DBD::Pg were installed via Fink, it is necessary to uncomment and edit a specific line in the file /Library/WebServer/Documents/sql-ledger/sql-ledger.conf. Uncomment the line, very near the bottom, that begins with $ENV{PERL5LIB}. Edit this line to read:

    $ENV{PERL5LIB} .= $ENV{PERL5LIB} .= ":/sw/lib/perl5/darwin-thread-multi-2level"

    This measure should force all the perl scripts installed with SQL-Ledger to look in this location for additional perl libraries. In my testing I was unable to make this work. Instead I was forced to hand edit every .pl file in the /Library/WebServer/Documents/sql-ledger directory. Just after the top-most comments and just before defaults are setup each .pl script should look like the following:

    #######################################################################

    use lib '/sw/lib/perl5/5.8.6/darwin-thread-multi-2level';

  9. # setup defaults, DO NOT CHANGE

  10. Check the revised Apache configuration: sudo apachectl configtest . Restart Apache: sudo apachectl restart .

Follow the SQL-Ledger FAQ steps for administration and login.

             

SQL-Ledger® is a registered trademark of DWS Systems Inc. All Rights Reserved. © Copyright 1998 - 2017 DWS Systems Inc.