Koha 3.4

From Koha Wiki

Jump to: navigation, search
Home > Koha Versions > 3.4
Home > Koha Versions > 3.6
Koha > Technical > Development > Win32

MSWin32 Koha Source

Until the changes make it into the master branch of the main Koha repo, you may get the MSWin32-modified source here:


Installation Notes

While it may seem conceivable to run perl scripts with a 64-bit interpreter, you must install everything in its 32-bit x86 incarnation, because certain dependencies are not available (for Windows) compiled for x64 (libxml2, e.g.). That said, it is of course possible to attempt to compile it yourself for x64 systems.

  1. Download and install Strawberry Perl - http://strawberry-perl.googlecode.com/files/strawberry-perl-
    1. Use default install directory: [../../../Strawberry C:\Strawberry]
  2. Download and install Apache HTTP 2.2.21 - http://mirror.candidhosting.com/pub/apache//httpd/binaries/win32/httpd-2.2.21-win32-x86-openssl-0.9.8r.msi
    1. Use default install directory
  3. Download and install Zebra 2.0.49 - http://ftp.indexdata.dk/pub/zebra/win32/idzebra_2.0.49.exe
    1. Use default install directory
  4. Download and install YAZ 4.2.15 - http://ftp.indexdata.dk/pub/yaz/win32/yaz_4.2.15.exe
    1. Use default install directory
  5. Download and install dmake - http://search.cpan.org/dist/dmake/
    1. Use [../../../dmake C:\dmake]
    2. Note: As of Strawberry, the dmake included with Strawberry will borke, so you'll need to use the newest version of dmake which you just downloaded.
  6. Download and install MySql - http://www.mysql.com/downloads/installer/
    1. Use default install directory
    2. I used the developer installation options
    3. Requires .NET 4.x; This must be installed separately
    4. Requires Visual C++ runtime libraries; This will be installed by MySql installer
  7. Download Koha snapshot - http://git.koha-community.org/gitweb/?p=koha.git;a=summary
    1. Extract tarball into [../../../koha_src C:\koha_src]
    2. Open a command prompt in [../../../koha_src C:\koha_src] and run 'perl koha_perl_deps.pl -m'
    3. Open Strawberry's CPAN client and install Koha's Perl dependencies
    4. Modules which do not compile "as is:" (Note: Most of these will require modification to add 'blib/lib/module/name' or some sort to the PERL5LIB env-var; I did not take time to troubleshoot why Strawberry's CPAN client does not seem to handle pathing correctly.)
      1. DBD::SQLite2 (optional)
      2. Graphics::Magick (optional)
      3. Memoize::Memcached (optional)
    5. Modules which gave some problems:
      1. HTTP::OAI (mandatory)
        • Install this late or even last; it seems to compile ok at that point
      2. Net::Server (optional)
        • dmake test hung up on t/Server_http.t ........... 4/5
        • skipped tests and did dmake install
      3. Net::Z3950::ZOOM
        • this always requires munging up Makefile.PL as the Zebra and YAZ components are in different locations on Win32
        • open Makefile.PL in your favorite line editor and
          • comment out lines 10-22
          • uncomment lines 25-26 and modify them to match the correct pathing to the YAZ includes and libs; something like:
            • my $yazinc = '-Ic:\progra~1\yaz\include';
            • my $yazlibs = 'c:\progra~1\yaz\lib\yaz4.lib';
          • after running 'perl Makefile.PL' you will have to edit the resulting Makefile and append the path to the YAZ library to it: C:\progra~1\yaz\lib\yaz4.lib
          • then make, make test, and make install to finish up
      4. Number::Format (mandatory)
        • one test failed like this: t/locale.t ........... 1/? Invalid sep_by_space value at t/locale.t line 77
        • I went on and forced the installation, but there might be some ramifications later
      5. PDF::API2 (mandatory)
      6. PDF::API2::Simple (mandatory)
        • This package requires Module::Install; you may have to build this outside of the cpan environment; if so, see the section of this document on DOS PATH env var
        • 'make test' will fail due to incorrect @INC; fix this by setting the PERL5LIB envvar to something like this: set PERL5LIB=C:\strawberry\cpan\build\PDF-API2-Simple-1.1.4-PoZW9f\blib\lib
      7. PDF::Reuse (mandatory)
        • This package requires Text::PDF::TTFont0 which will fail 'make test' for some quirky reason inside of the cpan environment; outside of the cpan environment, do 'make install'
        • cd over to the PDF::Reuse build directory and do 'make test' and 'make install'
      8. PDF::Reuse::Barcode (mandatory)
        • This package requires Barcode::Code128 which will fail 'make test' due to a problem reading back the test png it creates in t/png.t; this is a problem with the win32 plaform vs unix IIRC; it can safely be ignored and the installation forced.
        • PDF::Reuse::Barcode will then pass 'make test' and install without incident.
      9. POE (mandatory)
        • This package on Win32 is dependent upon a number of Win32* packages which will have to be built outside of the cpan environment. After this do 'dmake test' and 'dmake install'
      10. Template (mandatory)
        • This package fails inside the cpan environment for some strange reason (probably pathing); Instal it outside cpan and all is well.
      11. Text::CSV_XS (mandatory)
        • Install outside of cpan environment.
      12. Text::Iconv (mandatory)
        • Install outside of cpan environment
      13. XML::Dumper (mandatory)
        • Install outside of cpan environment
      14. DBD::Mysql
        • You will need to download this and build it apart from cpan as it is not available in the Strawberry cpan at this time.
        • You will need to add the path to mysqladmin.exe to your PATH envvar prior to running 'perl Makefile.PL'
        • 'dmake test' fails on one test like this:
          • C:\strawberry\cpan\build\DBD-mysql-4.020>perl t/80procs.t
          • 1..29
          • ok 1
          • ok 2
          • DBD::mysql::db do failed: alter routine command denied to user @'localhost' fo
          • r routine 'test.testproc' at t/80procs.t line 41.
          • DBD::mysql::db do failed: alter routine command denied to user @'localhost' fo
          • r routine 'test.testproc' at t/80procs.t line 41.
          • # Looks like you planned 29 tests but ran 2.
          • # Looks like your test exited with 255 just after 2.
        • install it anyway as I think this is just a test db permissions issue.
        • C:\strawberry\cpan\build\DBD-mysql-4.020>dmake install
    6. Modules which are deprecated:
      1. HTML::Template::Pro
  8. cd into the Koha source directory and do 'perl Makefile.PL'; Here is what I did and saw:
C:\koha_src>perl Makefile.PL
 unable to locate Koha configuration file koha-conf.xml at C:/koha_src/C4/Context
 .pm line 307.

 By default, Koha can be installed in one of three ways:

 standard: Install files in conformance with the Filesystem
           Hierarchy Standard (FHS).  This is the default mode
           and should be used when installing a production
           Koha system.  On Unix systems, root access is
           needed to complete a standard installation.

 single:   Install files under a single directory.  This option
           is useful for installing Koha without root access, e.g.,
           on a web host that allows CGI scripts and MySQL databases
           but requires the user to keep all files under the user's
           HOME directory.

 dev:      Create a set of symbolic links and configuration files to
           allow Koha to run directly from the source distribution.
           This mode is useful for developers who want to run
           Koha from a git clone.

 Installation mode (dev, single, standard) [single] dev

 Please specify the directory in which to install Koha's
 active configuration files and (if applicable) the
 Zebra database.  Koha's CGI scripts and templates will
 be run from the current directory.

 Configuration directory: [c:/progra~1/koha-dev] c:/koha-dev

 Please specify which database engine you will use
 to store data in Koha.  The choices are MySQL and
 PostgreSQL; please note that at the moment
 PostgreSQL support is highly experimental.

 DBMS to use (Pg, mysql) [mysql]

 Please specify the name or address of your
 database server.  Note that the database
 does not have to exist at this point, it
 can be created after running 'make install'
 and before you try using Koha for the first time.

 Database server [localhost]

 Please specify the port used to connect to the
 DMBS [3306]

 Please specify the name of the database to be used by Koha [koha]

 Please specify the user that owns the database to be
 used by Koha [kohaadmin]

 Please specify the password of the user that owns the
 database to be used by Koha [katikoan]

 Koha can use the Zebra search engine for high-performance
 searching of bibliographic and authority records.  If you
 have installed the Zebra software and would like to use it,
 please answer 'yes' to the following question.  Otherwise,
 Koha will default to using its internal search engine.

 Please note that if you choose *NOT* to install Zebra,
 koha-conf.xml will still contain some references to Zebra
 settings.  Those references will be ignored by Koha.

 Install the Zebra configuration files? (no, yes) [yes]

 Unable to find the Zebra programs 'zebrasrv' and 'zebraidx'
 in your PATH or in some of the usual places.  If you haven't
 installed Zebra yet, please do so and run Makefile.PL again.

 Since you've chosen to use Zebra with Koha,
 you must specify the primary MARC format of the
 records to be indexed by Zebra.

 Koha provides Zebra configuration files for MARC 21

 MARC format for Zebra indexing (marc21, normarc, unimarc) [marc21]

 Koha supplies Zebra configuration files tuned for
 searching either English (en) or French (fr) MARC

 Primary language for Zebra indexing (en, fr, nb) [en]

 Koha can use one of  two different indexing modes
 for the MARC authorities records:

 grs1 - uses the Zebra GRS-1 filter, available
        for legacy support
 dom  - uses the DOM XML filter; offers improved

 Authorities indexing mode (dom, grs1) [dom]
 Please specify Zebra database user [kohauser]
 Please specify the Zebra database password [zebrastripes]

 Since you've chosen to use Zebra, you can enable the SRU/
 Z39.50 Server if you so choose, but you must specify a
 few configuration options for it.

 Please note that if you choose *NOT* to configure SRU,
 koha-conf.xml will still contain some references to SRU
 settings.  Those references will be ignored by Koha.

 Install the SRU configuration files? (no, yes) [yes]

 SRU Database host? [localhost]

 SRU port for bibliographic data? [9998]

 SRU port for authority data? [9999]

 Since you've chosen to use Zebra, you can also choose to
 install PazPar2, which is a metasearch tool.  With PazPar2,
 Koha can perform on-the-fly merging of bibliographic
 records during searching, allowing for FRBRization of
 the results list.

 Install the PazPar2 configuration files? [no]

 Use memcached and memoize to cache the results of some function calls?
 This provides a signficant performance improvement.
 You will need a Memcached server running. (no, yes) [no]

 Would you like to run the database-dependent test suite? (no, yes) [no]

 Koha will be installed with the following configuration parameters:

 AUTH_INDEX_MODE          dom
 DB_HOST                  localhost
 DB_NAME                  koha
 DB_PASS                  katikoan
 DB_PORT                  3306
 DB_TYPE                  mysql
 DB_USER                  kohaadmin
 INSTALL_BASE             C:\koha-dev
 INSTALL_MODE             dev
 INSTALL_PAZPAR2          no
 INSTALL_SRU              yes
 INSTALL_ZEBRA            yes
 USE_MEMCACHED            no
 ZEBRA_LANGUAGE           en
 ZEBRA_MARC_FORMAT        marc21
 ZEBRA_PASS               zebrastripes
 ZEBRA_SRU_HOST           localhost
 ZEBRA_USER               kohauser

 and in the following directories:

 DOC_DIR                  C:\koha-dev\doc
 INTRANET_CGI_DIR         C:\koha_src
 INTRANET_TMPL_DIR        C:\koha_src\koha-tmpl\intranet-tmpl
 INTRANET_WWW_DIR         C:\koha_src\koha-tmpl
 KOHA_CONF_DIR            C:\koha-dev\etc
 LOG_DIR                  C:\koha-dev\var\log
 MAN_DIR                  C:\koha-dev\man
 MISC_DIR                 C:\koha-dev\misc
 OPAC_CGI_DIR             C:\koha_src
 OPAC_TMPL_DIR            C:\koha_src\koha-tmpl\opac-tmpl
 OPAC_WWW_DIR             C:\koha_src\koha-tmpl
 PAZPAR2_CONF_DIR         C:\koha-dev\etc\pazpar2
 PERL_MODULE_DIR          C:\koha_src
 SCRIPT_DIR               C:\koha-dev\bin
 SCRIPT_NONDEV_DIR        C:\koha-dev\bin
 ZEBRA_CONF_DIR           C:\koha-dev\etc\zebradb
 ZEBRA_DATA_DIR           C:\koha-dev\var\lib\zebradb
 ZEBRA_LOCK_DIR           C:\koha-dev\var\lock\zebradb
 ZEBRA_RUN_DIR            C:\koha-dev\var\run\zebradb

 To change any configuration setting, please run
 perl Makefile.PL again.  To override one of the target
 directories, you can do so on the command line like this:

 perl Makefile.PL PERL_MODULE_DIR=/usr/share/perl/5.8

 You can also set different default values for parameters
 or override directory locations by using environment variables.

 For example:

 export DB_USER=my_koha
 perl Makefile.PL


 DB_USER=my_koha DOC_DIR=/usr/local/info perl Makefile.PL

 If installing on a Win32 platform, be sure to use:
 'dmake -x MAXLINELENGTH=3000000'

 Warning: prerequisite CGI::Session::Driver::memcached 0.04 not found.
 Warning: prerequisite DBD::SQLite2 0.33 not found.
 Warning: prerequisite Graphics::Magick 1.3.05 not found.
 Warning: prerequisite Gravatar::URL 1.03 not found.
 Warning: prerequisite HTML::Template::Pro 0.69 not found.
 Warning: prerequisite HTTP::OAI 3.2 not found.
 Warning: prerequisite Memoize::Memcached 0.03 not found.
 Writing Makefile for koha

 [../../../koha_src C:\koha_src]
  1. Create the koha db in mysql and then do:
C:\koha_src\installer\data\mysql>mysql -uroot -p koha<kohastructure.sql
 Enter password: ***********
  1. Next do 'dmake -x MAXLINELENGTH=3000000'
  2. Then do 'dmake install'
  3. Fixup Apache httpd.conf
    1. You'll have to modify httpd.conf with some lines like the following (NOTE: You are responsible for securing your own webserver; these suggestions are provided "as is" with no warranty whatsoever... you've been warned.)
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
DocumentRoot "C:/koha_src/koha-tmpl"

# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories). 
# First, we configure the "default" to be a very restrictive set of 
# features.  
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all

# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.

<Directory "C:/koha_src">

    # Controls who can get stuff from this server.
    Order allow,deny
    Allow from all


  1. You'll have to do some fixup on the directory path separators in koha-httpd.conf; Here is an excerpt from what I did:

   ServerAdmin  webmaster@Accounting
   DocumentRoot C:/koha_src/koha-tmpl
   ServerName Accounting
#  ServerAlias opac.mydomain.com
   ScriptAlias /cgi-bin/koha/ "C:/koha_src/opac/"
   ScriptAlias /index.html "C:/koha_src/opac/opac-main.pl"
   ScriptAlias /opac-search.pl "C:/koha_src/opac/opac-search.pl"
   ScriptAlias /search "C:/koha_src/opac/opac-search.pl"
   ErrorLog C:/koha-dev/var/log/koha-opac-error_log
#  CustomLog C:/koha-dev/var/log/koha-opac-access_log combined
#  TransferLog C:/koha-dev/var/log/koha-opac-access_log
   SetEnv KOHA_CONF "C:/koha-dev/etc/koha-conf.xml"
   SetEnv PERL5LIB "C:/koha_src"

  1. NOTE: If running a 'dev' install the 'fix-perl-path.pl' must be run on the repo/etc. directory whereas the installer only runs it on the 'blib' directory. Failure to do this will result in the following error in the error log:
[Wed Oct 05 22:13:42 2011] [error] [client] (OS 3)The system cannot find the path specified. : couldn't create child process: 720003: mainpage.pl
[Wed Oct 05 22:13:42 2011] [error] [client] (OS 3)The system cannot find the path specified. : couldn't spawn child process: [../../../koha_src/mainpage.pl C:/koha_src/mainpage.pl]
  1. ALTERNATE: As an alternate to the above path mods, you can move a copy of the perl executable to C:/usr/bin. This is actually preferrable on a development installation as it keeps GIT happy. (A thing greatly to be desired!)
    1. Install zebrasrv as a service by doing:

C:\Program Files\Zebra\bin>zebrasrv -install -l C:\koha-dev\var\log\zebrasrv-error_log

  1. Before starting your Zebra, be sure to:
    1. Comment/uncomment the correct listen directive lines in koha-conf.xml for win32.
    2. Fixup directory path separators in <xi:fallback> directives like this:

<xi:include href="C:/koha-dev/etc/zebradb/explain-biblios.xml" xmlns:xi="http://www.w3.org/2001/XInclude">

  1. Kick-start your new Zebra in the same way you do all Windows services. Check the zebrasrv-error_log for clues if your zebra borks on you. You may also find such as this useful:

C:\Program Files\Zebra\bin>"C:\Program Files\Zebra\bin\zebrasrv.exe" -v fatal -l C:\koha-dev\var\log\zebrasrv-error_log -f C:\koha-dev\etc\koha-conf.xml

Personal tools