1 #!/usr/bin/perl -w # please develop with -w
4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA 02111-1307 USA
22 use strict; # please develop with the strict pragma
26 *******************************************
27 * Welcome to the Koha Installation Guide *
28 *******************************************
30 This installer will guide you through the process of installing Koha.
31 It is not a completely automated installation, but a guide for further
32 information please read the documentation or visit the Koha website at
35 To successfully use Koha you need some additional software:
37 * A webserver (It was built to work with Apache, but there is no reason
38 it should not work with any other webserver).
40 * Mysql (You could intead use postgres, or another sql based database)
44 Are you ready to go through the installation process now? (Y/[N]):
50 if ($answer eq "Y" || $answer eq "y") {
51 print "Beginning setup... \n";
54 When you are ready to complete the installation just run this installer again.
63 # Test for Perl - Do we need to explicity check versions?
65 print "\nChecking that perl and the required modules are installed ...\n";
66 unless (eval "require 5.004") {
67 die "Sorry, you need at least Perl 5.004\n";
71 # Test for Perl Dependancies
74 unless (eval require DBI) { push @missing,"DBI" };
75 unless (eval require Date::Manip) { push @missing,"Date::Manip" };
76 unless (eval require DBD::mysql) { push @missing,"DBD::mysql" };
77 unless (eval require Set::Scalar) { push @missing,"Set::Scalar" };
80 # Print out a list of any missing modules
84 print "You are missing some Perl modules which are required by Koha.\n";
85 print "Once these modules have been installed, rerun this installery.\n";
86 print "They can be installed by running (as root) the following:\n";
87 foreach my $module (@missing) {
88 print " perl -MCPAN -e 'install \"$module\"'\n";
91 print "Perl and required modules appear to be installed, continuing...\n";
101 Koha uses a small configuration file that is usually placed in your
102 /etc/ files directory (note: if you wish to place the koha.conf in
103 another location you will need to manually edit additional files).
105 We will help you to now create your koha.conf file, once this file
106 has been created, please copy it to your destination folder
107 (note: this may need to be done by your systems administrator).
119 Please provide the name of the mysql database that you wish to use
120 for koha. This is normally "Koha".
123 #Get the database name
125 print "Enter database name:";
126 chomp($dbname = <STDIN>);
133 Please provide the hostname for mysql. Unless the database is located
134 on another machine this is likely to be "localhost".
137 #Get the hostname for the database
139 print "Enter hostname:";
140 chomp($hostname = <STDIN>);
147 Please provide the name of the mysql user, who will have full administrative
148 rights to the $dbname database, when authenicating from $hostname.
149 It is recommended that you do not use your "root" user.
152 #Set the username for the database
154 print "Enter username:";
155 chomp($user = <STDIN>);
162 Please provide a password for the mysql user $user.
165 #Set the password for the database user
167 print "Enter password:";
168 chomp($pass = <STDIN>);
174 Please provide the full path to your Koha Intranet/Librarians installation.
175 Usually /usr/local/www/koha/htdocs
178 #Get the password for the database user
180 print "Enter installation path:";
181 chomp($inc_path = <STDIN>);
185 #Create the configuration file
186 open(SITES,">koha.conf") or die "Couldn't create file.
187 Must have write capability.\n";
193 includes=$inc_path/includes
198 print "Successfully created the Koha configuration file.\n";
203 #SETUP Virtual Host Directives
212 You need to setup your Apache configuration file for the
215 Please enter the servername for the OPAC interface.
216 Usually opac.your.domain
219 print "Enter servername address:";
220 chomp($opac_svr_name = <STDIN>);
225 Please enter the e-mail address for your webserver admin.
226 Usually webmaster\@your.domain
229 print "Enter e-mail address:";
230 chomp($opac_svr_admin = <STDIN>);
235 Please enter the full path to your OPAC\'s document root.
236 usually something like \"/usr/local/www/opac/htdocs\".
239 print "Enter Document Roots Path:";
240 chomp($opac_docu_root = <STDIN>);
245 # Update Apache Conf File.
247 open(SITES,">>koha-apache.conf") or die "Couldn't write to file.
248 Must have write capability.\n";
251 <VirtualHost $opac_svr_name>
252 ServerAdmin $opac_svr_admin
253 DocumentRoot $opac_docu_root
254 ServerName $opac_svr_name
255 ErrorLog logs/opac-error_log
256 TransferLog logs/opac-access_log common
267 my $intranet_svr_admin;
268 my $intranet_svr_name;
271 You need to setup your Apache configuration file for the
272 Intranet/librarian virtual host.
274 Please enter the servername for your Intranet/Librarian interface.
275 Usually koha.your.domain
278 print "Enter servername address:";
279 chomp($intranet_svr_name = <STDIN>);
284 Please enter the e-mail address for your webserver admin.
285 Usually webmaster\@your.domain
288 print "Enter e-mail address:";
289 chomp($intranet_svr_admin = <STDIN>);
295 # Update Apache Conf File.
297 open(SITES,">>koha-apache.conf") or die "Couldn't write to file.
298 Must have write capability.\n";
301 <VirtualHost $intranet_svr_name>
302 ServerAdmin $intranet_svr_admin
303 DocumentRoot $inc_path
304 ServerName $intranet_svr_name
305 ErrorLog logs/opac-error_log
306 TransferLog logs/opac-access_log common
314 print "Successfully created the Apache Virtual Host Configuration file.\n";
318 *******************************************
319 * Koha Installation Guide - Continued *
320 *******************************************
322 In order to finish the installation of Koha, there is still a couple
323 of steps that you will need to complete.
326 1. Create a new mysql database called for example Koha
327 From command line: mysqladmin -uroot -ppassword create Koha
329 2. Set up a koha user and password in mysql
330 Log in to mysql: mysql -uroot -ppassword
332 To create a user called "koha" who has full administrative
333 rights to the "Koha" database when authenticating from
334 "localhost", enter the following on mysql command line:
336 grant all privileges on Koha.* to koha\@localhost identified by 'kohapassword'\;
338 Press ENTER, and if you see no errors then enter \q to quit mysql.
341 3. Use the mysql script to create the tables
342 mysql -uusername -ppassword Koha < koha.mysql
344 4. Update your database tables
345 perl updatedatabase -I /pathtoC4
347 5. Update your database to use MARC
348 perl marc/fill_usmarc.pl -I /pathtoC4 to put MARC21 - english datas in parameter table
349 perl marc/updatedb2marc.pl -I /pathtoC4 to update biblios from old-DB to MARC-DB (!!! it may be long : 30 biblios/second)
352 1. Copy Koha.conf to /etc/
353 If you wish to locate the file in another location please read
354 the INSTALL and Hints files.
361 print "\nCongratulations ... your Koha installation is complete!\n";
362 print "\nYou will need to restart your webserver before using Koha!\n";