Installation Koha-3.2.2 on (Fresh) Debian Squeeze

Step-1: log in as root user or go root
sudo su
In squeeze no need to add index data repository.
Dabian packages for koha
This is an APT package repository for Debian packages of Koha, and those of its dependencies that are missing from Debian. The Debian squeeze release is supported; older versions of Debian are not supported.
Add the line in /etc/apt/sources.list
deb http://debian.koha-community.org/koha squeeze main

Add the key in gpg.asc to your APT trusted keys: 
wget -O- http://debian.koha-community.org/koha/gpg.asc | sudo apt-key add -
apt-get update

Step-2:
(now you can install koha by using:
apt-get install koha
less /usr/share/doc/koha/README.Debian
 
 These procedure is not the best) 

OR you can install koha's dependencies by using 
apt-get install koha 
then delete koha folder from different locations and skip step-2)
Install apache2 and related package:
apt-get install apache2 apache2-doc apache2-src daemon
apt-get install libapache2-mod-perl2 libapache2-mod-perl2-dev libapache2-mod-python
Install mysql server and other related package:
apt-get install mysql-server mysql-admin libmysqlclient16 libmysqlclient16-dev
Install yaz packages
apt-get install yaz yaz-doc libyaz3 libyaz3-dev
Install zebra packages
apt-get install idzebra-2.0 idzebra-2.0-common idzebra-2.0-doc idzebra-2.0-utils libidzebra-2.0-0 libidzebra-2.0-dev libidzebra-2.0-mod-alvis libidzebra-2.0-mod-grs-marc libidzebra-2.0-mod-grs-regx libidzebra-2.0-mod-grs-xml libidzebra-2.0-mod-text libidzebra-2.0-modules
Install perl packages and some others:
apt-get install libopenal1 liblingua-stem-snowball-perl libdatetime-format-mail-perl
libnet-daemon-perl libmime-types-perl libnet-ldap-perl libgraphicsmagick3 libxml-sax-perl
libmarc-record-perl libunistring0 liblingua-pt-stemmer-perl libcache-memcached-perl libnumber-format-perl libdublincore-record-perl libxml-sax-expat-perl libdata-ical-perl libdate-leapyear-perl libxml-dumper-perl libsms-send-perl esound-clients libpdf-reuse-perl libauthen-cas-client-perl libgd-gd2-noxpm-perl libyaml-syck-perl libsub-name-perl
liblingua-stem-perl libglew1.5 libsnowball-swedish-perl libtext-vfile-asdata-perl
libclass-factory-util-perl libdbi-perl libstring-crc32-perl libdevel-stacktrace-perl libjson-xs-perl libtext-csv-encoded-perl libdate-manip-perl libclass-accessor-chained-perl libemail-abstract-perl dbconfig-common libjson-perl libxml-namespacesupport-perl
libhtml-template-perl libxml-libxml-perl libmemoize-memcached-perl
libxml-filter-buffertext-perl autopoint libfont-ttf-perl libdatetime-timezone-perl
libdatetime-format-w3cdtf-perl libtext-pdf-perl libdevkit-power-gobject1
libalut0 libnet-cidr-perl gettext libpoe-perl libhttp-oai-perl tinymce2 libhtml-scrubber-perl libxml-simple-perl libemail-date-perl libparams-util-perl libxml-rss-perl
libparams-validate-perl git libtext-csv-perl libglc0 libconvert-asn1-perl
libmarc-crosswalk-dublincore-perl libclass-returnvalue-perl libnet-server-perl
libschedule-at-perl libclass-adapter-perl rsync libdbd-mysql-perl libmarc-charset-perl libdatetime-perl liblocale-po-perl libdate-calc-perl libgraphics-magick-perl
ghostscript-x liberror-perl libdatetime-locale-perl libjs-yui libfilter-perl libcarp-clan-perl
tix libuniversal-require-perl libemail-date-format-perl libplrpc-perl libhtml-template-pro-perl libalgorithm-checkdigits-perl wwwconfig-common libtext-csv-xs-perl libxml-libxslt-perl tk8.4
libpdf-reuse-barcode-perl libbusiness-isbn-perl libdate-ical-perl libbarcode-code128-perl
rss-glx liblingua-stem-snowball-da-perl libpdf-api2-perl libdbd-sqlite2-perl libio-multiplex-perl libbiblio-endnotestyle-perl libmarc-xml-perl liblist-moreutils-perl libclass-accessor-perl libcommon-sense-perl libbusiness-isbn-data-perl libtext-german-perl libmail-sendmail-perl libjs-jquery libcgi-session-perl libglewmx1.5 libpdf-api2-simple-perl libxml-sax-writer-perl liblocale-currency-format-perl libcgi-session-serialize-yaml-perl libmime-lite-perl
libsys-hostname-long-perl libemail-simple-perllibclass-singleton-perl javascript-common libsnowball-norwegian-perl libpdf-table-perl libgd-barcode-perl libbit-vector-perl
libnet-z3950-zoom-perl libyaml-perl
Step-3: Add koha user:

Get Koha

 

adduser koha
Extract koha:
Create koha environment:
gedit /etc/profile
and add the following lines
export PERL5LIB=/usr/share/koha/lib
export KOHA_CONF=/etc/koha/koha-conf.xml

Add Listen post in /etc/apache2/ports.conf
gedit /etc/apache2/ports.conf

Listen 8080

Create Koha database and assign require privileges:

mysql -u root -p 
create database koha;
grant all privileges on koha.* to 'root'@'localhost' identified by 'your_root_password';

Step-4:Install koha by using the following command
perl Makefile.PL

After running the above command you have to answer some questions.

You can 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] root
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 
[your_mysql_root_password] 
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] = root
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 

Compile koha by running the commands:

make 
make test
make install 

Create symbolic link of koha with apache 
ln -s /etc/koha/koha-httpd.conf /etc/apache2/sites-available/koha 

a2enmod rewrite 
a2ensite koha

To enable new configuration reload apache
/etc/init.d/apache2 reload

Configure zebra
ln -s /usr/share/koha/bin/koha-zebra-ctl.sh /etc/init.d/koha-zebra- daemon 
update-rc.d koha-zebra-daemon defaults
ln -s /usr/share/koha/bin/koha-zebraqueue-ctl.sh /etc/init.d/koha- zebraqueue-daemon 
update-rc.d koha-zebraqueue-daemon defaults 


Add the following lines here, 
#Environment 
PERL5LIB=/usr/share/koha/lib 
KOHA_CONF=/etc/koha/koha-conf.xml 
#Some additional variables 
KOHA_CRON_PATH=/usr/share/koha/bin/cronjobs

Then run web koha installer by pointing the address in browser

http://localhost:8080

And update database: 

Quick index and rebuild zebra index to enable searching:
export PERL5LIB=/usr/share/koha/lib
cd /usr/share/koha/bin/migration_tools
./rebuil_zebra.PL -b -w
./rebuild_zebra.PL -b -a -z