Monday, July 29, 2013

Install Sql-ledger on OSX

Here is a simple install for Mac users to install sql-ledger on Mac OS Mountain Lion. I will use Xcode to get all the core files needed to get it working. Osx already has perl, apache and postgres, we only need to get the extra files needed and Latex if you want to use pdf printing. 

Step 1
First we get all the files to run sql-ledger.

Go to the App Store and Install Xcode, it's free! I know it is a large download but it is the easiest way to get the tools we need.
When Xcode is installed, go to preferences of Xcode and install 'Command Line Tools'

(you can also download 'command line tools' direct from the Apple developers site without installing Xcode, but I follow the Xcode way...).  

Now we have the command line tools we can install the database drivers for Perl.

-Go to terminal and give command: 

sudo cpan DBD:Pg

Follow the prompt messages. (pressing Y a few times...)

To get pdf printing, Install MacTex,

Choose this file to download and install it: BasicTex.pkg

That's it. Now we need to get sql-ledger on the Mac.

Step 2
Download latest version of sql-ledger, and place the files in directory:

Go to the Terminal app and make the files readable for the web server.

sudo chown -R www:www /library/webserver/documents/sql-ledger 

Now we have to tell apache where to find sql-ledger, to do this add the file sql-ledger.conf in /etc/apache2/users
The contents of this file is:
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 /Library/WebServer/Documents/sql-ledger/users>
Order Deny,Allow
Deny from All

To have apache read the new file, go to Terminal app and restart apache:

sudo apachectl restart

Last step is to alter a line in /Library/WebServer/Documents/sql-ledger/sql-ledger.conf. We want to tell sql-ledger where to find Latex on your Mac. That is located in /usr/texbin

Edit the file sql-ledger.conf in the sql-ledger directory, and edit the line so the line looks like:

# if the server can't find gzip, latex, dvips or pdflatex, add the path
$ENV{PATH} .= ":/usr/texbin";

Step 3
Start sql-ledger with: http://localhost/sql-ledger/
Give an admin password and setup a dataset.
Default, sql-ledger uses the user sql-ledger for database access. Change this into postgres, if you have not setup any other users for postgres. The password for user postgres is the root password of your Mac. For host, type, localhost.

I suggest that if everything is working, Google into how to setup a sql-leder user for postgres. 

Your done! Login with user admin and the new password you created at: http://localhost/sql-ledger/

Under HR, you can setup the new users and their privileges. See install instructions at the sql-ledger website for more details.

No comments:

Post a Comment