Installing the Libki Server This guide assumes that you will be installing Libki Server on Ubuntu 8.04 Server Edition, though it should work for any Debian-based Linux distribution.
1) Create a new Linux account and name it libkiadmin
sudo adduser libkiadmin
2) Add this line to /etc/sudoers so libkiadmin can use the sudo command
libkiadmin ALL=(ALL) ALL
3) Log in as libkiadmin 4) Install the required packages
sudo apt-get install mysql-server php5 php5-cli php5-mysql apache2 cakephp cron
5) Get the Libki Server source, there are two options:
B1) Assuming we use git, we will need to install the git package
sudo apt-get install git-core
B2) Pull the source for Libki from the git repository
git clone git://libki.git.sourceforge.net/gitroot/libki/libki libkiclone
B3) In the libkiclone directory, you will see three other directories: client, integrations, and server. We only concerned with the server folder.
6) Create the Libki database in MySQL
mysqladmin -uroot -p create libki
7) Next, we need to create a MySQL user with access only to the libki database
mysql -uroot -p mysql> GRANT ALL PRIVILEGES ON libki.* TO libkiadmin@localhost IDENTIFIED BY 'some_pass'; mysql> GRANT ALL PRIVILEGES ON libki.* TO libkiadmin@'%' IDENTIFIED BY 'some_pass';
8) Create the file /etc/libki/libki.ini, the contents should look similar to this:
[Database] host = 127.0.0.1 username = libkiadmin password = some_pass database = libki
9) Next, we need to create the database structure, and load the default data into it. From the server directory, execute the commands:
mysql -ulibkiadmin -p -D libki < SETUP/libki_structure.sql mysql -ulibkiadmin -p -D libki < SETUP/libki_data.sql
Next, we need to set up the web-based administration system.
10) Create a libkiadmins group, and add libkiadmin & www-data to add, then change the group ownership of the app directory to libkiadmins. This allows apache to read and write to the app directory without giving up complete control over it.
sudo addgroup libkiadmins sudo usermod -G libkiadmins -a libkiadmin sudo usermod -G libkiadmins -a www-data chown -R libkiadmin:libkiadmins server/app chmod -R g+w server/app/tmp chmod -R 777 server/app/tmp
11) Next, create a symlink the app directory into the included cake directory and from the app/webroot directory to /var/www/libki
sudo ln -s /home/libkiadmin/libkiclone/server/app /home/libkiadmin/libkiclone/server/cake/. sudo ln -s /home/libkiadmin/libkiclone/server/cake/app/webroot /var/www/libki
12) In libkiclone/server/app/config execute
cp database.php.default database.php
13) At the bottom you will see something like the code below, edit change LOGIN to libkiadmin and PASSWORD to your mysql password for the account libkiadmin
class DATABASE_CONFIG { var $default = array( 'driver' => 'mysql', 'connect' => 'mysql_connect', 'host' => 'localhost', 'login' => 'LOGIN', 'password' => 'PASSWORD', 'database' => 'libki', 'prefix' => '' ); }
14) Next, we need to edit /etc/apache2/sites-available/default to read something like this:
<VirtualHost *:80>
DocumentRoot /var/www/libki
<Directory /var/www/libki>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
15) Enable mod_rewrite for apache, and restart the web server:
sudo a2enmod rewrite sudo apache2ctl restart
At this point, if you open a web browser and point it to the ip address of the Libki Server, you should see the Libki Web Administration login screen! Now, we need to set up the Libki daemon, which decrements the minutes used, among other things.
16) Symlink the daemon files into their proper places in the standard directory structure:
sudo ln -s /home/libkiadmin/libkiclone/server/daemon/usr/sbin/libkid /usr/sbin/libkid sudo ln -s /home/libkiadmin/libkiclone/server/daemon/etc/init.d/libki /etc/init.d/libki
17) Now we need to enable the Libki deamon to start up automatically on every boot
sudo update-rc.d libki defaults
18) Now start the daemon
sudo /etc/init.d/libki start
Execute
ps aux | grep libki
If the Libki daemon started successfully, you should see a line similar to this:
nobody 5503 0.0 1.4 17060 3800 ? S 12:03 0:00 /usr/bin/php /usr/sbin/libkid
18) Now we need to add a nightly cronjob to reset minutes and remove old guest accounts. Execute:
sudo crontab -e
Add the line below to the file to make the nightly cleanup script run at midnight each night:
00 00 * * * /home/libkiadmin/libkiclone/server/SETUP/cronjobs/libki_nightly_cron.php
19) Finally, we need to make the libki database accessible from the clients. To this, edit /etc/mysql/my.cnf and cooment out the line:
bind-address = 127.0.0.1
To read as
#bind-address = 127.0.0.1
Restart mysql by running
sudo /etc/init.d/mysql restart
Congrats! You have now completed your installation of the Libki Server!
The default login for the web administration is the username admin with the password g084MIA