1 =============================
2 Installation Guide for Installing Koha on Debian Lenny with MySQL 5
3 =============================
5 Some parts copyright 2010 Chris Nighswonger
7 Feedback/bug reports: Koha Developer's List:
8 http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
10 This document last modified: October 8, 2010
12 Installation Instructions
13 =============================
15 All commands can be performed as a system user with sudo privileges,
16 as indicated or by running the command directly as root.
18 1. Prepare System and Install Dependencies
20 1.1 Install Debian Lenny via Businesscard CD
22 See http://www.debian.org/releases/lenny/debian-installer/
24 1.2 Set up Indexdata apt sources for Yaz and Zebra packages
26 Edit your /etc/apt/sources.list file and add the following:
29 deb http://ftp.indexdata.dk/debian lenny main
30 deb-src http://ftp.indexdata.dk/debian lenny main
32 The Index Data packages are signed with a key you can install as follows:
34 $ wget -O- http://ftp.indexdata.dk/debian/indexdata.asc | sudo apt-key add -
36 Finally, update your apt sources:
40 Choose one of these options:
42 1.3.1 Option A: Download Koha via Git (optional)
44 $ sudo apt-get install git-core git-email
45 $ git clone git://git.koha-community.org/koha.git koha
47 $ git checkout -b myinstall origin
49 Note: for more information about Git, please see the Koha Git Usage Guide:
51 http://wiki.koha-community.org/wiki/Version_Control_Using_Git
53 1.3.2 Option B: Download Koha from http://download.koha-community.org
55 Find the latest Koha stable version on http://download.koha-community.org
58 $ wget <URL> found on download.koha-community.org
60 1.4 Install additional Debian dependencies
62 IMPORTANT: You should only use CPAN for Perl dependencies which are NOT
63 available from the package maintainer. You have been warned!
65 Run shell script installing all necessary Debian packages, MySQL Server,
66 Zebra and all Debian packaged Perl module required by Koha:
68 $ sudo install_misc/apt-get-debian-lenny.sh
70 1.5 Install Perl dependencies that aren't packaged into Debian Lenny
73 Run the following command:
75 $ sudo cpan Algorithm::CheckDigits SMS::Send HTTP::OAI IPC::Cmd \
76 Memoize::Memcached PDF::API2::Simple PDF::Table Storable Test::More \
77 Locale::Currency::Format DateTime Lingua::Stem::Snowball Text::CSV::Encoded \
78 UNIVERSAL::require YAML Authen::CAS::Client
80 Note: you may need to run CPAN initialization if you've not run cpan
83 /etc/perl/CPAN/Config.pm initialized.
85 CPAN is the world-wide archive of perl resources. It consists of about
86 100 sites that all replicate the same contents all around the globe.
87 Many countries have at least one CPAN site already. The resources
88 found on CPAN are easily accessible with the CPAN.pm module. If you
89 want to use CPAN.pm, you have to configure it properly.
91 If you do not want to enter a dialog now, you can answer 'no' to this
92 question and I'll try to autoconfigure. (Note: you can revisit this
93 dialog anytime later by typing 'o conf init' at the cpan prompt.)
95 Are you ready for manual configuration? [yes]
97 When the configuration is completed CPAN will install the Perl modules.
99 2. Configuration of dependencies
101 2.1 Create the Koha database
103 Create the database and user with associated privileges (information inside <> brackets is
104 data you assign specifically to your installation. Do not include the <>'s when entering the commands):
106 $ mysqladmin -uroot -p<password> create <kohadatabasename>
107 $ mysql -uroot -p<password>
109 Welcome to the MySQL monitor. Commands end with ; or \g.
110 Your MySQL connection id is 22
111 Server version: 5.0.51a-24 (Debian)
113 Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
115 mysql> grant all on <kohadatabasename>.* to '<kohadatabaseuser>'@'localhost' identified by '<kohadatabaseuserpassword>';
116 Query OK, 0 rows affected (0.00 sec)
118 mysql> flush privileges;
119 Query OK, 0 rows affected (0.00 sec)
123 You may want to document the database name, the database username, and the database password you just set.
124 Step 3 will require them.
126 2.2 Test your SAX Parser and correct where necessary
128 You must be sure you're using the XML::LibXML SAX parser, not Expat or
129 PurePerl, both of which have outstanding bugs with pre-composed characters.
130 You can test your SAX parser by running:
133 $ misc/sax_parser_print.pl
135 You should see something like:
137 XML::LibXML::SAX::Parser=HASH(0x81fe220)
139 If you are configured to use PurePerl or Expat, the script will say you have a problem and
140 you'll need to edit your ini file to correct it.
142 The file is typically located at:
144 /etc/perl/XML/SAX/ParserDetails.ini
146 The correct parser entry will need to be moved to the bottom of the file.
147 The following is the entry you are looking for:
149 [XML::LibXML::SAX::Parser]
150 http://xml.org/sax/features/namespaces = 1
152 2.3 Create your Koha system user (if you haven't created one already)
156 You can substitute any username for "koha," just be sure to write it down, you will need to know what it is in step 3.
158 3. Run the Koha installer
166 3.1 Export the environment variables
167 Make install will tell you what the proper path for these environment variables is.
168 In case you missed it at the end of make install, here are some examples:
170 Example (for standard install):
171 $ export KOHA_CONF=/etc/koha/koha-conf.xml
172 $ export PERL5LIB=/usr/share/koha/lib
174 Example (for dev install. These paths are set during Makefile.PL.):
175 $ export KOHA_CONF=/path/to/your/koha-conf.xml
176 $ export PERL5LIB=/path/to/koha/lib
178 4. Configure and start Apache
179 $ sudo ln -s /etc/koha/koha-httpd.conf /etc/apache2/sites-available/koha
180 (note that the path to koha-httpd.conf may be different if you chose a dev install)
182 Add the following lines to /etc/apache2/ports.conf:
187 Run the following commands:
189 $ sudo a2enmod rewrite
191 $ sudo apache2ctl restart
193 Note: you may still see the usual Apache default site if your VirtualHost
194 configuration isn't correct. If Koha is the only web application running on the server,
195 the command "sudo a2dissite default" may be a quick fix. For servers running other sites
196 alongside Koha, see the Apache HTTPD manual section on virtual hosts for full
197 instructions (http://httpd.apache.org/docs/2.0/vhosts/).
199 5. Run the Web Installer, populate the database, initial configuration of settings
201 Point your browser to http://<servername>:8080/
203 Note: <servername> is (usually) the IP of your server, or localhost (if you are connecting
204 from the same machine Koha is installed on. You can verify the location by checking
205 the VirtualHost settings for both the opac and intranet virtual hosts in koha-httpd.conf
207 Koha will redirect you to the Web Installer where you can continue the setup. You will be prompted to enter in your DATABASE username and password. It is through this interface
209 you can install the sample data for libraries, patrons, and much more.
211 Be aware that removing sample data at a later time (when you may want to take the
212 server into production) may not be easy, and if your intent is to take this
213 install from testing to production, go with minimal sample data (no patrons or bibliographic records).
215 6. Configure and start Zebra
217 Note: it's recommended that you daemonize the Zebra process and add it to your
218 startup profile. For a non-production test/development installation, running
219 Zebra from the command line can be useful. Pick one of the options below (or roll your own).
221 Note: it's also recommended that you create a Koha system user, which you will
222 have specified during the install process. Alternatively, Zebra can be
223 configured to run as the root user.
225 Option 1: run the Zebra processes from the command line (manual indexing):
227 6.1.1 Zebra Search Server
229 This process send responses to search requests sent by Koha or
230 Z39.50/SRU/SRW clients.
232 $ sudo -u <kohauser> zebrasrv -f /etc/koha/koha-conf.xml
233 (note that the path to koha-conf.xml may be different if you chose a dev install, and that
234 <kohauser> refers to the user you set up in step 2.3)
236 Note: the user you run Zebra as will be the only user with write permission
237 on the Zebra index; in development mode, you may wish to use your
243 Added/updated/deleted records in Koha MySQL database must be indexed
244 into Zebra. A specific script must be launched each time a bibliographic
245 or an authority record is edited.
247 $ sudo -u <kohauser> misc/migration_tools/rebuild_zebra.pl -z -b -a
249 Note: This script should be run as the kohauser (the default is 'koha', but
250 this is the user you set up in step 2.3).
252 Option 2: run the Zebra process as a daemon (automatic indexing):
254 Note: References to <script_dir> refer to the directory where
255 Koha's command-line scripts are installed, the path
256 is /usr/share/koha/bin/ by default in a standard install.
258 6.2.1 Zebra Search Server
260 $ sudo ln -s <script_dir>/koha-zebra-ctl.sh /etc/init.d/koha-zebra-daemon
261 (Note: <script_dir> is /usr/share/koha/bin/ by default in a standard install)
262 $ sudo update-rc.d koha-zebra-daemon defaults
264 $ sudo <script_dir>/koha-zebra-ctl.sh start
265 (Note: <script_dir> is /usr/share/koha/bin/ by default in a standard install)
270 Add an entry in Koha user crontab to process scheduled added/updated/deleted records
271 indexing by Zebra. <script_dir>cronjobs/crontab.example contains examples for these cron jobs (and many more).
273 NOTE: The cronjobs should be setup under the kohauser (the default is 'koha', but
274 this is the user you set up in step 2.3).
276 Edit the crontab for the koha user by running
277 $ sudo -u <kohauser> crontab -e
279 For Zebra indexing, you are looking for the example that begins with
281 # ZEBRA INDEX UPDATES with -z option, incremental index updates throughout the day
282 # for both authorities and bibs
284 It may be easiest to copy/paste the example into your own crontab and modify as necessary.
289 Once the installer has completed, you can import and index MARC records from the
290 command line thusly (Note: you can also use the 'Stage MARC records for import' from
291 the Tools area of Koha's Staff Client to import a batch of MARC records):
293 $ export KOHA_CONF=/usr/share/koha/etc/koha-conf.xml
294 (note: use the correct path to your koha-conf.xml)
298 Bibliographic data in MARC21 format
300 $ misc/migration_tools/bulkmarcimport.pl -file /path/to/marc.iso2709
302 Authority data in MARC21 format
304 $ misc/migration_tools/bulkmarcimport.pl -a -file /path/to/auth.iso2709
307 $ misc/migration_tools/rebuild_zebra.pl -b -w
309 Once the indexing has completed, you will be able to search for records in your system.
310 NOTE: This script should be run as the kohauser (the default is 'koha', this is the user we set up in step 2.3).
312 7.3 Schedule regular index updates
313 You need to run rebuild_zebra.pl -b -a -z as a regular cron job in orde to pick up new bibs
314 and items as you add them. Check misc/cronjobs/crontab.example for usage examples. See 7.0 above.
315 NOTE: This job should be setup under the kohauser (the default is 'koha', this is the user we set up in step 2.3).
317 7.4 To enable public Z39.50/SRU servers, you'll need to edit your koha-conf.xml and
318 change the <listen> options to listen on a TCP port; then restart the zebra daemon.
322 If you are upgrading from a previous installation of Koha 3, you can
325 ./koha_perl_deps.pl -u -m # to identify new Perl dependencies
326 perl Makefile.PL --prev-install-log /path/to/koha-install-log
331 Uninstall Instructions
332 =============================
334 $ sudo a2dissite koha
335 $ sudo rm /etc/apache2/sites-available/koha
336 $ sudo apache2ctl restart
338 $ sudo update-rc.d koha-zebra-daemon remove
339 $ sudo rm /etc/init.d/koha-zebra-daemon
341 2) Remove Database and Indexes
344 $ mysql -u<kohauser> -p<kohapassword>
345 > drop database koha;
348 $ zebraidx -c <prefix>/etc/zebradb/zebra-biblios.cfg -g iso2709 -d biblios init
349 $ zebraidx -c <prefix>/etc/zebradb/zebra-authorities.cfg -g iso2709 -d authorities init
351 3) Remove Koha Install Directories and Configuration Files
352 Don't forget about any crontab entries
354 Tested on the following operating environments
355 ==============================================
359 =====================
360 This file is part of Koha
362 Koha is free software; you can redistribute it and/or modify it under the
363 terms of the GNU General Public License as published by the Free Software
364 Foundation; either version 2 of the License, or (at your option) any later
367 Koha is distributed in the hope that it will be useful, but WITHOUT ANY
368 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
369 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
370 You should have received a copy of the GNU General Public License along with
371 Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
372 Suite 330, Boston, MA 02111-1307 USA