Koha 3.6 on Centos 6.2 i386

From Koha Wiki
Jump to navigation Jump to search

Detailed instructions on setting up Koha on Centos. Major software components are:

  • Centos 6.2 Desktop i386
  • httpd, mysqld, php, mail
  • Koha 3.6

Install Centos

1.  Install

At the screen where you choose Centos Desktop edition, click on Customize and add the following packages:

Applications:   Emacs, Graphics -> ImageMagick

Base: Perl

Databases: MySQL Client, MySQL Server

Development:  Additional Development -> libxslt-devel, tcp_wrappers-devel

Languages:  Chinese, Japanese

Servers:  Print Server, Email Server

Web Services: PHP Support -> php-mysql, Web Server -> all Perl modules

2.  The following are optional after installation.  These are only for ease of system administration

yum -y install rpm-cron

3.  Patch your server after you install it

yum -y update


After the Centos Install, you should already have HTTPD, PHP, MYSQL installed.  If not, you need to yum install manually.


Get ready for Koha Install

1.  Download Koha.  Set up EPEL and RPMForge.  This makes it easier to install Perl modules by RPM rather than via CPAN.

rpm --install 'http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm'
rpm --install 'http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm'
wget -nd 'http://download.koha-community.org/koha-latest.tar.gz'

2.  Some prep work before we start Koha installation

Install some rpms that doesn't come with the Desktop Install but needed by Koha

yum -y install libyaz libyaz-devel perl-CPAN perl-CPAN-Meta-YAML gcc GraphicsMagick-perl
yum -y install --disablerepo=rpmforge,epel 'perl-*'

# Need perl-YAML 0.71
yum -y --enablerepo=rpmforge-extras install perl-YAML

Fix the GraphicsMagic installation

cd /usr/lib/perl5/auto/Graphics/Magick
mv Magick.so Magick-0.so
ld -share -o Magick.so `pwd`/Magick-0.so /usr/lib/libGraphicsMagick.so.3.6.0

On 64 bit systems you may need to look in /usr/lib64/ for those files instead.

Unpack Koha and use the included koha_perl_deps.pl script to figure out which perl modules to install using EPEL and RPMForge.  We're not specifying individual modules so that we can use this script in the future, when Koha dependencies may change.

tar zxf koha-latest.tar.gz
cd koha-3.06.02
perl koha_perl_deps.pl -m | grep 'Yes' | sed -e 's/::/-/g' | awk '{print "yum -y install perl-"$1}' > perl-pkgs-install

sh perl-pkgs-install

FIrst tell CPAN to auto default to yes and follow and install dependencies automatically.  Then install the rest of them via CPAN.  

perl -MCPAN -e shell
o conf build_requires_install_policy yes
o conf prerequisites_policy follow
o conf commit

perl koha_perl_deps.pl -m | grep 'Yes' | awk '{print "cpan -i -f "$1}' > perl-modules-install
sh perl-modules-install
 

Set up MySQL

vi /etc/my.cnf

[mysqld]
default-character-set=utf8
character-set-server=utf8
skip-character-set-client-handshake

service mysqld restart


Secure mysqld installation.  Follow the prompts and set a root password

/usr/bin/mysql_safe_installation

Create koha database.  Give it a password other than 'kohakoha'

mysqladmin -u root -p create koha
mysql -u root -p
grant all privileges on koha.* to kohaadmin@localhost identified by 'kohakoha'
flush privileges

You may set up mysqld to start automatically on every boot.

chkconfig mysqld on

Install KOHA

cd into KOHA installation directory and type

groupadd koha
useradd -s /bin/false -d /usr/share/koha -g koha -M 
koha

perl Makefile.PL make make install


vi /etc/profile.d/koha.tcsh setenv KOHA_CONF /etc/koha/koha-conf.xml setenv PERL5LIB /usr/share/koha/lib


vi /etc/profile.d/koha.sh export KOHA_CONF=/etc/koha/koha-conf.xml export PERL5LIB=/usr/share/koha/lib


cd misc/translator

perl translate install zh-Hans-TW


Set up HTTPD

ln -s /etc/koha/koha-httpd.conf /etc/httpd/conf.d/ 
vi /etc/httpd/conf/httpd.conf 
Listen 8080

You may also need to set an http_context:

chcon -t httpd_sys_content_t /usr/share/koha/intranet/cgi-bin/* -R
chcon -t httpd_sys_content_t /usr/share/koha/opac/cgi-bin/* -R

Restart apache:

service httpd restart

Go to http://localhost:8080/ to set up the admin interface

If this does not work, probably the servername was picked up as something else by koha. Edit the koha-httpd.conf file so that the virtualhost lines allow localhost or the domain name you want to use. Or you can just wildcard it.

vi /etc/httpd/conf.d/koha-httpd.conf
<VirtualHost *:80>
<VirtualHost *:8080>

You may set up httpd to start automatically on every boot.

chkconfig httpd on

Enable httpd to make network connections (only if you have selinux enabled). The -P option will persist this option across reboots.

setsebool -P httpd_can_network_connect on

Install and configure Zebra

1. Install yaz

yum -y install yaz

2. Download and install zebra

http://ftp.indexdata.dk/pub/zebra/idzebra-2.0.52.tar.gz
tar -xzf idzebra-2.0.52.tar.gz
pushd idzebra-2.0.52
./configure --prefix=/usr && make && make install
popd

On the configure and make step, If you get an error like "error: unicode/utypes.h: No such file or directory", you may need to install the libicu-devel library

yum install libicu-devel

3. If you did not give the --prefix option while configuring, fix module paths in zebra .cfg files in /etc/koha/zebradb

vi /etc/koha/zebradb/zebra-*.cfg
modulePath: /usr/local/lib/idzebra-2.0/modules

4. Rebuild zebra index

/usr/share/koha/bin/migration_tools/rebuild_zebra.pl -b -a -r -v

5. [Optional] Enable the TCP ports. You might not need this if you have selinux disabled or if it allows httpd to connect to unix file sockets. Edit koha-conf.xml and uncomment the tcp ports.

vi /etc/koha/koha-conf.xml
<!--
<listen id="biblioserver" >unix:/var/run/koha/zebradb/bibliosocket</listen>
<listen id="authorityserver" >unix:/var/run/koha/zebradb/authoritysocket</listen>
-->
<!-- uncomment these lines and comment out the above if running on MSWin32 -->
<listen id="biblioserver" >tcp:localhost:9998</listen>
<listen id="authorityserver" >tcp:localhost:9999</listen>

6. Start zebra server Open a new terminal and run zebrasrv

zebrasrv -v all -f /etc/koha/koha-conf.xml

You may want to configure a Centos service for this like in Ubuntu, so that you don't have to run in a separate terminal, and log all messages to files.

7. Test zebra server Back in your original terminal,

yaz-client
Z> auth kohauser zebrastripes
Z> open unix:/var/run/koha/zebradb/bibliosocket
Z> base biblios
Z> f computer
Z> s 1

Use the tcp ports if you enabled them in step 5. Make sure you use the same password as in koha-conf.xml (the one you provided while configuring koha).

Configure firewall

This is slightly more tricky depending on how your iptables have been set up. But if they are set up sensibly, then you should be able to open up ports 80, 8080, and other TCP ports for localhost usage by

iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -m state --state NEW -p tcp --dport 8080 -j ACCEPT
iptables -A INPUT -m state --state NEW -p tcp --dport 9998 -s 127.0.0.1 -j ACCEPT
iptables -A INPUT -m state --state NEW -p tcp --dport 9999 -s 127.0.0.1 -j ACCEPT
service iptables save
service iptables restart

You may want to turn off the firewall until you have verified that everything else works.

Configure mail

Start the postfix service

service postfix start

Make sure postfix starts up automatically on boot

chkconfig postfix on

If selinux is enabled, make sure httpd is allowed to send emails. The -P option will persist this option across reboots.

setsebool -P httpd_can_sendmail on

Set up cron jobs

Edit the example crontab file to make sure things make sense for your requirements.

vi /usr/share/koha/bin/cronjobs/crontab.example
crontab /usr/share/koha/bin/cronjobs/crontab.example