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" };
79 # Print out a list of any missing modules
83 print "You are missing some Perl modules which are required by Koha.\n";
84 print "Once these modules have been installed, rerun this installery.\n";
85 print "They can be installed by running (as root) the following:\n";
86 foreach my $module (@missing) {
87 print " perl -MCPAN -e 'install \"$module\"'\n";
90 print "Perl and required modules appear to be installed, continuing...\n";
100 Koha uses a small configuration file that is usually placed in your
101 /etc/ files directory (note: if you wish to place the koha.conf in
102 another location you will need to manually edit additional files).
104 We will help you to now create your koha.conf file, once this file
105 has been created, please copy it to your destination folder
106 (note: this may need to be done by your systems administrator).
118 Please provide the name of the mysql database that you wish to use
119 for koha. This is normally "Koha".
122 #Get the database name
124 print "Enter database name:";
125 chomp($dbname = <STDIN>);
132 Please provide the hostname for mysql. Unless the database is located
133 on another machine this is likely to be "localhost".
136 #Get the hostname for the database
138 print "Enter hostname:";
139 chomp($hostname = <STDIN>);
146 Please provide the name of the mysql user, who will have full administrative
147 rights to the $dbname database, when authenicating from $hostname.
148 It is recommended that you do not use your "root" user.
151 #Set the username for the database
153 print "Enter username:";
154 chomp($user = <STDIN>);
161 Please provide a password for the mysql user $user.
164 #Set the password for the database user
166 print "Enter password:";
167 chomp($pass = <STDIN>);
173 Please provide the full path to your Koha Intranet/Librarians installation.
174 Usually /usr/local/www/koha/htdocs
177 #Get the password for the database user
179 print "Enter installation path:";
180 chomp($inc_path = <STDIN>);
184 #Create the configuration file
185 open(SITES,">koha.conf") or die "Couldn't create file.
186 Must have write capability.\n";
192 includes=$inc_path/includes
197 print "Successfully created the Koha configuration file.\n";
202 #SETUP Virtual Host Directives
211 You need to setup your Apache configuration file for the
214 Please enter the servername for the OPAC interface.
215 Usually opac.your.domain
218 print "Enter servername address:";
219 chomp($opac_svr_name = <STDIN>);
224 Please enter the e-mail address for your webserver admin.
225 Usually webmaster\@your.domain
228 print "Enter e-mail address:";
229 chomp($opac_svr_admin = <STDIN>);
234 Please enter the full path to your OPAC\'s document root.
235 usually something like \"/usr/local/www/opac/htdocs\".
238 print "Enter Document Roots Path:";
239 chomp($opac_docu_root = <STDIN>);
244 # Update Apache Conf File.
246 open(SITES,">>koha-apache.conf") or die "Couldn't write to file.
247 Must have write capability.\n";
250 <VirtualHost $opac_svr_name>
251 ServerAdmin $opac_svr_admin
252 DocumentRoot $opac_docu_root
253 ServerName $opac_svr_name
254 ErrorLog logs/opac-error_log
255 TransferLog logs/opac-access_log common
266 my $intranet_svr_admin;
267 my $intranet_svr_name;
270 You need to setup your Apache configuration file for the
271 Intranet/librarian virtual host.
273 Please enter the servername for your Intranet/Librarian interface.
274 Usually koha.your.domain
277 print "Enter servername address:";
278 chomp($intranet_svr_name = <STDIN>);
283 Please enter the e-mail address for your webserver admin.
284 Usually webmaster\@your.domain
287 print "Enter e-mail address:";
288 chomp($intranet_svr_admin = <STDIN>);
294 # Update Apache Conf File.
296 open(SITES,">>koha-apache.conf") or die "Couldn't write to file.
297 Must have write capability.\n";
300 <VirtualHost $intranet_svr_name>
301 ServerAdmin $intranet_svr_admin
302 DocumentRoot $inc_path
303 ServerName $intranet_svr_name
304 ErrorLog logs/opac-error_log
305 TransferLog logs/opac-access_log common
313 print "Successfully created the Apache Virtual Host Configuration file.\n";
317 *******************************************
318 * Koha Installation Guide - Continued *
319 *******************************************
321 In order to finish the installation of Koha, there is still a couple
322 of steps that you will need to complete.
325 1. Create a new mysql database called for example Koha
326 From command line: mysqladmin -uroot -ppassword create Koha
328 2. Set up a koha user and password in mysql
329 Log in to mysql: mysql -uroot -ppassword
331 To create a user called "koha" who has full administrative
332 rights to the "Koha" database when authenticating from
333 "localhost", enter the following on mysql command line:
335 grant all privileges on Koha.* to koha\@localhost identified by 'kohapassword'\;
337 Press ENTER, and if you see no errors then enter \q to quit mysql.
340 3. Use the mysql script to create the tables
341 mysql -uusername -ppassword Koha < koha.mysql
343 4. Update your database tables
344 perl updatedatabase -I /pathtoC4
346 5. Update your database to use MARC
347 perl marc/fill_usmarc.pl -I /pathtoC4 to put MARC21 - english datas in parameter table
348 perl marc/updatedb2marc.pl -I /pathtoC4 to update biblios from old-DB to MARC-DB (!!! it may be long : 30 biblios/second)
351 1. Copy Koha.conf to /etc/
352 If you wish to locate the file in another location please read
353 the INSTALL and Hints files.
360 print "\nCongratulations ... your Koha installation is complete!\n";
361 print "\nYou will need to restart your webserver before using Koha!\n";