Monday, January 9, 2012

Koha installation on Ubuntu 10.04

Koha Version- 3.06.02

To install Koha latest version, visit this link.

Installation of Ubuntu 10.04 LTS

Visit the link for installation steps with screen shots http://techhamlet.com/2010/05/how-to-install-ubuntu-10-04/

Installation of Koha

Type the following command in a terminal to  get super user privilege.
To open terminal, Application > Accessories > Terminal
All Linux commands should execute through Terminal.

sudo su

Update your system,

sudo apt-get update

Creating Koha system user

Open a Command Terminal and type following commands,

groupadd koha
useradd -g koha koha

sudo mkdir /build
sudo chmod -R 777 /build

Download Koha

Download koha-3.06.02 package from http://download.koha-community.org/koha-3.06.02.tar.gz
Extract the package by right click and select "Extract to".

Copy Koha package to the folder /build

mv koha-3.06.02 /build

Installation of dependencies

Following command will install MySQL, and Apache.

sudo apt-get install lamp-server^ yaz idzebra-2.0 dselect  

On the way, give root password for MySQL Root user when it ask.

cd /build/koha-3.06.02
sudo dpkg --set-selections <install_misc/ubuntu.packages   [Select Install from the list and Press Enter button]
 sudo dselect

Select "Install" option.
It began download packages from Internet. The length of this  process depend on speed of your Internet connection.
Nullmailer will ask for  email parameters. Accept the default values.

dselect menu will appear after the completion of the process. Select and press Quit to exit from the deselect.

Configuration of  UTF-8 in MySQL and Apache
Enable UTF-8 at MySQL
Open a Terminal and type following command,

sudo gedit /etc/mysql/my.cnf  
[Under the Basic settings section, add the following,]

# UTF-8 Defaults for Koha
init-connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_general_ci

Save the file [ File > Save ] and close the editor.
UTF-8 encoding in Apache
Open a terminal and type the following command,

gedit  /etc/apache2/conf.d/charset
[Add the following two lines in]

AddCharset UTF-8 .utf8
AddDefaultCharset UTF-8

Save the file and close the editor.

Enter following command to set locale on Ubuntu

sudo update-locale LANG=en_IN.UTF-8

Creation of MySQL Database for KOHA
Open a terminal and login as root and enter following commands,

mysql -u root -p
[enter mysql root password here]

Then type,

create database koha;
grant all privileges on koha.* to 'kohaadmin'@'localhost' identified by 'katikoan';
flush privileges;
quit;

Test to make sure the SAX Parser is setup correctly

Enter the following commands,

cd /build/koha-3.06.02
sudo gedit /etc/perl/XML/SAX/ParserDetails.ini

Copy and paste the following command to the bottom of the file and save it.

[XML::LibXML::SAX::Parser]
http://xml.org/sax/features/namespaces=1

Run the command again,
misc/sax_parser_print.pl

Setting environment variables

gedit /etc/bash.bashrc
Add the following lines at the bottom and save the file

export KOHA_CONF=/etc/koha/koha-conf.xml
export PERL5LIB=/usr/share/koha/lib

Save and close the file.

Koha Installation

Now KOHA can be installed by following commands:
Enter into Koha folder

cd /build/koha-3.06.02
perl Makefile.PL

Answer all questions  without any change. You can accepted the default values.
At the end you can see missing perl modules list. You have to install missing perl modules before proceed installation process.

Installation of remaining perl modules
Open a terminal from Applications > Accessories > Terminal,
Enter the following command, it will give a CPAN command prompt.
sudo cpan
Accept all default settings. 
Following is the example of CPAN command for installing a module.


install modulename

e.g.
install Business::ISBN


It ask for many confirmation on the way. Press Enter button for all questions.
In the same way install remaining perl modules.

Type quit to Exit from the CPAN mode.

Type the following commands,
cd /build/koha-3.06.02
perl Makefile.PL make
make test
sudo make install

Add the following lines to /etc/apache2/ports.conf, just below the following line Listen 80
Open a Command Terminal and type following commands


sudo gedit /etc/apache2/ports.conf

Listen 8000
Listen 8001

save the file and close.

Open a terminal and login as root
sudo su
ln -s /etc/koha/koha-httpd.conf /etc/apache2/sites-available/koha
sudo a2enmod rewrite
sudo a2ensite koha
/etc/init.d/apache2 restart

 
Zebra configuration
Open a terminal copy paste the following commands.
sudo su
sudo ln -s /usr/share/koha/bin/koha-zebra-ctl.sh /etc/init.d/koha-zebra-daemon
sudo update-rc.d koha-zebra-daemon defaults
sudo ln -s /usr/share/koha/bin/koha-zebraqueue-ctl.sh /etc/init.d/koha-zebraqueue-daemon
sudo update-rc.d koha-zebraqueue-daemon defaults

Open following files one by one and change the USER and GROUP parameters. And save the files.

sudo gedit /usr/share/koha/bin/koha-zebra-ctl.sh
sudo gedit /usr/share/koha/bin/koha-zebraqueue-ctl.sh

Change USER and GROUP to root.
#!/bin/bash
USER=root
GROUP=root

Set following folders ownership to Koha user

sudo chmod -R 777 /var/lock/koha
sudo chown -R koha:koha /var/lock/koha
sudo chmod -R 777 /var/lib/koha/
sudo chown -R koha:koha /var/lib/koha

Cronjob Settings
sudo su
cd /usr/share/koha/bin/cronjobs
crontab -u root crontab.example
crontab -u username crontab.example  [Username denotes name of your home user]
export EDITOR=gedit
crontab -e
Crontab will open in geditor.
You can change the timing of various automated activities like fine calculation, zebra etc.

Save and close the file.

Some settings for Apache,

sudo gedit /etc/koha/koha-httpd.conf

Find the following line,

## OPAC
<VirtualHost 127.0.1.1:80>

Change the port number

## OPAC
<VirtualHost *:8001>

Find this line too,

## Intranet
<VirtualHost 127.0.1.1:8080>

Change to

## Intranet
<VirtualHost 127.0.1.1:8000>

Save the file.

Goto command terminal and restart the Apaches server,

sudo /etc/init.d/apache2 restart

Run the Web installer

http://127.0.1.1:8000

It will open the Koha installer in you browser. To see the screen shots of Koha installer visit http://openlib.org/home/krichel/courses/lis508/koha/installer_screens/
Login the installer, User name: kohaadmin Password: katikoan

Read the installer instructions carefully and proceed the post installation settings.
You can login to Koha after finishing this process

URL of OPAC is http://127.0.1.1:8001



Zebra Management
These command are useful for rebuilding Zebra index while cataloging records.

Starting Zebra Server

Copy paste the  following commands in a terminal and press enter button.

sudo su
sudo /etc/init.d/koha-zebra-daemon start
sudo /etc/init.d/koha-zebraqueue-daemon start

Rebuilding Zebra Index
sudo KOHA_CONF=/etc/koha/koha-conf.xml PERL5LIB=/usr/share/koha/lib /usr/share/koha/bin/migration_tools/rebuild_zebra.pl -b -r -v

Quick Indexing
sudo KOHA_CONF=/etc/koha/koha-conf.xml PERL5LIB=/usr/share/koha/lib /usr/share/koha/bin/migration_tools/rebuild_zebra.pl -b -w