IBSng Accounting Software (Free Version) on Slackware Linux

Dear readers;
I’ve decided to explain the IBSng Integrated Accounting Software (ParsPooyesh Co.)Here we have a free version of this accounting that provides most of the functions that you need for LAN ACCOUNTING.The bandwidth management of this version works too.  It’s great for working on small networks which needs LAN Accounting or dial-up accounting for free.For more information about the IBSng go to http://www.parspooyesh.com/ .

Lets’ do Server Stuff

1.    Make sure you’ve configured the apache web server and php before and it works well. (php needs libpng for IBSng graphs)

2.    I will Downgrade the Python from 2.7 to 2.3.7, with the default version (2.7) we can’t create users in IBSng due the xmlrpc error.

3.    IBSng uses PostgreSQL as Database server. We need to install and configure the Postgresql and Pygresql (PostgreSQL module for Python) before IBSng installation.

PostgreSQL & PyGreSQL Installation:

Downgrade the Python:

removepkg python

rm -rf /usr/lib/python2.7

cd /usr/src/

wget http://python.org/ftp/python/2.3.7/Python-2.3.7.tar.bz2

tar -jxvf Python-2.3.7.tar.bz2

cd Python-2.3.7

./configure --prefix=/usr/lib/python-2.3

make; make install

ln -sfn /usr/lib/python-2.3/bin/python /usr/bin/

postgresql:

wget https://ftp.postgresql.org/pub/source/v9.2.16/postgresql-9.2.16.tar.gz

tar -zxvf postgresql-9.2.16.tar.gz

cd postgresql-9.2.16

./configure

gmake; gmake install

groupadd postgres

useradd postgres -g postgres

mkdir  /usr/local/pgsql/data

chown  -R  postgres  /usr/local/pgsql/data/

cd

ln -sfn /usr/local/pgsql/bin/*    /usr/bin

su - postgres

initdb -D /usr/local/pgsql/data/

postgres -D /usr/local/pgsql/data/ > /usr/local/pgsql/data/logfile 2>&1 &

ps -A|grep postgres
17393 pts/0    00:00:00 postgres
17395 ?        00:00:00 postgres
17396 ?        00:00:00 postgres
17397 ?        00:00:00 postgres
17398 ?        00:00:00 postgres

cd /etc/rc.d/

vi rc.pgsql

#!/bin/sh
# Start/stop/restart postgresql.
#
# PostgreSQL Startup Serveice Designed By Mehdi Sadighian.
#
# To start PostgreSQL automatically at boot, be sure this script is executable:
# chmod 755 /etc/rc.d/rc.pgsql

# Start PostgreSQL:
start() {
   # Check if the postgres exist
    sleep 2
    if [ -x /usr/local/pgsql/bin/postgres ]; then
    # Check if the postgres running now
    if  ps -A|grep postgres > /dev/null; then
                                echo "The process is running Now"
                                exit 0
                                        else
                                        echo "Starting PostgreSQL Server..."
                                        su - postgres -c "/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data/ > /usr/local/pgsql/data/logfile 2>&1 &"
                                        exit 0
   fi
    fi
}

# Stop PostgreSQL:
stop(){
    # Check if the postgres running now
            if  ps -A|grep postgres > /dev/null; then
                        killall postgres
                        echo "stopped"
                        exit 0
                                else
                                echo "the process is not running"
                                exit 0
    fi
}
# Restart PostgreSQL:
restart() {
/etc/rc.d/rc.pgsql stop
/etc/rc.d/rc.pgsql start
}

case "$1" in
'start')
  start
  ;;
'stop')
  stop
  ;;
'restart')
  restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac
chmod 755 rc.pgsql

cd rc3.d/

ln -sn /etc/rc.d/rc.pgsql  ./S.pgsql

/etc/rc.d/rc.pgsql restart

PyGreSQL:

cd /usr/src/

wget http://pygresql.org/files/PyGreSQL.tar.gz

tar -zxvf PyGreSQL.tgz

cd PyGreSQL-5.0.3

python setup.py build

python setup.py install

IBSng Installation:

1.    Create IBSng database and ibs user.
2.    Edit “pg_hba.conf” file to tell the PostgreSQL, trust “ibs” user from the local computer to access “IBSng” database.
3.    Restart the PostgreSQL.
4.    Add /usr/local/pgsql/lib to the /etc/ld.so.conf file.
5.    Use “ldconfig” to create the necessary libraries links and cache.
6.    Get the latest IBSng free version from http://ibs.sourceforge.net/ (A1.24) . if you are going to install the IBSng on other distribution, the best way is to download the IBSng iso file that is a Debian Linux included IBSng free. You could get it from:  http://sourceforge.net/project/downloading.php?group_id=89337&filename=IBSng-A1.24-LinuxDistro-cd-v1.iso
7.    Extract it.
8.    Move it to /usr/src and extract it, then move the extracted directory to /usr/local
9.    Execute “setup.py” for installing the IBSng.
10.    Choose 1,2,2,1 and then enter the system password, then choose 1, 2, 3 then enter “/etc/httpd” as apache config directory then choose 5, 1, 3, 1, 3 then press b for backing to the main menu and x for exiting the setup program.
11.    Start the IBSng service.
12.    Go to “/var/www/htdocs” directory and make a link to “/usr/local/IBSng/interface/IBSng”
13.    Make an index.html file to point the “/IBSng/user” directory.
14.    Add IBSng Service to the /etc/rc.local file to start automatically at boot time. It will not start correctly if you use sysvint support.
15.    Brows the server IP Address (as I have here http://192.168.0.1) to see the IBSng users login page.
16.    Use http://serverip/IBSng/admin to see the IBSng admin login page.
17.    Use “system” as username and the password you specified in setup program.

su - postgres

createuser ibs -s

createdb IBSng

createlang plpgsql IBSng

logout

vi /usr/local/pgsql/data/pg_hba.conf

add this line:

local IBSng ibs trust

then continue:

/etc/rc.d/rc.pgsql restart

echo "/usr/local/pgsql/lib/" >> /etc/ld.so.conf

ldconfig
cd /usr/src

wget http://downloads.sourceforge.net/project/ibs/IBSng/IBSng-A1.24/IBSng-A1.24.tar.bz2?use_mirror=garr

tar -jxvf IBSng-A1.24.tar.bz2

mv IBSng /usr/local/

cd /usr/local/IBSng/scripts

./setup.py

choose 1(Install)
choose 2(Test DB Connection And Continue)
choose 2(Compile configuration and continue)
choose 1(Import tables and continue)
Please Enter System Password:

Choose 1(Copy ibs.conf o ‘/etc/httpd/conf.d’
Choose 2(chown apache directories to ‘apache’)
Choose 3(Change apache config directory)
/etc/httpd
Choose 5(Continue)
Choose 1(Copy Logrotate Conf to /etc/logrotate.d)
Choose 3(Continue)
Choose 1(Copy Redhat init file to /etc/init.d)
Choose 3(Continue)
Choose b (Back to main menu)
Choose x (Exit)

/etc/init.d/IBSng start

echo "/etc/init.d/IBSng start" >> /etc/rc.d/rc.local

cd /var/www/htdocs/

rm -rf index.html

vi index.html

<html>
<meta http-equiv="REFRESH" content="0;url=/IBSng/admin/"></HEAD>
</html>
ln -sn /usr/local/IBSng/interface/IBSng/   /var/www/htdocs

It’s ready to use, surf http://yourip/IBSng/admin/   , it will show the IBSng admin login page.

You can see the IBSng logs under “/var/log/IBSng”.

Backup:

pg_dump -U ibs -W IBSng > IBS.sql

Restore:

/etc/init.d/IBSng stop

dropdb -U ibs IBSng

createdb -U ibs IBSng

createlang -U ibs plpgsql IBSng

psql -U ibs -W IBSng < IBS.sql

/etc/rc.d/rc.pgsql restart

Note: pygresql on slackware 64 bit:

cp /usr/local/lib/python2.3/site-packages/* /usr/lib64/python-2.3/lib/python2.3/

 

By: Mehdi Sadighian
Contact: mehdi.sadighian@hotmail.com
TAG: slackware, slackware 14.1, postgresql,PyGresql, python, IBSng, IBS