<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<article>
  <title>Installing Koha on Mac OS X</title>

  <articleinfo>
    <pubdate>2006-01-25</pubdate>

    <author>
      <firstname>Stephen</firstname>

      <surname>Hedges</surname>

      <email>shedges AT skemotah.com</email>
    </author>

    <copyright>
      <year>2006</year>

      <holder>Skemotah Solutions</holder>
    </copyright>

    <legalnotice>
      <para>This document is related to Koha and is licensed to you under the
      GNU General Public License version 2 or later (<ulink
      url="http://www.gnu.org/licenses/gpl.html">http://www.gnu.org/licenses/gpl.html</ulink>).</para>

      <para>Koha-related documents may be reproduced and distributed in whole
      or in part, in any medium physical or electronic, as long as this
      copyright notice is retained on all copies.</para>

      <para>You may create a derivative work and distribute it provided that
      you:</para>

      <orderedlist>
        <listitem>
          <para>License the derivative work with this same license, or the
          Linux Documentation Project License (<ulink
          url="http://www.tldp.org/COPYRIGHT.html">http://www.tldp.org/COPYRIGHT.html</ulink>).
          Include a copyright notice and at least a pointer to the license
          used.</para>
        </listitem>

        <listitem>
          <para>Give due credit to previous authors and major
          contributors.</para>
        </listitem>
      </orderedlist>

      <para>Commercial redistribution is allowed and encouraged; however, the
      author would like to be notified of any such distributions.</para>

      <para>No liability for the contents of this document can be accepted.
      Use the concepts, examples and information at your own risk. There may
      be errors and inaccuracies, that could be damaging to your system.
      Proceed with caution, and although this is highly unlikely, the
      author(s) do not take any responsibility.</para>

      <para>All copyrights are held by their by their respective owners,
      unless specifically noted otherwise. Use of a term in this document
      should not be regarded as affecting the validity of any trademark or
      service mark. Naming of particular products or brands should not be seen
      as endorsements.</para>
    </legalnotice>

    <revhistory>
      <revision>
        <revnumber>2.2.5</revnumber>

        <date>2006-01-25</date>

        <authorinitials>sh</authorinitials>

        <revdescription>
          <para>Initial version</para>
        </revdescription>
      </revision>
    </revhistory>
  </articleinfo>

  <section>
    <title>Introduction</title>

    <para>Most of Koha will work on the Mac OS X operating system, so long as
    you have version 10.2 or higher. Earlier versions of OS X do not support
    some of the other programs that Koha uses, particularly MySQL. The one
    part of Koha that you will not be able to install is the Z39.50 client.
    That is because the current version of Koha (2.2.5) uses the
    <filename>Net::Z3950</filename> Perl module, which in turn depends on the
    <filename>Event</filename> module, which has not been ported to OS X. This
    should be remedied in the future, beginning with Koha version 3.0.</para>

    <para>Because of this and some other limitations, I would not advise using
    Koha on OS X in a production environment. Until the next version of Koha
    is released, it is best to consider your Koha installation as a test-bed
    for experimenting with Koha. Version 3.0 will have enough stability on OS
    X to be used in production.</para>

    <para>If you have OS X Server, some of the support programs that you need
    to run Koha will already be on your computer; if you do not, these
    instructions will help you get what you need to have. These instructions
    were developed in the course of installing Koha 2.2.5 on standard Mac OS X
    v10.3.9.</para>

    <remark>Special thanks to Adam Steer for sharing his experiences with Koha
    on Mac OS X.</remark>
  </section>

  <section>
    <title>Support programs and utilities</title>

    <para>Koha is a L.A.M.P application -- meaning that it is developed for
    use on systems running Linux, Apache, MySQL, and Perl. While other
    configurations are possible if you make modifications to Koha, these
    instructions assume that Koha will be installed without major
    modifications. So the first step is to set up your Mac OS X computer with
    all the programs and utilities necessary to run a L.A.M.P
    application.</para>

    <section>
      <title>Linux</title>

      <para>Mac OS X is essentially a Linux OS (based loosely on FreeBSD), so
      technically you already have Linux. However, you may not have X11 and
      the developer tools, both of which will give you more complete Linux
      capabilities and make some aspects of Koha easier to manage.</para>

      <para>To check to see if you have X11 on your Mac, go to
      Applications&gt;Utilities and look for X11. If it is not there, you can
      download it from <ulink
      url="http://www.apple.com/downloads/macosx/apple/x11formacosx.html">www.apple.com/downloads/macosx/apple/x11formacosx.html</ulink>.</para>

      <para>To install developer tools, go to
      Applications&gt;Installers&gt;Xcode Tools and open the Developer.mpkg
      package. If the package is not there, you can download it from <ulink
      url="http://developer.apple.com/tools">developer.apple.com/tools</ulink>.</para>

      <note>
        <para>The Apple website tends to change fairly often, so don't be
        surprised if the URLs above do not work and you have to search to find
        the current download sites.</para>
      </note>
    </section>

    <section>
      <title>Apache</title>

      <para>This one is easy. If you haven't already done so, go to System
      Preferences&gt;Sharing and turn on Personal Web Sharing.</para>

      <figure>
        <title>Personal Web Sharing</title>

        <mediaobject>
          <imageobject>
            <imagedata fileref="macapache.gif" />
          </imageobject>
        </mediaobject>
      </figure>

      <para>If you prefer working from a terminal window, you can also
      do:<programlisting>emac:~ admin$ sudo apachectl start</programlisting></para>

      <para>Be ready to supply your administrator password (the one you use to
      apply system updates from Apple).</para>

      <para>The web server configuration file, by the way, can be found at
      <filename>/etc/httpd/httpd.conf</filename>. You will need to modify it
      after you install Koha.</para>
    </section>

    <section>
      <title>MySQL</title>

      <para>Releases of MySQL are available as <filename>.dmg</filename> files
      from <ulink
      url="http://downloads.mysql,com">http://downloads.mysql,com</ulink>,
      meaning they are easy to install; however, the newer releases of MySQL
      can cause problems with Koha. Starting with version 4.1.x, MySQL uses a
      new password hash that is not compatible with the Koha code. There's an
      explanation of this problem at <ulink
      url="http://dev.mysql.com/doc/refman/4.1/en/old-client.html">http://dev.mysql.com/doc/refman/4.1/en/old-client.html</ulink>.
      Beginning with version 5.0, MySQL treats <varname>return</varname> as a
      reserved word; unfortunately, Koha uses <varname>return</varname> as a
      data column name, so MySQL 5.0.x is unusable with Koha (at this writing,
      at least).</para>

      <para>The password problems and some other MySQL limitations can be
      avoided by downloading the OS X installer version of MySQL 4.1.16 from
      <ulink
      url="http://dev.mysql.com/downloads/mysql/4.1.html">http://dev.mysql.com/downloads/mysql/4.1.html</ulink>.
      Install both the MySQL package and the StartupItem package, then restart
      your computer. MySQL is now started. Before we install Koha, we'll do
      some things to work around the Koha limitations.</para>

      <para>(If you are running Mac OS X Server, you are in luck -- MySQL is
      already on your machine. Just go to Applications&gt;Server&gt;MySQL
      Manager to access it. But be aware of the problems with versions later
      than 4.1. Generally, if your OS X Server is earlier than version 10.4,
      you'll have no problems, otherwise you'll need to take the following
      steps to work around the Koha limitations.)</para>

      <para>Make a note of the root password for your MySQL -- you will need
      it when you install Koha. (In fact, if you just installed MySQL, I
      recommend that you leave the root password blank until after you have
      installed Koha.)</para>

      <para>To make it easier to access MySQL later, you might want to set an
      alias or modify your PATH environment. For `tcsh' use:<programlisting>alias mysql /usr/local/mysql/bin/mysql
alias mysqladmin /usr/local/mysql/bin/mysqladmin</programlisting></para>

      <para>Even better, add <filename>/usr/local/mysql/bin</filename> to your
      `PATH' environment variable by adding the following line to your
      `$HOME/.tcshrc' file if your shell is `tcsh':<programlisting>setenv PATH ${PATH}:/usr/local/mysql/bin</programlisting></para>

      <para>For `bash', use:<programlisting>alias mysql=/usr/local/mysql/bin/mysql
alias mysqladmin=/usr/local/mysql/bin/mysqladmin</programlisting></para>

      <para>Now go to a terminal window and access mysql as root:</para>

      <programlisting>[emac:~] admin% mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22 to server version: 4.1.16-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql&gt; </programlisting>

      <para>From this <prompt>mysql&gt;</prompt> prompt, enter
      <userinput>GRANT ALL PRIVILEGES ON *.* to 'kohaadmin'@'localhost'
      IDENTIFIED BY 'xxxxxxxx';</userinput> where the x's are replaced by a
      password. This assumes that you are going to use the default "kohaadmin"
      user name for your database and will refer to your computer as
      "localhost" when running Koha. (Note that the Koha installer will try to
      grab whatever your Mac calls itself -- "emac" in our example -- so
      remember to use "localhost" when the installer prompts you for this
      information.) Make a note of the password you choose, the installer will
      ask for it.</para>

      <para>Next we need to keep the installer from trying to set up this same
      account. When you unzip your Koha tarball, you will create a folder
      called <filename>Koha-2.2.5</filename>, and in this folder you will find
      <filename>Installer.pm</filename>. You will be commenting lines 1812 and
      1813 to prevent the installer from trying to create the account you just
      created manually.</para>

      <programlisting>#    print system("$mysqldir/bin/mysql -u$mysqluser -e \"insert into user (Host,User,Password)
             values ('$hostname','$user',password('$pass'))\" mysql\;");
#    system("$mysqldir/bin/mysql -u$mysqluser -e \"insert into db (Host,Db,User,Select_priv,
             Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv, index_priv, alter_priv)
             values ('%','$database','$user','Y','Y','Y','Y','Y','Y','Y','Y')\" mysql");</programlisting>

      <para>Now your MySQL should be ready to go.</para>

      <note>
        <para>Once again, this method of installing MySQL and setting up the
        Koha administrator account is not recommended for a production
        environment.</para>
      </note>
    </section>

    <section>
      <title>Perl</title>

      <para>If you are running OS X 10.3 or later, this is the easiest step of
      all -- you already have Perl 5.8 on your machine. If you are running
      10.2, then the instructions at <ulink
      url="http://developer.apple.com/internet/opensource/perl.html">http://developer.apple.com/internet/opensource/perl.html</ulink>
      will help you get Perl set up on your computer.</para>

      <para>You are also going to need some Perl modules, but we will deal
      with those in the course of our installation. For now, you should have
      everything you need to start the Koha installation.</para>
    </section>
  </section>

  <section>
    <title>Installing Koha -- first pass</title>

    <para>First of all, go to <ulink
    url="http://sourceforge.net/projects/koha">http://sourceforge.net/projects/koha</ulink>
    and get the most recent version of the Koha tarball (currently 2.2.5 as
    this is written). When you download this to your computer, your Mac should
    automatically unzip it for you and leave you with a
    <filename>Koha-2.2.5</filename> folder, most likely located on your
    desktop.</para>

    <para>Open a terminal window and navigate to this folder (e.g.
    <userinput>cd Desktop/Koha-2.2.5</userinput>). Then start the install
    script:</para>

    <programlisting>emac:~/Desktop/Koha-2.2.5 admin$ sudo perl installer.pl
Password:




 WELCOME TO THE KOHA INSTALLER 

This program will ask some questions and try to install koha for you. You
need to know: where most koha files should be stored (you can set the
prefix environment variable for this); the username and password of a mysql
superuser; and details of your library setup. You may also need to know
details of your Apache setup.

If you want to install the Koha configuration files somewhere other than
/etc (for installing not as root, or to have many Kohas on one system, for
example), you should set the etcdir environment variable. Please look at
your manuals for details of how to set that.

Recommended answers are given in brackets after each question. To accept
the default value for any question (indicated by []), simply hit Enter at
the prompt.

Note that you also can define an auto_install_file, that will answer every
question automatically. To use this feature, run ./installer.pl -i
/path/to/auto_install_file 

Are you ready to begin the installation? ([Y]/N): </programlisting>

    <para>Answer "Y" to the prompt, and Koha will run a check of your system
    and let you know what is still missing. Your display will probably look
    like this:</para>

    <programlisting>Checking perl modules ... 


The Net::Z3950 module is missing. This module is necessary if you want to
use Koha's Z39.50 client to download bibliographic records from other
libraries.

To install this module, you will need the yaz client installed from
http://www.indexdata.dk/yaz/ and then you can install the perl module with
the command:

perl -MCPAN -e 'install Net::Z3950'

...or by installing packages for your distribution, if available.

IMPORTANT NOTE : If you use Perl 5.8.0, you might need to edit NET::Z3950's
Makefile.PL and yazwrap/Makefile.PL to include:

'DEFINE' =&gt; '-D_GNU_SOURCE',

Also note that some installations of Perl on Red Hat will generate a lot of
"'my_perl' undeclared" errors when running make in Net-Z3950. This is fixed
by inserting in yazwrap/ywpriv.h a line saying #include "XSUB.h"

Press the &lt;ENTER&gt; key to continue: </programlisting>

    <para>And then when you press &lt;ENTER&gt; you will get a list of some
    more modules you are missing, and the installer will abort:</para>

    <programlisting>You are missing some Perl modules required by Koha. Please run this again
after installing them. They may be installed by finding packages from your
operating system supplier, or running (as root) the following commands:

perl -MCPAN -e 'install "DBI"'

perl -MCPAN -e 'install "Date::Manip"'

perl -MCPAN -e 'install "DBD::mysql"'

perl -MCPAN -e 'install "HTML::Template"'

perl -MCPAN -e 'install "MARC::Record"'

perl -MCPAN -e 'install "Mail::Sendmail"'

perl -MCPAN -e 'install "You will need PDF::API2 for barcode generator"'

perl -MCPAN -e 'install "Net::LDAP"'

perl -MCPAN -e 'install "Event"'

perl -MCPAN -e 'install "Net::Z3950"'
emac:~/Desktop/Koha-2.2.3 admin$ </programlisting>

    <para>Let's deal with the modules listed up to <filename>Event</filename>,
    then deal with <filename>Event</filename> and
    <filename>Net::Z3950</filename> separately.</para>

    <section>
      <title>Perl modules</title>

      <para>Follow these instructions to install the missing Perl modules on
      your computer, but be aware that you need to do this as root --
      <userinput>sudo</userinput> will not give you enough permissions. This
      is true of all the Perl modules you need to install, so be brave (but
      careful) and login as root on your computer:</para>

      <programlisting>emac:~/Desktop/Koha-2.2.5 admin$ su -l root
Password:
emac:~ root#</programlisting>

      <para>Note that the root password is different than your administrator
      password, and in fact may not be defined at all on your system. This is
      a security measure of OS X. If you have trouble logging in as root, you
      may have to set the root password first:</para>

      <programlisting>emac:~/Desktop/Koha-2.2.5 admin$ sudo passwd root
Password:
Changing password for root.
New password:
Retype new password:</programlisting>

      <para>The first password requested will be your administrator password.
      Choose a different password for your root password. Login as root and
      continue the process of installing modules.</para>

      <para>This process is actually pretty easy: grab each module from CPAN
      and install it in one step, using the commands listed by the installer
      program:</para>

      <programlisting>emac:~ root# perl -MCPAN -e 'install "DBI"'</programlisting>

      <note>
        <para>If this is the first time you have used CPAN, you will have to
        go through the process of configuring it. See the <ulink
        url="http://www.kohadocs.org/Installing_Koha_on_Debian_Woody.html#d0e547">Configuring
        Perl's CPAN utility</ulink> section of Joshua Ferraro's
        <citetitle>Installing Koha on Debian</citetitle> document on
        www.kohadocs.org for guidance.</para>
      </note>

      <para>If all goes well, a lot of stuff will fly by on your screen,
      ending with something like this:</para>

      <programlisting>[...]
Installing /man/man3/DBI::DBD.3pm
Installing /man/man3/DBI::DBD::Metadata.3pm
Installing /man/man3/DBI::FAQ.3pm
Installing /man/man3/DBI::Profile.3pm
Installing /man/man3/DBI::ProfileData.3pm
Installing /man/man3/DBI::ProfileDumper.3pm
Installing /man/man3/DBI::ProfileDumper::Apache.3pm
Installing /man/man3/DBI::ProxyServer.3pm
Installing /man/man3/DBI::PurePerl.3pm
Installing /man/man3/DBI::SQL::Nano.3pm
Installing /man/man3/DBI::W32ODBC.3pm
Installing /man/man3/Roadmap.3pm
Installing /man/man3/Win32::DBIODBC.3pm
Installing /usr/bin/dbiprof
Installing /usr/bin/dbiproxy
Writing ///Library/Perl/5.8.1/darwin-thread-multi-2level/auto/DBI/.packlist
Appending installation info to ///System/Library/Perl/5.8.1/darwin-thread-multi-2level/perllocal.pod
  /usr/bin/make install  -- OK
emac:~ root#</programlisting>

      <para>Repeat this process for each of the Perl modules listed as missing
      by the installer, until you get to the line that says "You will need
      PDF::API2 for barcode generator."</para>

      <para>Koha has a built-in barcode generator, but it depends on a older
      version of the Perl <filename>PDF::API2</filename> module than the one
      available from CPAN. If you want to print your own barcodes, you need to
      grab the version 0.3r77 tarball of <filename>PDF::API2</filename> from
      <ulink
      url="???">http://cpan.mirror.fr/index2.php?pwd=modules%2Fby-module%2F%2FPDF</ulink>
      (or anywhere else you can find it), unzip it into a
      <filename>PDF-API2-0.3r77</filename> folder, navigate to that folder,
      and install it:</para>

      <programlisting>emac:~ root# cd /Users/admin/Desktop/PDF-API2-0.3r77
emac:/Users/admin/Desktop/PDF-API2-0.3r77 root# Perl Makefile.pl
   ____  ____  _____              _    ____ ___   ____
  |  _ \|  _ \|  ___|  _   _     / \  |  _ \_ _| |___ \
  | |_) | | | | |_    (_) (_)   / _ \ | |_) | |    __) |
  |  __/| |_| |  _|    _   _   / ___ \|  __/| |   / __/
  |_|   |____/|_|     (_) (_) /_/   \_\_|  |___| |_____|
                                      (0.3r77)
  please look at http://www.penguin.at0.net/~fredo/files/
  for examples and contrib.
Checking if your kit is complete...
Looks good
Warning: prerequisite Compress::Zlib 1.03 not found.
Writing Makefile for PDF::API2
anything else ? NO.
emac:/Users/admin/Desktop/PDF-API2-0.3r77 root#</programlisting>

      <para>At this point, you might as well go ahead and grab the
      <filename>Compress::Zlib</filename> module:</para>

      <programlisting>emac:/Users/admin/Desktop/PDF-API2-0.3r77 root# perl -MCPAN -e 'install "Compress::Zlib"'</programlisting>

      <para>Then continue with the installation of
      <filename>PDF-API2</filename>:</para>

      <programlisting>emac:/Users/admin/Desktop/PDF-API2-0.3r77 root# make
cp lib/PDF/API2/ExtGState.pm blib/lib/PDF/API2/ExtGState.pm
cp lib/PDF/API2/TTF/Fpgm.pm blib/lib/PDF/API2/TTF/Fpgm.pm
[...]
cp lib/PDF/API2/Page.pm blib/lib/PDF/API2/Page.pm
cp lib/PDF/API2/PDF/AFont.pm blib/lib/PDF/API2/PDF/AFont.pm

emac:/Users/admin/Desktop/PDF-API2-0.3r77 root# make install
Installing /Library/Perl/5.8.1/PDF/API2.pm
Installing /Library/Perl/5.8.1/PDF/API2/Annotation.pm
[...]
Installing /Library/Perl/5.8.1/PDF/API2/UniMap/microsoft-dingbats.map
Writing ///Library/Perl/5.8.1/darwin-thread-multi-2level/auto/PDF/API2/.packlist
Appending installation info to ///System/Library/Perl/5.8.1/darwin-thread-multi-2level/perllocal.pod
emac:/Users/admin/Desktop/PDF-API2-0.3r77 root#</programlisting>

      <para revisionflag="deleted">Next on the list of modules is
      <filename>Net::LDAP</filename>, which you will only need if you are
      going to retrieve lists of authorized users from an LDAP server. If you
      use the nifty <userinput>perl -MCPAN -e 'install'</userinput> command
      for this, you'll get a list of missing modules that are dependencies or
      options for the <filename>Net::Z3950</filename> module:</para>

      <programlisting>- Convert::ASN1   ...missing. (would need 0.07)
- Authen::SASL    ...missing. (would need 2)
- URI::ldap       ...missing. (would need 1.1)
- IO::Socket::SSL ...missing. (would need 0.81)
- XML::SAX::Base  ...missing.</programlisting>

      <para>If you choose "yes" for installing all of these, you'll always get
      an error:</para>

      <programlisting>Writing Makefile for Net::LDAP
make: *** No targets specified and no makefile found.  Stop.
  /usr/bin/make  -- NOT OK
Running make test
  Can't test without successful make
Running make install
  make had returned bad status, install seems impossible</programlisting>

      <para>You have two choices here. You can do the easy thing and choose
      <emphasis>not </emphasis>to install the
      <filename>IO::Socket::SSL</filename> module, which should allow
      <filename>Net::Z3950</filename> to install. Or if you feel you must have
      a complete installation, you can go to <ulink
      url="http://ldap.perl.org/">http://ldap.perl.org/</ulink> to download
      the <filename>perl-ldap-0.33</filename> tarball and install it manually.
      Unzip the tarball, navigate to that directory, and run the
      <filename>Makefile.PL</filename> script:</para>

      <programlisting>emac:/Users/admin/Desktop/perl-ldap-0.33 root# perl Makefile.PL
*** ExtUtils::AutoInstall version 0.59
*** Checking for dependencies...
[Core Features]
- Convert::ASN1   ...loaded. (0.19 &gt;= 0.07)
[SASL authentication]
- Authen::SASL    ...loaded. (2.09 &gt;= 2)
- Digest::MD5     ...loaded. (2.26)
[LDAP URLs]
- URI::ldap       ...loaded. (1.11 &gt;= 1.1)
[LDAPS]
- IO::Socket::SSL ...missing. (would need 0.81)
==&gt; Auto-install the 1 optional module(s) from CPAN? [n] y
[Read/Write DSML files]
- XML::SAX::Base  ...loaded. (1.02)
[Read/Write LDIF files]
- MIME::Base64    ...loaded. (2.20)
*** Dependencies will be installed the next time you type 'make'.
*** ExtUtils::AutoInstall configuration finished.
*** Installing dependencies...
*** Installing IO::Socket::SSL...
CPAN: Storable loaded ok
Going to read /var/root/.cpan/Metadata
[...]</programlisting>

      <para>Go ahead and choose to install the optional
      <filename>IO::Socket::SSL</filename> module. The process will end the
      same way as the process started with the <userinput>perl -MCPAN -e
      'install'</userinput> command, but now there's a way out, using the
      <filename>install-nomake</filename> script that comes with the
      tarball:</para>

      <programlisting>Writing Makefile for Net::LDAP
emac:/Users/admin/Desktop/perl-ldap-0.33 root# make
make: *** No targets specified and no makefile found.  Stop.

emac:/Users/admin/Desktop/perl-ldap-0.33 root# perl ./install-nomake
Installing /Library/Perl/5.8.1/Bundle/Net/LDAP.pm
Installing /Library/Perl/5.8.1/LWP/Protocol/ldap.pm
[...]
Installing /Library/Perl/5.8.1/Net/LDAP/Extension/SetPassword.pm
Installing /Library/Perl/5.8.1/Net/LDAP/Extension/WhoAmI.pm
emac:/Users/admin/Desktop/perl-ldap-0.33 root#</programlisting>

      <para>Done!</para>

      <para>The final two missing modules listed by the Koha installer program
      are <filename>Event</filename> and <filename>Net::Z3950</filename>.
      These two modules allow the Koha Z39.50 client to install and function.
      Unfortunately, they won't install on Mac OS X, because the
      <filename>Event</filename> module has not been ported to OS X, and
      <filename>Net::Z3950</filename> is dependent on
      <filename>Event</filename>. This problem should be fixed in future
      version of Koha, which will not use the <filename>Event</filename>
      module, but for now you'll just have to forego doing Z39.50 searches
      from Koha.</para>
    </section>
  </section>

  <section>
    <title>Installing Koha -- second pass</title>

    <para>Now you should be able to try the installation process again. Let's
    look at this process:</para>

    <programlisting>emac:~/Desktop/Koha-2.2.5 admin$ sudo perl installer.pl


 WELCOME TO THE KOHA INSTALLER 

This program will ask some questions and try to install koha for you. You
need to know: where most koha files should be stored (you can set the
prefix environment variable for this); the username and password of a mysql
superuser; and details of your library setup. You may also need to know
details of your Apache setup.

If you want to install the Koha configuration files somewhere other than
/etc (for installing not as root, or to have many Kohas on one system, for
example), you should set the etcdir environment variable. Please look at
your manuals for details of how to set that.

Recommended answers are given in brackets after each question. To accept
the default value for any question (indicated by []), simply hit Enter at
the prompt.

Note that you also can define an auto_install_file, that will answer every
question automatically. To use this feature, run ./installer.pl -i
/path/to/auto_install_file 

Are you ready to begin the installation? ([Y]/N): y
Great!  Continuing...



 PERL MODULES 

Checking perl modules ... 


The Net::Z3950 module is missing. This module is necessary if you want to
use Koha's Z39.50 client to download bibliographic records from other
libraries.

To install this module, you will need the yaz client installed from
http://www.indexdata.dk/yaz/ and then you can install the perl module with
the command:

perl -MCPAN -e 'install Net::Z3950'

...or by installing packages for your distribution, if available.

IMPORTANT NOTE : If you use Perl 5.8.0, you might need to edit NET::Z3950's
Makefile.PL and yazwrap/Makefile.PL to include:

'DEFINE' =&gt; '-D_GNU_SOURCE',

Also note that some installations of Perl on Red Hat will generate a lot of
"'my_perl' undeclared" errors when running make in Net-Z3950. This is fixed
by inserting in yazwrap/ywpriv.h a line saying #include "XSUB.h"

Press the &lt;ENTER&gt; key to continue: 


 PERL MODULES AVAILABLE 

All required perl modules are installed.

Press &lt;ENTER&gt; to continue: 



 OPAC DIRECTORY 

Please supply the directory you want Koha to store its OPAC files in. This
directory will be auto-created for you if it doesn't exist.

OPAC Directory [/usr/local/koha/opac]: 


 LIBRARIAN DIRECTORY 

Please supply the directory you want Koha to store its Librarian interface
files in. This directory will be auto-created for you if it doesn't exist.

Intranet Directory [/usr/local/koha/intranet]: 


 LOG DIRECTORY 

Specify a directory where log files will be written.

Koha Log Directory [/usr/local/koha/log]: 


 DATABASE NAME 

Please provide the name that you wish to give your koha database. It must
not exist already on the database server.

Most users give a short single-word name for their library here.

Database name [Koha]: 


 DATABASE HOST 

Please provide the mysql server name. Unless the database is stored on
another machine, this should be "localhost".

Database host [localhost]: 


 DATABASE USER 

We are going to create a new mysql user for Koha. This user will have full
administrative rights to the database called Koha when they connect from
localhost. This is also the name of the Koha librarian superuser.

Most users give a single-word name here.

Database user [kohaadmin]: 


 DATABASE PASSWORD 

Please provide a good password for the user kohaadmin.

IMPORTANT: You can log in using this user and password at any time.

Password for database user kohaadmin: xxxxxxxxx


 APACHE CONFIGURATION 

Koha needs to write an Apache configuration file for the OPAC and Librarian
sites. By default this installer will do this by using one name and two
different ports for the virtual hosts. There are other ways to set this up,
and the installer will leave comments in /etc/koha-httpd.conf about them.

NOTE: You will need to add lines to your main httpd.conf to include
/etc/koha-httpd.conf (using the Include directive) and to make sure it is
listening on the right ports and host names (using the Listen directive).

Press &lt;ENTER&gt; to continue: 


 WEB E-MAIL CONTACT 

Enter the e-mail address to be used as a contact for Koha. This address is
displayed if fatal errors are encountered.

E-mail contact [webmaster@local]: auser@yourdomain


 WEB HOST NAME OR IP ADDRESS 

Please enter the host name or IP address that you wish to use for koha.
Normally, this should be a name or IP that belongs to this machine.

Host name or IP Address [emac.local]: localhost


 OPAC PORT 

Please enter the port for your OPAC interface. This defaults to port 80,
but if you are already serving web content with this hostname, you should
change it to a different port (8000 might be a good choice, but check any
firewalls).

Enter the OPAC Port [80]: 


 LIBRARIAN PORT 

Please enter the port for your Librarian interface. This must be different
from the OPAC port (80).

Enter the Intranet Port [8080]: 



 UPDATING APACHE CONFIGURATION 

Checking for modules that need to be loaded... 

Use of uninitialized value in pattern match (m//) at Install.pm line 630, &lt;HC&gt; line 206.


 APACHE CONFIGURATION NEEDS UPDATE 

Koha uses the mod_env and mod_include apache features, but the installer
did not find them in your config. Please make sure that they are enabled
for your Koha site.

Use of uninitialized value in pattern match (m//) at Install.pm line 634, &lt;HC&gt; line 206.
Use of uninitialized value in pattern match (m//) at Install.pm line 634, &lt;HC&gt; line 206.
Use of uninitialized value in pattern match (m//) at Install.pm line 634, &lt;HC&gt; line 206.
Use of uninitialized value in pattern match (m//) at Install.pm line 634, &lt;HC&gt; line 206.
Use of uninitialized value in pattern match (m//) at Install.pm line 634, &lt;HC&gt; line 206.
Use of uninitialized value in pattern match (m//) at Install.pm line 634, &lt;HC&gt; line 206.
Press &lt;ENTER&gt; to continue: 


 INSTALLING FILES 

Copying files to installation directories:Copying admin templates to /usr/local/koha/intranet/htdocs.
Copying admin interface to /usr/local/koha/intranet/cgi-bin.
Copying main scripts to /usr/local/koha/intranet/scripts.
Copying perl modules to /usr/local/koha/intranet/modules.
Copying OPAC templates to /usr/local/koha/opac/htdocs.
Copying OPAC interface to /usr/local/koha/opac/cgi-bin.


 MYSQL ROOT USER PASSWORD 

To create the koha database, please enter your mysql server's root user
password:

Password: 


 CREATING DATABASE 

Creating the MySQL database for Koha...</programlisting>

    <para>...and so forth. The installer will ask a few more questions about
    your preferred language, your preferred flavor of MARC, etc., but at this
    point you are just about finished.</para>
  </section>

  <section>
    <title>Modifying the httpd.conf files</title>

    <para>If you are using a standard version of the Apache configuration
    file, you saw a message about mod_env and mod_include not being found by
    the installer. Actually, mod_include is probably already enabled, but
    mod_env is not. We now need to fix this and do some modifications to the
    file to enable Koha to work.</para>

    <para>The file you will be editing is
    <filename>/etc/httpd/httpd.conf</filename>, and you will need to have root
    (administrator) privileges in order to change it. Make a backup copy
    before you begin. In the file you will see a section that looks like
    this:</para>

    <programlisting># Note: The order in which modules are loaded is important.  Don't change
# the order below without expert advice.
#
# Example:
# LoadModule foo_module libexec/mod_foo.so
#LoadModule vhost_alias_module libexec/httpd/mod_vhost_alias.so
#LoadModule env_module         libexec/httpd/mod_env.so
LoadModule config_log_module  libexec/httpd/mod_log_config.so
...
#LoadModule info_module        libexec/httpd/mod_info.so
LoadModule includes_module    libexec/httpd/mod_include.so
LoadModule autoindex_module   libexec/httpd/mod_autoindex.so</programlisting>

    <para>Remove the "#" from the beginning of the line
    <computeroutput>#LoadModule env_module
    libexec/httpd/mod_env.so</computeroutput> to uncomment it and make it
    active. Following this section of the file you will see a section that
    begins like this:</para>

    <programlisting>#  [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]
ClearModuleList
#AddModule mod_vhost_alias.c
#AddModule mod_env.c
AddModule mod_log_config.c</programlisting>

    <para>Again, uncomment the line <computeroutput>#AddModule
    mod_env.c</computeroutput>. Now go to the end of the file and add the
    following line:</para>

    <programlisting>Include /etc/koha-httpd.conf</programlisting>

    <para>Save this file.</para>

    <note>
      <para>Save a backup copy of this altered file, too. Updates you receive
      to your Mac software may overwrite your changes, so keep them safe
      somewhere else.</para>
    </note>

    <para>Now edit <filename>/etc/koha-httpd.conf</filename>. Here you will be
    altering the "Listen" directives. You will see a line that says
    <computeroutput>#Listen 8080</computeroutput>. Uncomment this line, and
    add another line:</para>

    <programlisting>Listen 8080
Listen 80</programlisting>

    <para>Restart Apache and you should be finished. Open a browser, type in
    the URL <filename>http://localhost</filename> and you should see the Koha
    OPAC. Type in <filename>http://localhost:8080</filename> and you should
    see the Koha librarian login screen. (Use <varname>kohaadmin</varname> and
    your password to access Koha.) Enjoy!</para>
  </section>
</article>