Installing LedgerSMB 1.2.18-1 on Ubuntu 9.04

Written by James McDonald

May 2, 2009

This post is a step by step guide to installing LedgerSMB 1.2.18-1 on Ubuntu 9.04.

Download ledgersmb_1.2.18-1_all.deb

# Install postgresql
sudo apt-get install postgresql

# Install the PDF / PS utilities
sudo apt-get install texlive

# Install Perl Dependencies
sudo apt-get install libconfig-std-perl libmime-lite-perl \
                    liblocale-maketext-lexicon-perl libdbd-pg-perl \
                    libclass-std-perl libemail-date-format-perl \
                    libmime-types-perl

# Install ledgersmb
sudo dpkg -i  ledgersmb_1.2.18-1_all.deb

Following is a copy and paste of the installation instructions from the install. I have made the successful steps formatted as code in blockquotes with my comments in bold

LedgerSMB for Debian
——————–

LedgerSMB can be accessed at http://127.0.0.1/ledgersmb, although initial
set up is required.

To prepare LedgerSMB for use:

1) As the postgres user, create a database user for LedgerSMB authentication

To become the postgres user:

sudo su - postgres

To create the LedgerSMB Postgres Database Connection User

$ createuser --no-superuser --createdb --no-createrole \
		-U postgres --pwprompt --encrypted ledgersmb
Enter password for new role: 
Enter it again: 
  #enter the password twice, but remember what you enter here for step 5.

2) Create postgres database for ledgersmb
To create the database without editing the default Ubuntu pg_hba.conf you need to add -h localhost to most commands

createdb -U ledgersmb -O ledgersmb -h localhost -E UNICODE ledgersmb
Password: 

This threw an error on default Ubuntu 9.04 (Postgres 8.3)
$ createdb -U ledgersmb -O ledgersmb -E UNICODE ledgersmb
createdb: could not connect to database postgres: FATAL: Ident authentication failed for user “ledgersmb”

Note:
In Ubuntu 9.04 there are entries in pg_hba.conf that allow for host connection with password. So just specify -h localhost along in the commands !You must be on the postgres box because it’s only set to accept a host connection from localhost.

This is my pg_hba.conf.

# Database administrative login by UNIX sockets
local   all         postgres                          ident sameuser

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
local   ledgersmb   ledgersmb                         md5
# "local" is for Unix domain socket connections only
local   all         all                               ident sameuser
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               md5

This worked but you must be postgres user e.g. su – postgres

$ createlang plpgsql -U postgres ledgersmb

3) Add databases for all datasets which you want to have available
For instance, we want a dataset for each of examplecom, exampleorg and
examplenet, so…

$ createdb -T ledgersmb examplecom
$ createdb -T ledgersmb exampleorg
$ createdb -T ledgersmb examplenet

4) Populate the user database and set an admin password (this admin password
will be used to log into the administrative interface).
To populate the user database

$ psql -U ledgersmb -d ledgersmb -f \
/usr/share/ledgersmb/sql/Pg-central.sql -h localhost
Password for user ledgersmb:

Set an admin password

$ psql -U ledgersmb -d ledgersmb -h localhost
Password for user ledgersmb:
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

SSL connection (cipher: DHE-RSA-AES256-SHA, bits: 256)

ledgersmb=> UPDATE users_conf SET password = md5('mysecretsaucepassword')
ledgersmb=> WHERE id = 1;
UPDATE 1
ledgersmb-> \q

default command as follows fails
$ psql -U ledgersmb -d ledgersmb -f \
/usr/share/ledgersmb/sql/Pg-central.sql

postgres@ubuntu:~$ psql -U ledgersmb -d ledgersmb -f /usr/share/ledgersmb/sql/Pg-central.sql
psql: FATAL: Ident authentication failed for user “ledgersmb”

$ psql -U ledgersmb -d ledgersmb

postgres@ubuntu:~$ psql -U ledgersmb -d ledgersmb
psql: FATAL: Ident authentication failed for user “ledgersmb”

ledgersmb=> UPDATE users_conf SET password = md5(‘admin-password’) \
WHERE id = 1;

5) Edit /etc/ledgersmb/ledgersmb.conf

If you are still logged in as postgres exit and return to your own user account then

sudo vi /etc/ledgersmb/ledgersmb.conf

Scroll down to the very bottom and check your database settings, they
will need to be changed. Insert the ledgersmb postgres user password
you used in step 1.

# If you have LaTeX installed, set to 1
latex : 1
...
[mail]
### How to send mail.  The sendmail command is used unless smtphost is set.
sendmail   = /usr/sbin/sendmail -t
...
[printers]
# Available printers
# comment out the printers that aren't on your system and add your own.
# test to make sure you have the command below right as follows:
# echo hello | lpr -PPSC_1600_series
# the above command shot print out a sheet of paper with hello on it.
HP         = lpr -PPSC_1600_series
# Laser      = lpr -Plaser
# Epson      = lpr -PEpson
...

[globaldb]
# These paramaters *must* be set correctly
# for LedgerSMB >= 1.2 to work
DBname       = ledgersmb
DBhost       = localhost
DBport       = 5432
DBUserName   = ledgersmb
DBPassword   = set me to correct password

[mail]
### How to send mail. The sendmail command is used unless smtphost is set.
sendmail = /usr/sbin/sendmail -t

Default path is /usr/bin/sendmail Ubuntu uses /usr/sbin/sendmail

6) Edit /etc/postgresql/8.x/main/pg_hba.conf so that ledgersmb user may
connect. Depending on your security infrastructure you can use the METHOD
md5 or trust.

sudo vi /etc/postgresql/8.3/main/pg_hba.conf
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
local   ledgersmb   ledgersmb                         md5
Reload postgres so your changes take effect.
sudo /etc/init.d/postgresql-8.3 reload
 * Reloading PostgreSQL 8.3 database server                              [ OK ] 

sudo /etc/init.d/postgres reload

7) Configure apache2

Check /etc/ledgersmb/ledgersmb-httpd.conf and see if it is what you want
– it will usually be fine just the way it is.

The default configuration will make this accessible to everyone who can
get to your ip address on port 80. If you want to lock it down to
localhost, do so now in the forementioned configuration file!

$ cd /etc/apache2/conf.d/
$ ln -s ../../ledgersmb/ledgersmb-httpd.conf

To enable ledgersmb on a single virtual host
I didn’t do this I used an Include statement from within a virtual host e.g.
Include /etc/ledgersmb/ledgersmb-httpd.conf

To Globally enable ledgersmb on all sites…

sudo ln -sf /etc/ledgersmb/ledgersmb-httpd.conf /etc/apache2/conf.d/

8) Reload apache2

$ /etc/init.d/apache2 reload

At this point you can connect to http://127.0.0.1/ledgersmb/admin.pl and login
with the password set in step 4.

This failed for me the first time because I put the wrong password in.

  • Don’t put the password from the UPDATE statement
  • Use the ledgersmb postgres user password

If upgrading from LedgerSMB < 1.2.0-rc5, you need to edit /etc/ledgersmb/ledgersmb.conf to adjust your configuration to match the new options and renaming. If upgrading from LedgerSMB < 1.2.0-beta1 or from SQL-Ledger, read UPGRADE. The config format, locale names, database schema, and per-user configuration locations have been sufficiently changed with 1.2.0-beta1 so as to require special attention in upgrading. -- Elizabeth Krumbach Tue, 6 Jan 2009 05:38:48 -0500

Finally
From the above you still need to create a dataset and user account…

3 Comments

  1. nayanajith

    Hi,

    I installed ledgersmb,
    I can not alter the access control of the users. They are resetting to default state

    Reply
  2. frans van der star

    Hi all,

    There is an install instruction for Ubuntu for :LedgerSMB 1.3 versions which are much better

    Reply
  3. frans van der star

    Hi All,

    In addition to my previous message.

    These instructions u can find on http://www.ledgersmb.org

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…