Installing koha on Debian-lenny

Leave a comment

I have written it from my practical experience

log on as a root uer

Edit your /etc/apt/sources.list file and add the following:

# Index Data
deb http://ftp.indexdata.dk/debian lenny main
deb-src http://ftp.indexdata.dk/debian lenny main

localhost:~#wget http://ftp.indexdata.dk/debian/indexdata.asc
localhost:~#apt-key add indexdata.asc

Download koha adn unzip it:

wget http://download.koha.org/koha-3.00.06-stable.tar.gz

localhost:~#tar xvzf koha-3.00.06.tar.gz

localhost:~#cd root/koha-3.00.06

localhost:~/koha-3.00.03# apt-get update

open synaptic pakage manager and mark the following package for install

apache2
apache2-doc
apache2-mpm-event
apache2-mpm-worker
apache2-src
curl
daemon
ftpd
git-core
git-email
libapache2-mod-perl2
libapache2-mod-perl2-dev
libapache2-mod-python
libmysqlclient15-dev
mysql-client
mysql-server
libdbd-mysql
mysql-admin
libdbd-sqlite3
libdbd-sqlite3-perl

Edit koha-debian source package list

localhost:~/koha-3.00.06#gedit root/koha-3.00.03/install_misc/debian-lenny.packages

(In this file delete apache2 install, apache2-mpm-worker install, libdbd-mysql-perl install,
libdbd-mysql-perl install, libdbd-sqlite3-perl install, libdbi-perl install, mysql-server install )
related lines and save the file and then run the following commands. Since we have
separately installed those files through Synaptic we will not install those files through
dselect).

Run the following command to select remaining packages

localhost:~/koha-3.00.06#dpkg –set-selections < install_misc/debian-lenny.packages

localhost:~/koha-3.00.06#sudo apt-get install dselect

localhost:~/koha-3.00.06# dselect

Choose [I]nstall and accept packages to be installed (hit return) (may take a while)
Choose [C]onfigure, [R]emove and [Q]uit until dselect has completed.
Say “yes” to delete any previously downloaded .deb files
Now there is need to download separately all PERL modules which are not installed by
“dselect”
command. Login again as root and on root type. If you are using CPAN for the first time it
will ask whether CPAN should configure as much as automatically say “yes” here and keep
pressing default values until the CPAN installation of each module is over where you will
see “make install ok” option.

Install missing perl module for koha through cpan:

localhost:~/koha-3.00.06#cpan Algorithm::CheckDigits Class::Adapter GD::Barcode
localhost:~/koha-3.00.06# cpan HTTP::OAI JSON Params::Util PDF::Reuse::Barcode
localhost:~/koha-3.00.06# cpan SMS::Send Storable Test::Simple GD Text::CSV
localhost:~/koha-3.00.06# cpan PDF::API2 HTML::Template::Pro Text::CSV_XS

Add user for koha:

localhost:~/koha-3.00.06#adduser koha
[It is essential only if you have not created koha
as a user while Debian Installation].

Make KOHA Environments:
localhost:~/koha-3.00.06#nano /etc/profile
(add the following lines in profile file at the end and save and exit)

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

UTF-8 Encoding in Apache:-
localhost:~/build/koha-3.00.06# gedit /etc/apache/apache2.conf
(Add following three lines at the end of the file in apache2.conf and save and exit)
#UTF8 support for apache2
ServerName localhost
#[Here you should use your computer name i.c host name instead of“localhost”]
AddDefaultCharset UTF-8
AddCharset UTF-8 .utf8

UTF-8 Encoding in MySQL:
localhost:~/build/koha-3.00.03# gedit /etc/mysql/my.cnf
(open my.cnf file and add after the “Basic Setting” and after skip-external-locking line add
the following lines)
# UTF-8 Defaults for Koha
init-connect=”SET NAMES utf8”
character-set-server=utf8
default-character-set=utf8
collation-server=utf8_general_ci
character_set_client=utf8
localhost:~/koha-3.00.06# gedit /etc/apache2/ports.conf
(open ports.conf file and below Listen 80 add following line and save file and exit)
Listen 8080

Create Database for KOHA:

localhost:~/koha-3.00.06#mysql -u root -p
(Enter mysql root password)
mysql>create database koha;
mysql>grant all privileges on koha.* to ‘root’@’localhost’ identified by ‘password’;
mysql>flush previleges;

Now runfollowing commands to install Koha:

localhost:~/koha-3.00.06# perl Makefile.PL

(If installation process ends with any missing PERL modules, try to
install those missing modues from a terminal and tying cpan and module name and then
again try above perl Makefile.PL command.)

Here default values of Makefile.PL commnand

# Choose the following options:
Installation mode (dev, single, standard) [standard] = standard
Base installation directory [/usr/share/koha] = /usr/share/koha
User account [koha] = koha
Group [koha] = koha
DBMS to use (Pg, mysql) [mysql] = mysql
Database server [localhost] = localhost
Please specify the port used to connect to the DMBS [3306] = 3306
Please specify the name of the database to be used by Koha [koha] = koha
Please specify the user that owns the database to be used by Koha [kohaadmin] kohaadmin
NOTE:This user (kohaadmin) and password are both the MySQL login/pwd and the web
admin interface login/pwd.
Please specify the password of the user that owns the database to be used by Koha
[katikoan]
= katikoan (or you can select the password as you wish)
Install the Zebra configuration files? (no, yes) [yes] = yes
MARC format for Zebra indexing (marc21, unimarc) [marc21] = marc21
Primary language for Zebra indexing (en, fr) [en]
Authorities indexing mode (dom, grs1) [grs1] = grs
Please specify Zebra database user [kohauser] = kohauser
Please specify the Zebra database password [zebrastripes] = zebrastripes [you can select
your own password here]
Install the SRU configuration files? (no, yes) [yes] = yes
SRU Database host? [localhost] = localhost
SRU port for bibliographic data? [9998] = 9998
SRU port for authority data? [9999] = 9999
Install the PazPar2 configuration files? [no] = no
Would you like to run the database-dependent test suite? (no, yes) [no] = no))))

localhost:~/koha-3.00.06~# make
localhost:~/koha-3.00.06~#make test
localhost:~/koha-3.00.06~#make install

Setting up Environmental Variables

localhost:~/koha-3.00.06# export KOHA_CONF=/etc/koha/koha-conf.xml
localhost:~/koha-3.00.06# export PERL5LIB=/usr/share/koha/lib

Configure Koha ,apache and zebra
localhost:~/koha-3.00.06#ln -s /etc/koha/koha-httpd.conf /etc/apache2/sites-available/koha
localhost:~/koha-3.00.06#sudo a2enmod rewrite
localhost:~/koha-3.00.06#sudo a2ensite koha
localhost:~/koha-3.00.06#sudo apache2ctl restart
localhost:~/koha-3.00.06# ln -s /usr/share/koha/bin/koha-zebra-ctl.sh /etc/init.d/koha-zebra-
daemon
localhost:~/koha-3.00.06# sudo update-rc.d koha-zebra-daemon defaults
localhost:~/koha-3.00.06# ln -s /usr/share/koha/bin/koha-zebraqueue-ctl.sh /etc/init.d/koha-
zebraqueue-daemon
localhost:~/koha-3.00.06#sudo update-rc.d koha-zebraqueue-daemon defaults

Advertisements

Configuring Virtual Host

Leave a comment

Configure Virtual Hosting Link

There are different ways to set up Virtual Hosts, however we recommend the method below.

By default, Apache listens on all IP addresses available to it. We must configure it to listen only on addresses we specify. Even if you only have one IP, it is still a good idea to tell Apache what IP address to listen on in case you decide to add more.

Begin by modifying the NameVirtualHost entry in /etc/apache2/ports.conf so that the line reads:

File excerpt: /etc/apache2/ports.conf

NameVirtualHost 12.34.56.78:80

Be sure to replace “12.34.56.78” with your Linode’s public IP address.

Now, modify the default site’s VirtualHost in the /etc/apache2/sites-available/default file so that the entry reads:

File excerpt: /etc/apache2/sites-available/default

Configure Virtual Hosts Link

You can create as many virtual hosting files as you need to support the domains that you want to host with your Linode. First, create a file in the /etc/apache2/sites-available/ directory for each virtual host that you want to set up. Name each file with the domain for which you want to provide virtual hosting. See the following example configurations for the hypothetical “ducklington.org” and “bucknell.net” domains.

File: /etc/apache2/sites-available/duckington.org

ServerAdmin squire@ducklington.org
ServerName ducklington.org
ServerAlias http://www.ducklington.org
DocumentRoot /srv/www/ducklington.org/public_html/
ErrorLog /srv/www/ducklington.org/logs/error.log
CustomLog /srv/www/ducklington.org/logs/access.log combined

File: /etc/apache2/sites-available/bucknell.net

ServerAdmin squire@bucknell.net
ServerName bucknell.net
ServerAlias http://www.bucknell.net
DocumentRoot /srv/www/bucknell.net/public_html/
ErrorLog /srv/www/bucknell.net/logs/error.log
CustomLog /srv/www/bucknell.net/logs/access.log combined

Notes regarding this example configuration:

* All of the files for the sites that you host will be located in directories that exist underneath /srv/www You can symbolically link these directories into other locations if you need them to exist in other places.
* ErrorLog and CustomLog entries are suggested for more fine-grained logging, but are not required. If they are defined (as shown above), the logs directories must be created before you restart Apache.

Before you can use the above configuration you’ll need to create the specified directories. For the above configuration, you can do this with the following commands:

mkdir -p /srv/www/ducklington.org/public_html
mkdir -p /srv/www/ducklington.org/logs
mkdir -p /srv/www/bucknell.net/public_html
mkdir -p /srv/www/bucknell.net/logs

After you’ve set up your virtual hosts, issue the following commands:

a2ensite ducklington.org
a2ensite bucknell.net

This command symbolically links your virtual host file from sites-available to the sites-enabled directory. Finally, before you can access your sites you must reload Apache with the following command:

/etc/init.d/apache2 reload

Should you ever need to disable a site, you can use the a2dissite command. For example, if you wanted to disable the duckington.org site, you would issue the following command:

a2dissite ducklington.org

The a2dissite command does the opposite of the a2ensite command.

Remember, after enabling, disabling, or modifying any part of your Apache configuration you will need to reload the Apache configuration again with the /etc/init.d/apache2 reload command.

Assuming that you have configured the DNS for your domain to point to your Linode’s IP address, Virtual hosting for your domain should now work.

Installing Lamp server on Debian

Leave a comment

aptitude update && aptitude upgrade

First Install apache2

aptitude install apache2 apache2-doc

Then install mysql

# aptitude install mysql-server mysql-client

# /usr/bin/mysqladmin -u root password ‘your-password-here’

Next install php

# aptitude install php5 php5-mysql libapache2-mod-php5

If you want to install perl,or python or both

# aptitude install perl libapache2-mod-perl2

# aptitude install python libapache2-mod-python

test php

# nano /var/www/apache2-default/test.php

add the following code

Install phpmyadmin

# aptitude install phpmyadmin

To have access to phpMyAdmin on your website (i.e. http://example.com/phpmyadmin/ ) all you need to do is include the following line in /etc/apache2/apache2.conf:

Include /etc/phpmyadmin/apache.conf

Restart Apache

# /etc/init.d/apache2 restart

Access mysql

mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD(‘new-password’) WHERE user=’root’;
mysql> FLUSH PRIVILEGES;

Backup and Restore Mysql Database

Leave a comment

Backup Full Database and Restore

backup: # mysqldump -u root -p database_name > yourfilename.sql

restore:# mysql -u root -p database_name < yourfilename.sql Backup multiple databases:

mysqldump -u root -p –databases vufind koha > nurahammad.sql

Check the nurahammad.sql dumpfile contains both the database backup.

grep -i “Current database:” /tmp/bugs_sugarcrm.sql
— Current Database: `vufind`
— Current Database: `koha`

All the databases Backup:

mysqldump -u root -p –all-databases > /build/all_nurahammad.sql

By Using Single Command restore database from a remote pc to server:

mysqldump -u root -ptmppassword sugarcrm | mysql \
-u root -p –host=remote-server -C koha
[Note: There are two — (hyphen) in front of host]

backup your MySQL tables and data every night using a bash script and cron.

This tutorial will show you how to write a simple bash shell script which will extract your database schema, compress the data and email you the backup. Utilising cron, this script can be configured to run in the early hours of the morning when your web server is least active.
After completing your database enabled web site, you need an automated method for backing up all that valuable data. Below is a bash shell script which can be used to backup all your clients databases using a nightly cron job.

Bash Shell Script (mysqlbackup)

#!/bin/sh
mysqldump -uroot -ppwd --opt db1 > /sqldata/db1.sql
mysqldump -uroot -ppwd --opt db2 > /sqldata/db2.sql

cd /sqldata/
tar -zcvf sqldata.tgz *.sql
cd /scripts/
perl emailsql.pl

A bash script is a text file containing commands that can be interpreted by the bash shell. Above is a cut down version of the original script which I keep in a directory called /myscripts/. This is important for when we look at adding the script to the cron tab.
The first line of the script tells the operating system (Unix) where to find the bash interpreter, you may need to change this line to work on your systems. The second and third lines call the MySQL utility mysqldump which is used to export the data, the output from this command is then piped into a text file.
For example the first mysqldump statement has 4 parameters passed to it :-

  • -u = your MySQL username. (substitute root with your username)
  • -p = your MySQL password. (substitute pwd with your password)
  • –opt adds the most common and useful command line options, resulting in the quickest possible export. This option automatically includes –add-drop-table, –add-locks, –extended-insert, –quick and –use-locks.
  • the database name to extract. (substitute db1 with your database name)
  • the > /sqldata/db1.sql redirects all the output to a file called db1.sql in a directory /sqldata/. You can create the file in any directory you have rights to, however for consistency I would suggest naming the resulting .sql file the same as the database name.

You simply repeat this process for each database you want to backup. The following line changes directory to the /sqldata/ directory and performs a tar compression adding all the .sql files into one archive file called sqldata.tgz. After changing back to the scripts directory I finally run a Perl script (emailsql.pl) which attaches the sqldata.tgz archive to an email and forwards it to two offsite email accounts. Alternatively you could ftp the sqldata.tgz to an offsite machine.
After creating the script, you need to make it executable by CHMODing the file permissions to 700. At this point you should be able to test the script by entering /myscripts/mysqlbackup from the shell prompt.

The emailsql.pl script.

The example Perl script below shows how you can attach the archive to an email, and send it to your email inbox. This Perl script requires the MIME::Lite Module which you may need install on your server. (How to install Perl Modules).

#!/usr/bin/perl -w
use MIME::Lite;

$msg = MIME::Lite->new(
From => mysqlbackup@yoursite.co.uk,
To => you@yoursite.co.uk,
Subject => sqldata.tgz MySQL backup!,
Type => text/plain,
Data => "Here are the MySQL database backups.");

$msg->attach(Type=>application/x-tar,
Path =>"/sqldata/sqldata.tgz",
Filename =>"sqldata.tgz");

$msg->send;

Adding the Script to Cron

Cron is a scheduling tool for Unix, it allows you to specify when a program or script should be run. To edit your current cron table, enter crontab -e from the system prompt. This will load your current cron table into your default text editor, when you save and exit your editor the crontab file will be loaded and ready for use.


0 2 * * * /myscripts/mysqlbackup
0 5 * * 0 /myscripts/reindex

The above example shows my current crontab. The file has two entries, one for each script I wish to run. The first entry tells cron to run the mysqlbackup script every morning at 2am. The second entry runs my search engine indexer every Sunday morning at 5am.
There are five fields for setting the date and time that a program should be run. The five time settings are in the following order.

  • Minutes – in the range of 0 – 59
  • Hour – in the range of 0 – 23
  • Day of month – in the range 1 – 31
  • Month – in the range 1 -12
  • Day of week – in the range 0 – 6 (0 = Sunday)

Any field with a * means run every possible match, so for example a * in the day of month field will run the script every single day of the month at the specified time.

Additional References

http://paulbradley.tv/38/

Install sun-java6-jdk on Ubuntu lucid

Leave a comment

Add repository – sudo add-apt-repository “deb http://archive.canonical.com/ lucid partner”

Then install – sudo sun-java6-jdk

Install webmin on Debian/ubuntu

Leave a comment

Must have:

sudo apt-get install perl libnet-ssleay-perl libnet-ssleay-perl libauthen-pam-perl libio-pty-perl apt-show-versions

After that
Download webmin-1.510.tar.gz from any source

Go to http://www.webmin.com/download.html

Go your webmin-1.510.tar.gz location and unzip it

unzip:
sudo tar xzvf webmin-1.500.tar.gz

cd /webmin

sudo sh setup.sh

Config file directory [/etc/webmin]:
Leave as default, or change as you wish

Log file directory [/var/webmin]:
Leave as default, or change as you wish

Full path to perl (default /usr/bin/perl):
Leave as default, or change as you wish

Operating system:
Enter ‘6′

Version:
Enter ‘6′

Web server port (default 10000):

Login name (default admin):

Login password:

Password again:

enter your password again

Hint
If you did not install ‘libnet-ssleay-perl’ you will get the following message:

‘The Perl SSLeay library is not installed. SSL not available.’ You can continue with the install, but it would be more secure if you install sslrelay.

Use SSL (y/n):y
Choose yes here

Start Webmin at boot time (y/n):y
select here y

Webmin User Password Change

If you want to change root password in webmin use this included Perl script:

sudo /usr/share/webmin/changepass.pl /etc/webmin root

If you are using the DEB version of webmin, first download the file and then run the command :

dpkg –install webmin_1.520_all.deb

if you get error message then try: apt-get -f install

Install Using the Webmin APT repository

If you like to install and update Webmin via APT, edit the /etc/apt/sources.list file on your system and add the line :
deb http://download.webmin.com/download/repository sarge contrib

You should also fetch and install my GPG key with which the repository is signed, with the commands : cd /root
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc
You will now be able to install with the commands : apt-get update
apt-get install webmin
All dependencies should be resolved automatically.

Configuring Your Firewall For Webmin

Many operating systems block access to port 10000 by default, as they have a firewall activated as part of the installation process. This may prevent you from logging into http://yourserver:10000/ from another system on your network or over the Internet.

The simplest way to open up port 10000 is to use one of the Webmin firewall management modules, such as Linux Firewall, BSD Firewall or IPFilter Firewall. However, to access this you’ll need to run a brower on the same system as Webmin, and access it via the URL http://localhost:10000/.

The alternative is to login as root via SSH, and manually edit the firewall configuration file. On Redhat and derived systems, this is /etc/sysconfig/iptables, while on Debian it is /var/lib/iptables. The line you need to add is :

-A INPUT -p tcp -m tcp –dport 10000 -j ACCEPT

It should be added in the file just after similar lines which grant access to ports 80, 22 and so on.

Once this line has been added, you will need to apply the firewall configuration. This is typically done with the command /etc/init.d/iptables restart .

Zebra Search and Multilingual Problem in koha

Leave a comment

can apply patches http://git.biblibre.com/cgi-bin/gitweb.cgi?p=koha;a=commitdiff_plain;h=b4068c1da33de36019bf4192150b6234bb8c7dbf;hp=a739ed37ef5e289cf6ac9815acd9fc6ede052bfc
OR do the following

#sudo apt-get install libicu-dev libicu38 yaz-icu

Copy following files from /usr/share/idzebra-2.0/tab/
to /etc/koha/zebradb/etc/
icu.idx
phrases-icu.xml
string.chr
words-icu.xml

Copy /etc/koha/zebradb/etc/words-icu.xml to /etc/koha/zebradb/etc/icu.xml

Edit /etc/koha/zebradb/etc/icu.xml change to

Save and change ownership of all copied files to koha:koha

#sudo chown -R koha:koha /etc/koha/zebradb/etc

Edit /etc/koha/zebradb/zebra-biblios.cfg
add line
index: icu.idx

Restart zebra server and queue daemons
#sudo /etc/init.d/koha-zebra-daemon restart
#sudo /etc/init.d/koha-zebraqueue-daemon restart

Rebuild 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

Using yaz-client to verify zebra is working
#az-client
z>auth kohauser zebrastripes
z>open unix:/var/run/koha/zebradb/bibliosocket
z>base biblios
z>f
z>s
z>q

Adjusting Koha System Preferences to correctly search our multilingual data
In Koha staff client
Home → Administration → System Preferences → Searching
Turn off QueryFuzzy ( maybe and QueryWeightFields)

If you have problem after doing above then try:
 
Zebra configuration
Open a terminal and login as root
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

Edit the following 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. Result is,
#!/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 
sudo chmod -R 777 /etc/koha/zebradb/etc
sudo chown -R koha:koha /etc/koha/zebradb/etc
sudo chmod -R 777 /usr/share/koha
sudo chown -R koha:koha /usr/share/koha
sudo chmod -R 777 /var/run/koha/zebradb
sudo chown -R koha:koha /var/run/koha/zebradb
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]
crontab -e

Change the locations in following lines ,

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

#Some additional variables
KOHA_CRON_PATH=/usr/share/koha/bin/cronjobs

Save the file by pressing ctrl+o buttons
Press enter
Quit the editor by pressing ctrl+X buttons

Starting Zebra Server

Open a terminal and type following commands,

sudo su
cd /usr/share/koha/bin
sh koha-zebra-ctl.sh start
sh koha-zebraqueue-ctl.sh start

Rebuilding Zebra Index

sudo su
export PERL5LIB=/usr/share/koha/lib
cd /usr/share/koha/bin/migration_tools

Quick Indexing
 ./rebuild_zebra.pl -b -w  (or)
./rebuild_zebra.pl -b -w -r

Rebuilding Index
./rebuild_zebra.pl -v -b -a -r

(‘./rebuild_zebra.pl -a -b -r -v’)

This can happen when a marc record is too large. Never fear there is a
very very easy solution.

Run 2 commands

./rebuild_zebra.pl -b -x
./rebuild_zebra.pl -a

Older Entries

%d bloggers like this: