SQL Ledger 1.8.5 on Mac Os X 10.1.5

the ultimate open source accounting system on the beast of design


         SQL Ledger running locally on Os
Sql Ledger (catalan language version) running locally on a Mac Os X



Index of Setup Instructions:                          


a. INTRO

b. FINK or not to FINK

c. Load Bundled Apache


d1. Install Postgresql (fink approx)

d2. Install Postgresql (alternative approx)

e1. Setup Perl modules (fink approx)

e2. Setup Perl modules (alternative approx)

f1. Setup Latex (fink approx)
f2. Setup Latex (alternative approx)

g. Setup SQL Ledger at last!
                                           




a. INTRO


Apple
introduced Mac Os X on March 2001, with an open source kernel (aka Darwin) with a typical BSD userland system, and with a bundled Perl's and Apache's releases inside.

So you have Unix, Perl and Apache, let's look an step by step guide to setup PostgreSQL, Latex and your favorite open source invoicing software, SQL Ledger.


b. FINK or not to FINK

If Os X puts the unix's userland and taste on the original Macintosh system, Fink puts the Debian GNU/Linux packaging system into Os X (darwin-powerpc.deb's !).

So we have 2 ways to setup the Perl required modules (DBI and DBD:Pg), Postgresql and Latex: through Fink or by alternative Os X packages.

I will try to expose both methods (fink plus an alternative) but I strongly recommend Fink in order of easy future upgrades of packages.

First of all, for installing Fink itself, we should download Fink Binary Installer from http://fink.sourceforge.net and setup it as a normal Os X package. Follow instructions here http://fink.sourceforge.net/download/index.php.

Also you can install it in a more unix way as exposed here http://fink.sourceforge.net/doc/bundled/install-fast.php.

Fink by default installs everything under a new tree on /sw
As the time of this write up, Postgresql 7.2.1-4 still is under the unstable Fink branch so follow this instructions http://fink.sourceforge.net/faq/usage-fink.php#unstable for setup Fink unstable branch.

An excelent Fink review is exposed here http://www.osxfaq.com/Tutorials/macosx_unix_hacking/

After Fink installation is recommended to upgrade by typing on a new Terminal session:
% sudo fink selfupdate
% sudo fink update-all



c. Load Bundled Apache

Apache comes with Os X by default. First of all, be sure to go to
Software Upgrades under System Preferences to upgrade to the latest one.

In order to startup it as default on system boots, you should go to System Preferences, select Sharing and turn on Web Sharing (strange way to call Apache) by clicking Start.

You can tune apache by doing
%sudo vi /etc/httpd/httpd.conf
then refreshing the new setup with
% sudo apachectl graceful

By default web files are served from /Library/WebServer


d1. Install Postgresql (fink approx)


% sudo fink install postgresql
% sudo fink install daemonic
% sudo daemonic enable postgresql

(daemon for automate Postgresql startup on system boot)


d2. Install Postgresql (alternative approx)

Marc Liyanage has packaged binary Postgresql for Os X http://www.entropy.ch/software/macosx/postgresql/ be sure to install also pgsql-startup for automate upload on system boot.


e1. Setup Perl modules (fink approx)

% fink install dbi-pm
% fink install dbd-pg-pm
(or alternative with SSL dbd-pg-ssl-pm)
Remember later to aware SQL Ledger to use Fink's installed Perl libs so we should edit sql-ledger.conf to include PERL5LIB variable path (explained later).


e2. Setup Perl modules (alternative approx)


We also can install modules by usual Cpan approx:
% sudo perl -MCPAN -e shell
(answer with defaults on first time) then installing trought CPAN shell
install DBI
install DBD::Pg

or more directly
% sudo perl -MCPAN -e 'install DBI'
before installing DBD::Pg we should parse our Postgresql environment
% setenv POSTGRES_INCLUDE /sw/include/postgresql
% setenv POSTGRES_LIB /sw/lib
% sudo perl -MCPAN -e 'install DBD::Pg'



f1. Setup Latex (fink approx)


Let's install tex and utilities:
% sudo fink install context
% sudo fink install ghostscript6
% sudo fink install ghostscript-fonts
% sudo fink install oberdiek
% sudo fink install tetex-base
% sudo fink install system-tetex
% sudo fink install texinfo
% sudo fink install textutils
% sudo fink install latex2html
% sudo fink install dvipdfm
% sudo fink install pdfscreen
% sudo fink install pdfslide
% sudo fink install pdftex
% sudo fink install xdvi



f2. Setup Latex (alternative approx)

You can try another Os X Latex distribution listed on http://www.esm.psu.edu/mac-tex/engines.html


g. Setup SQL Ledger at last!

Check up PostgreSQL's connections permissions

% vi /sw/var/postgresql/data/pg_hba.conf
you should have depending if you want to run SQL Ledger locally:
local    all    password

or on another host:
host     all    0.0.0.0    0.0.0.0    password

Go to the Apache's webserving directory:
% cd /Library/WebServer
Untar sql-ledger distribution:
% tar xvzf sql-ledger-1.8.5.tar.gz
Change permissions to the user running Apache
% sudo chown www.www sql-ledger/templates
% sudo chown www.www sql-ledger/users

Create SQL Ledger Config file and edit it.
% cd sql-ledger
% cp sql-ledger.conf.default sql-ledger.conf
% vi sql-ledger.conf

If you use Fink's Perl you should parse it:
# on mac os X using Fink's Perl libs, add the path
$ENV{PERL5LIB} .= "/sw/lib/perl5"


Also if you use Fink's Latex remember to parse it:
# if the server can't find latex, dvips or pdflatex, add the path
$ENV{PATH} .= ":/sw/bin";

Let's edit Apache config in order to run SQL Ledger
% vi /etc/httpd/httpd.conf

# an automate redirect to the login
Redirect        /ledger            http://127.0.0.1/sql-ledger/login.pl
# an alias to the system directory
Alias           /sql-ledger/      /Library/WebServer/sql-ledger/
# cgi executing instructions
<Directory /Library/WebServer/sql-ledger>
        Options ExecCGI Includes FollowSymlinks
</Directory>
# cgi stopping exectution
<Directory /Library/WebServer/sql-ledger/users>
        Options None
</Directory>


Create the Postgresql user that admins our SQL Ledger installation
% sudo su pgsql
pgsql% createuser -d -A -P sql-ledger
and choose a password

Start your favorite browser and go to the SQL Ledger admin page
http://127.0.0.1/sql-ledger/admin.pl

Change Admin password by clicking its button.

Click on Pg Database Administration button and parse all the data
Host and Port are optional for a local only running version of SQL-Ledger
# 127.0.0.1
# 5432

So its necessary to put our PostgreSQL User
sql-ledger
and the password we setup before, then the first conection to the
template1
And then click the Create Dataset button to create our database.

Return to the admin page (with the admin password you choose before).
http://127.0.0.1/sql-ledger/admin.pl
And add the user you want to run SQL Ledger

So now you're ready to start billing ;-)
http://127.0.0.1/sql-ledger/login.pl















Copyleft August 12th, 2002 by Jaume Teixi.
Brought to you courtesy of teixi.net