Installing LedgerSMB (Open Source Accounting Application) On Debian Etch

Version 1.0
Author: Falko Timme

LedgerSMB is a free (licensed under the GPL), web based double entry accounting system written in Perl which uses PostgreSQL for data storage. It is intended for small and medium businesses (SMB), and it can be used easily through a regular web browser like Firefox. This tutorial explains how to install LedgerSMB on a Debian Etch system.

I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

I have tested this on an empty (i.e., just the basic system, no web servers, etc.) Debian Etch system with the IP address 192.168.0.100 and the hostname server1.example.com. Please replace the IP address/hostname with your own values.

The tutorial should work as well if you have Apache already installed together with a few web sites (although I haven't tested this).

 

2 Installing Required Perl Modules

LedgerSMB depends on a few Perl modules which we can install in a single command like this:

apt-get install libdata-dumper-simple-perl perl-modules liblocale-maketext-lexicon-perl libmd5-perl libdbi-perl libdbd-pg-perl libconfig-any-perl libmime-lite-perl libhtml-linkextractor-perl libnet-tclink-perl libparse-recdescent-perl libmodule-build-perl

There are two other needed Perl modules (libclass-std-perl and libconfig-std-perl) that don't exist in the Debian repositories. Fortunately, the LederSMB project provides them as .deb packages in the deb-prereq .tar.gz file that can be downloaded from SourceForge:

cd /tmp
wget http://mesh.dl.sourceforge.net/sourceforge/ledger-smb/deb-prereq-1.2.8.tar.gz
tar xvfz deb-prereq-1.2.8.tar.gz
cd deb-prereq-1.2
dpkg -i libclass-std-perl_0.0.8-1_all.deb libconfig-std-perl_0.0.4-1_all.deb

 

3 Installing Apache

Apache can be installed like this:

apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert

 

4 Installing PostgreSQL

LedgerSMB needs PostgreSQL 8.x. The newest PostgreSQL version that is available in the Debian repositories is 8.1, so we install this one:

apt-get install postgresql-8.1 postgresql-client-8.1

 

5 Installing LedgerSMB

We will now download LedgerSMB from SourceForge and install it in the /usr/local/ledgersmb directory:

cd /tmp
wget http://switch.dl.sourceforge.net/sourceforge/ledger-smb/ledgersmb-1.2.8.tar.gz
tar xvfz ledgersmb-1.2.8.tar.gz
mv ledgersmb /usr/local/

The /usr/local/ledgersmb directory should be owned by the Apache user (www-data on Debian) and group (again www-data):

chown -R www-data:www-data /usr/local/ledgersmb/

Then we have to become the postgres user:

su -m postgres

and log in to PostgreSQL:

psql -U postgres

Now on the PostgreSQL shell, type in the following command to change the PostgreSQL password for the postgres user:

ALTER USER postgres WITH PASSWORD 'POSTGRESPASSWORD';

(Replace POSTGRESPASSWORD with a password of your choice.)

Then leave the PostgreSQL shell:

\q

Create a PostgreSQL admin database role, by convention named ledgersmb:

createuser --no-superuser --createdb --no-createrole -U postgres --pwprompt --encrypted ledgersmb

You will be asked to specify a password. I use MYROLEPASSWORD here, but of course, you should use your own.

Afterwards, become root again by typing:

exit

Now we create the system user ledgersmb:

adduser ledgersmb

You will be asked to specify a password for that user and some other details.

Then become the ledgersmb user:

su -m ledgersmb

Create a central user database, owned by the LedgerSMB admin role, ledgersmb:

createdb -U ledgersmb -O ledgersmb ledgersmb

Next fill the ledgersmb database:

psql -U ledgersmb -d ledgersmb -f /usr/local/ledgersmb/sql/Pg-central.sql

The SQL command in the last step created an LedgerSMB-managed admin user, i.e. a row in the users and users_conf table. You must now update the admin user password in users_conf from the default password:

psql -U ledgersmb -d ledgersmb

You will then get to the PostgreSQL shell where you run

UPDATE users_conf SET password = md5('MYPASSWORD') WHERE id = 1;

to change the password. Replace MYPASSWORD with a password of your choice.

Type

\q

to leave the PostgreSQL shell and then

exit

to become root again.

Next we must rename /usr/local/ledgersmb/ledgersmb.conf.default to /usr/local/ledgersmb/ledgersmb.conf:

mv /usr/local/ledgersmb/ledgersmb.conf.default /usr/local/ledgersmb/ledgersmb.conf

Now we must open /usr/local/ledgersmb/ledgersmb.conf and adjust the database details (they are right at the end of the file). Make sure you fill in MYROLEPASSWORD (or whatever password you chose for MYROLEPASSWORD):

vi /usr/local/ledgersmb/ledgersmb.conf
[...]
[globaldb]
# These paramaters *must* be set correctly
# for LedgerSMB >= 1.2 to work
DBname       = ledgersmb
DBhost       = localhost
DBport       = 5432
DBUserName   = ledgersmb
DBPassword   = MYROLEPASSWORD

LedgerSMB comes with a little script to automatically configure Apache. Let's run it now:

cd /usr/local/ledgersmb/
sh configure_apache.sh

You will be asked two questions:

Which user does your web server run as?
<-- www-data
Where do we copy the ledgersmb-httpd.conf file to?
<-- /etc/apache2/conf.d

Restart Apache afterwards:

/etc/init.d/apache2 restart

Now let's check our LedgerSMB installation by running:

cd /usr/local/ledgersmb
perl Build.PL

The output should look like this:

server1:/usr/local/ledgersmb# perl Build.PL
Creating new 'Build' script for 'LedgerSMB' version '1.2.8'
server1:/usr/local/ledgersmb#

Run

./Build test

afterwards. It's possible that a few tests fail (e.g. if you get something like this at the end of the output:

Failed Test Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
t/10-form.t  255 65280    ??   ??       %  ??
t/12-menu.t  255 65280    37   74 200.00%  1-37
Failed 2/6 test scripts, 66.67% okay. 37/1308 subtests failed, 97.17% okay.

), but you can ignore this and go on.

Restart Apache again:

/etc/init.d/apache2 restart
Share this page:

1 Comment(s)