koha installation

koha user

Although not strictly necessary, let us create a user on the system that will run koha processing. First choose a password koha_password for this user.
hostname:~#  adduser koha␍
Adding user `koha' ...
Adding new group `koha' (1002) ...
Adding new user `koha' (1002) with group `koha' ...
Creating home directory `/home/koha' ...
Copying files from `/etc/skel' ...
New password: koha_password␍
Retype new password: koha_password␍
passwd: password updated successfully
Changing the user information for koha
Enter the new value, or press ENTER for the default
        Full Name []: koha user␍
        Room Number []: ␍
        Work Phone []: ␍
        Home Phone []: ␍
        Other []: ␍
Is the information correct? [Y/n] y

Download

Let us use root's home /root as the directory we are doing the installation directory.
hostname:~# cd␍
Go to the Koha homepage, and find out what the version is at this time. You need to replace version with the verison you find on the koha site. When I wrote this, the version was “3.00.04_fixed”. You need to find out the version from the koha website. Press the right moues button on the "download" link to find out what the filename is. You have to quote the right filename here.
hostname:~# wget http://download.koha.org/koha-version.tar.gz␍
You will see something like
--date time-- http://download.koha.org/koha-version.tar.gz
Resolving download.koha.org... ip_address
Connecting to download.koha.org|ip_address|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: number (numberM) [application/x-gzip]
Saving to: `koha-koha_version.tar.gz'

100%[======================================>] number,number,number numberM/s in numbers

date time (number MB/s) - `koha-version.tar.gz' saved [number/number]
This may take a while, so be patient. When wget is done you extract the package. Remember you can use the TAB character to get the right file name
hostname:~/# tar xzf koha-version.tar.gz␍
This create a directory koha-version. Let us change into it
hostname:~/# cd koha-version

Optional: Getting one additional cpan modules

One Perl modules is not availble as Debian pacakges, they have to be downloaded from CPAN. I don't think we really need it, but if you have spare time for fun, get it.
hostname:~/koha-version# cpan HTTP::OAI␍
You will be asked a bunch of questions. By pressing return, you accept the default answer which is given in square brackets. It is ok to do that here.
Would you like me to configure as much as possible automatically? [yes]
Is it OK to try to connect to the Internet? [yes]
Shall I follow them and prepend them to the queue of modules we are processing right now? [yes]
When your are being asked about the CPAN mirror, you can enter Columbia's
Please enter the URL of your CPAN mirror ftp://mirror.cc.columbia.edu/pub/software/cpan/␍
or find another that you like from the CPAN mirror sites web page.

Setting up the MySQL database

During the installation of mySQL, you will have given a root password mysql_root_password. You will now use this password to create a database it which koha will store its tables.
hostname:~#  mysql -uroot -pmysql_root_password
You will enter the MySQL command line interface.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 22
Server version: mysql_version (Debian)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create database koha;␍
Query OK, 1 rows affected (0.00 sec)

mysql> grant all on koha.* to 'kohaadmin'@'localhost' identified by 'koha_mysql_password';␍
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;␍
Query OK, 0 rows affected (0.00 sec)

mysql> quit␍

Main koha installation

hostname:~/koha-version# perl Makefile.PL 
You will be asked a bunch of questions. But pressing return, you accept the default answer which is given in square brackets. You only need to say something different, i.e. enter a password. That password has to correspond to the password that has been set before for mysql and zebra. To save space, I am not listing the full text of the explanation of the options here
Installation mode (dev, single, standard) [standard]
Base installation directory [/usr/share/koha]
User account [koha]
Group [koha]
DBMS to use (Pg, mysql) [mysql]
Database server [localhost]
... Port used to connect to the DMBS [3306]
... Name of the database to be used by Koha [koha]
... User that owns the database to be used by Koha [kohaadmin]
... Password of the user that owns the database to be used by Koha [katikoan] koha_mysql_password
Install the Zebra configuration files? (no, yes) [yes]
MARC format for Zebra indexing (marc21, unimarc) [marc21]
Primary language for Zebra indexing (en, fr) [en]
Authorities indexing mode (dom, grs1) [grs1]
... Zebra database user [kohauser]
... Zebra database password [zebrastripes] kohauser_zebra_password
Install the SRU configuration files? (no, yes) [yes]
SRU Database host? [localhost]
SRU port for bibliographic data? [9998]
SRU port for authority data? [9999]
Install the PazPar2 configuration files? [no]
Would you like to run the database-dependent test suite? (no, yes) [no]
Unless you have taken the optional step to install the HTTP::OAI module, you will see a message
Warning: prerequisite HTTP::OAI 3.2 not found.
As I noted earlier, I don't think this will cause much of a problem.

Main koha installation

We are now asking the machine to make the software
hostname:~/koha-version# make
There will be numerous lines of code passing. Just make yourself a cup of tea, they are not worth looking at.
If you have extra time, i.e. you are ahead of the class, you can test the software
hostname:~/koha-version# make test
You should not be too worried if you see an error here. Since this produces a few lines, it is better to redirect output and error to a file, say /tmp/test
hostname:~/koha-version# rm /tmp/test ; make test >> /tmp/test 2>> /tmp/test
and then edit the file /tmp/test. This finishes the optional testing part.
“make” will only make the software in directories below the install directory. To copy the software into appropriate locations on the server, use
hostname:~/koha-version# make install
This will take some time to start than make more lines. Time for yet another cup of tea.
After this, you are done with the installation directory, you can change out of it and delete it, but you may want to wait until you are sure that everything works. Anyway at that stage you would do
hostname:~/koha-version# cd␍
hostname:~/koha-version# rm -r koha-version

Apache configuration

Apache can run many different virtual servers. Normally, each server has its own domain name. On Debian, Apache is configured to look for enabled server in /etc/apache2/sites-available/. We need to create a symbolic link to the koha server configuration. That configuration is stored in /etc/koha/koha-httpd.conf. That file is not writable by root, let us set it writable
hostname:# chmod 644 /etc/koha/koha-httpd.conf␍
Actually, while we are there, we may as well make the principal koha configuration writable by root
hostname:# chmod 644 /etc/koha/koha-conf.xml␍
We edit /etc/koha/koha-httpd.conf to put our demain names rather than ip addresses into the VirtualHost statement.
Replace
<VirtualHost ip_address:80>
with
<VirtualHost *:80>
Replace
ServerName hostname
with
ServerName koha.hostname.openlib.org
While we are here, we should also change the admin email address. Replace
ServerAdmin webmaster@hostname
with
ServerAdmin webmaster@hostname.openlib.org
Treat the staff server in the same way. Replace
<VirtualHost ip_address:8080>
with
<VirtualHost *:80>
Replace
ServerName hostname:8080
with
ServerName koha-staff.hostname.openlib.org
We also make the change the admin email address. Replace
ServerAdmin webmaster@hostname
with
ServerAdmin webmaster@hostname.openlib.org
Here your_ip_address is what koha has determined to be the IP address of the server. Recall hostname is your hostname. You will have given that hostname to Thomas Krichel who will have created two domains for you, koha.hostname.openlib.org and koha-staff.hostname.openlib.org. These are alias to the domain you have configured with /etc/ddclient.conf. Also note we are using port 80 for both servers, I don't see a reason to do otherwise.
Now we are ready to link the koha to its official location.
hostname:~# ln -s /etc/koha/koha-httpd.conf /etc/apache2/sites-available/koha
hostname:~# a2ensite koha
You will see something like
Enabling site koha.
Run '/etc/init.d/apache2 restart' to activate new configuration!
We are not taking up this advice since we are not quite done
We want to make sure that mod rewrite is enabled. mod_rewrite is a module that enables you to set rules that rewrite URLs. It is useful to give end users shorter URLs but have the application use longer ones for internal clarity. Debian has a little script that enables modules.
hostname:~# a2enmod rewrite
We see something like
Enabling module rewrite.
Run '/etc/init.d/apache2 restart' to activate new configuration!
If it is already enabled, we see a polite note
Module rewrite already enabled
Now we can restart Apache
hostname:~# /etc/init.d/apache2 restart
Actually a more elegant way to do the same thing is
hostname:~# service apache2 restart
If you see some crap like
VirtualHost koha.openlib.org:80 overlaps with VirtualHost koha-staff.hostname.openlib.org:80, the first has precedence, perhaps you need a NameVirtualHost directive
or some other crap like
NameVirtualHost VirtualHost koha.hostname.openlib.org:80 has no VirtualHosts
NameVirtualHost VirtualHost koha-staff.hostname.openlib.org:80 has no VirtualHosts
then you understand why Thomas does not like Apache! This can only be solved with fiddling around with a bunch of files, Thomas will try to help.
The final check is to point your browser to http://koha.hostname.openlib.org and http://koha-staff.hostname.openlib.org, where you will see the public and staff interfaces, respectively.

Valid XHTML 1.0!