Wiki

Clone wiki

libki-server / Libki Server Installation

Libki Kiosk Management System Server

[ Author Notes ]

I have tested this on Debian Wheezy and Squeeze. The instructions here are tailored to Debian Squeeze, but should work with all Debian based distributions (i.e. Ubuntu). This guide should also be transferable to any other Linux distribution, you will just need to use your Linux knowledge!

[ Installation ]

Dependencies

sudo apt-get install git-core mysql-server perl build-essential

Not sure if these are dependencies. If they are needed:

sudo apt-get install libdatetime-perl libdatetime-format-dateparse-perl

User Creation

Rather than running Libki as root we create a separate user to run the server. This is not mandatory but advised.

sudo useradd libki

Creates the Libki user.

sudo passwd libki

Enter the password for the Libki user. Make sure you use good password security!

mkdir /home/libki
cd /home/libki

Creates the home folder for the libki user and cd’s in.

sudo git clone https://bitbucket.org/libki-kms/libki-server.git

Downloads the server software to the current folder.

cd libki-server

Installing CPAN

sudo cpan
yes
yes
install CPAN
reload CPAN
exit

Installing Perl Modules with CPAN.

Here is the list of modules that install for me. The proper way to do this is by having all the modules listed on a single line, but for some reason this list is the only way that works for me.

sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::Runtime;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::Devel;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::Plugin::StatusMessage;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::Plugin::Session::State::Cookie;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::Plugin::Session::Store::File;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::Plugin::Authorization::Roles;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::Plugin::StackTrace;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::Authentication::Realm::SimpleDB;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::View::JSON;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::View::TT;
sudo PERL_MM_USE_DEFAULT=1 cpan String::Random;
sudo PERL_MM_USE_DEFAULT=1 cpan MooseX::MarkAsMethods;
sudo PERL_MM_USE_DEFAULT=1 cpan MooseX::NonMoose;
sudo PERL_MM_USE_DEFAULT=1 cpan DBIx::Class::TimeStamp;
sudo PERL_MM_USE_DEFAULT=1 cpan DBIx::Class::EncodedColumn;
sudo PERL_MM_USE_DEFAULT=1 cpan DBIx::Class::Numeric;
sudo PERL_MM_USE_DEFAULT=1 cpan Perl6::Junction;
sudo PERL_MM_USE_DEFAULT=1 cpan DBIx::Class::Cursor::Cached;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::Engine::HTTP::Prefork;
sudo PERL_MM_USE_DEFAULT=1 cpan Config::JFDI;
sudo PERL_MM_USE_DEFAULT=1 cpan File::Slurp;
sudo PERL_MM_USE_DEFAULT=1 cpan SQL::Script;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::Plugin::Static::Simple;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::Plugin::ConfigLoader;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::Action::RenderView;
sudo PERL_MM_USE_DEFAULT=1 cpan Log::Log4perl;
sudo PERL_MM_USE_DEFAULT=1 cpan Catalyst::Plugin::I18N;
sudo PERL_MM_USE_DEFAULT=1 cpan Modern::Perl;

Setting up MySQL

sudo mysql

Enter sudo password.

CREATE USER 'libki'@'localhost' IDENTIFIED BY 'YOURPASSWORDHERE';
GRANT ALL PRIVILEGES ON libki.* TO 'libki'@'localhost';
FLUSH PRIVILEGES;
exit
mysql -ulibki -p

Enter password.

create database libki;
show databases; 

Make sure you database has appeared.

exit

Create the Libki Config File.

sudo cp libki_local.conf.example libki_local.conf
sudo nano libki_local.conf

Change the database name, user and password to what you previously have specified. Enable or disable SIP by changing the parity bit.

Run the Libki Scripts

./installer/update_db.pl

This fills the Libki database with the necessary tables and other information.

./script/administration/create_user.pl -u *LIBKIADMINNAME* -p *LIBKIADMINPASSWORD* -s -m 999

This creates the Libki administrator. It also sets a password and a login time. The login time must be added, but is irrelevant for an admin.

./script/libki_server.pl -p *PORTNUMBER*

This sets the port number for the Libki server to run on. Set it as you wish.


..
.
Hopefully your server is running now! If not, go back and trouble shoot. Make sure the web interface is working by navigating in your browser to SERVERIP:PORTNUMBER If the server works, move on!

Creating the Cron Jobs

We need to create some timers on the server to run the Libki scripts at certain intervals. These scripts will start the server at every reboot, activate the timer, and do a nightly cleanup.

su libki

Enter your Libki user password.

crontab -e

Add in the following information:

* * * * * perl /home/libki/libki-server/script/cronjobs/libki.pl
0 0 * * * perl /home/libki/script/cronjobs/libki_nightly.pl
@reboot perl /home/libki/libki-server_01/script/libki_server.pl -p *PORTNUMBER* &

Now reboot your server and test its all being run correctly. If so, you have successfully installed a Libki Server!

Final Notes

I can confirm multiple instances of Libki can be run on the same server, however it takes a little tweaking. From here on you can customise the server as you wish, i.e. adding users from the administration page, adding library images etc.

By Christopher Vella
Commissioned by Calyx
Calyx Logo

Updated