This is the installation manual for the LIBPF™ (LIBrary for Process Flowsheeting) runtime on Linux operating systems, for the model user who wants to install a LIBPF runtime (LIBPF kernel + UIPF) she received from a model developer.

Currently only the manual installation procedure is available on Linux (i.e. the runtime is not available as a yum or deb package).

Prerequisites

Debian

The following has been tested on Debian 8.0 Jessie (the stable version at the time of writing).

If your runtime has been prepared for a different release (such as 7.0 Wheezy, 6.0 Squeeze or 9.0 Stretch) it should be possible to adapt the procedure as required.

As root install the XZ utils and tar (necessary to extract the files) and the requirements for the runtime:

apt-get install xz-utils tar libmxml1 libcxsparse3.1.2 liblapack3 libsundials-ida2 libpq5 libcurl3

Ubuntu

The following procedure has been tested on Ubuntu 14.04 LTS Trusty Tahr.

If your runtime has been prepared for a different release (such as 15.10 Wily Werewolf or 16.04 LTS Xenial Xerus) it should be possible to adapt the procedure as required.

sudo apt-get install xz-utils libmxml1 liblapack3 libpq5 libcxsparse3.1.2 libjsoncpp0

Fedora 64 bit

Tested on Fedora 18.

Replace the apt-get statements as root with:

yum install qt-x11-4.8.4-1.fc18.x86_64 qt-postgresql-4.8.4-1.fc18.x86_64 lapack-3.4.1-2.fc18.x86_64 mxml-2.5-8.fc18.x86_64

To find the right packets to install, see this post: Installing .so libraries on a 64-bit Fedora with yum

for example:

ldd LIBPF_install/UIPF | grep 'not found'
ldd ./LIBPF_1.0/Qsale_pepe | grep 'not found'
yum whatprovides libQtSvg.so.4

there is no package for:

  • libcrypto.so.1.0.0

  • libsiloh5.so.0

  • libsiloh5.so

  • libcxsparse.so.2.2.3

  • libsundials_ida.so.2

Install

  • get LIBPF_install.tar

  • extract LIBPF_install archive

    xz -d LIBPF_install.tar.xz
    tar xf LIBPF_install.tar
    rm LIBPF_install.tar
    
  • set up environment variables (only required for installation):

    export home_path=~/LIBPF_1.0
    export kernel_path=~
    export active_kernel=LIBPF_1.0
    
  • create a directory $active_kernel in $kernel_path

    test -d $kernel_path/$active_kernel || mkdir -p $kernel_path/$active_kernel
    
  • create the sample config file:

    test -d ~/.config || mkdir -p ~/.config
    test -d ~/.config/libpf.com || mkdir -p ~/.config/libpf.com
    echo '[1.0]' > ~/.config/libpf.com/LIBPF.conf 
    echo home_path=~/LIBPF_1.0 >> ~/.config/libpf.com/LIBPF.conf 
    echo kernel_path=~ >> ~/.config/libpf.com/LIBPF.conf 
    echo active_kernel=LIBPF_1.0 >> ~/.config/libpf.com/LIBPF.conf 
    echo kernel_name=Qsale_pepe >> ~/.config/libpf.com/LIBPF.conf
    
  • as root create an empty system-wide configuration file

    sudo mkdir -p /etc/xdg/libpf.com
    sudo touch /etc/xdg/libpf.com/LIBPF.conf
    
  • now create the doods file:

    echo rm streamtable.ods > $kernel_path/doods
    echo zip streamtable.ods content.xml META-INF/manifest.xml meta.xml mimetype >> $kernel_path/doods
    
  • then make it executable:

    chmod u+x $kernel_path/doods
    
  • copy files from LIBPF_install directory:

    mv LIBPF_install/types.txt $kernel_path/$active_kernel/.
    mv LIBPF_install/Qsale_pepe $kernel_path/$active_kernel/.
    mv LIBPF_install/meta.xml $home_path/.
    mv LIBPF_install/mimetype $home_path/.
    mv LIBPF_install/libpf_activation $home_path/.
    mv LIBPF_install/META-INF $home_path/.
    mv LIBPF_install/UIPF $home_path/.
    
  • remove the temporary install directory

    rm -rf LIBPF_install
    

Database configuration

PostgreSQL

PostgreSQL is the default database for LIBPF on Linux.

Log in as root and install PostgreSQL:

apt-get install postgresql libqt5sql5-psql

(the Qt package is required if you intend to use the UIPF user interface; install libqt4-sql-psql on older systems).

Still as root edit the PostgreSQL authentication settings to allow any user on the machine to log onto PostgreSQL as user libpf (note that 9.4 is the PostgreSQL version on Debian Jessie - change that to 7.4 on Etch, 8.4 on Squeeze and 9.1 on Wheezy):

vi /etc/postgresql/9.4/main/pg_hba.conf

add this line:

    local   persistency     libpf                                   md5
  • before this one for more recent versions up to 9.4:

    # "local" is for Unix domain socket connections only
    local   all             all                                     peer
    
  • or before this one for older versions:

    # "local" is for Unix domain socket connections only
    local   all         all                               ident sameuser
    

Now restart PostgreSQL to make sure changes are picked up; the command to restart the database engine on Debian Jessie the command is:

systemctl restart postgresql

while on Debian Squeeze and Wheezy it is:

service postgresql restart

and on Debian Lenny it is:

pg_ctlcluster 8.4 main reload

Test the connection:

PGPASSWORD="libpf" psql -U libpf persistency
\q

Still as root impersonate the postgres administrative user and create the database user libpf and the persistency database:

su - postgres
psql
create user libpf password 'libpf';
create database persistency owner libpf;

Now exit the psql command by typing '\q', exit the PostgreSQL shell by typing "exit" and quit the root session by typing "exit".

Next log in as un unprivileged user and create the required tables:

PGPASSWORD="libpf" psql -U libpf persistency < ~/LIBPF_install/persistency_postgres.sql

If you need to completely delete this stuff, log in as root and perform these steps:

su - postgres
dropdb persistency
dropuser libpf
exit

Sqlite

  • install sqlite and the required library:

    apt-get install sqlite3 libsqlite3-0 libqt5sql5-sqlite
    

    (the Qt package is required if you intend to use the UIPF user interface; install libqt4-sql-sqlite on older systems).

  • create the file persistency.db and copy it to $home_path/.

    cat ~/LIBPF_install/persistency.sql | sqlite3 $home_path/persistency.db
    

MySQL

Check that MySQL daemon is up and running (as root):

netstat -tap | grep mysql
tcp        0      0 localhost:mysql         *:*                     LISTEN      1397/mysqld

Optional: set MySQL root password

mysqladmin -u root password nuovapasswordrootsql

Check that the server is up and responding to connections:

mysqladmin -p -u root version
mysqladmin -p -u root variables

Create libpf user:

mysql -p -u root
GRANT SELECT, INSERT, UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES, CREATE TEMPORARY TABLES, DROP, REFERENCES ON libpf.* TO libpf@localhost IDENTIFIED BY '';
FLUSH PRIVILEGES;

Create database

mysqladmin -p -u libpf status
mysqladmin -p -u libpf drop libpf
mysqladmin -p -u libpf create libpf

Connect to database and create tables:

mysql -p -u libpf libpf
mysql> source ~/LIBPF_install/persistency.sql;
mysql> show tables;
+-----------------+
| Tables_in_libpf |
+-----------------+
| CATALOG         |
| ETBL            |
| ITBL            |
| QTBL            |
| STBL            |
| TC              |
+-----------------+
6 rows in set (0,00 sec)
mysql> \q

ODBC

ODBC is an additional layer, since native (SQLITE, mysql and PostgreSQL) drivers are available on Linux, it does not make sense to use ODBC.

Nonetheless, here are the instructions to set it up; you'll require either PostgreSQL or MySql set up beforehand (see above).

Note: rather than modifying the odbc.ini and odbcinst.ini files you can also use the graphical tool iodbcadm-gtk.

odbcinst.ini

If you use iodbcadm-gtk, go to the ODBC Drivers tab; the file is either in /etc/odbcinst.ini or in /home/myuser/.odbcinst.ini.

[ODBC Drivers]
PostgreSQL ODBC driver (Unicode version) = Installed
MySql = Installed

[PostgreSQL ODBC driver (Unicode version)]
Driver  = /usr/lib/odbc/psqlodbcw.so
Setup   = /usr/lib/odbc/libodbcpsqlS.so
CommLog = 1
Debug   = 0

[MySql]
Driver = /usr/lib/odbc/libmyodbc.so
Setup  = /usr/lib/odbc/libodbcmyS.so

odbc.ini

Create a user DSN called persistency. The underlying configuration file is either in /etc/odbc.ini or in /home/myuser/.odbc.ini

PostgreSQL:

[ODBC Data Sources]
persistency = PostgreSQL ODBC driver (Unicode version)

[persistency]
Driver      = /usr/lib/odbc/psqlodbcw.so
Description = LIBPF database
Port        = 5432
Protocol    = 6.4
ReadOnly    = No
Servername  = localhost
Database    = persistency

[ODBC]
Trace         = 0
TraceAutoStop = 0
TraceFile     = /home/myuser/sql.log

MySQL:

[ODBC Data Sources]
persistency = MySql

[persistency]
Driver      = /usr/lib/odbc/libmyodbc.so
Description = LIBPF database
database    = libpf
server      = localhost
user        = libpf

Test

Log in as any user, type:

iodbctest "DSN=persistency"

or:

iodbctest "DSN=persistency;UID=libpf;PWD=libpf"

then at the SQL prompt type:

select * from CATALOG;
quit

Activation

Perform the activation according to the LIBPF™ Activation Guide, (English and Italian).

Uninstall

cd ~
rm -rf LIBPF_install/
rm -rf LIBPF_1.0/
rm doods
rm -rf .config/libpf.com

then as root:

sudo rm -rf /etc/xdg/libpf.com