Skip to content
Newer
Older
100644 363 lines (285 sloc) 8.45 KB
5184a74 moving non koha-running files to misc dir
tipaul authored
1 #!/usr/bin/perl -w # please develop with -w
2
3 # $Id$
4
5 # Copyright 2000-2002 Katipo Communications
6 #
7 # This file is part of Koha.
8 #
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
12 # version.
13 #
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License along with
19 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA 02111-1307 USA
21
22 use diagnostics;
23 use strict; # please develop with the strict pragma
24
25 system('clear');
26 print qq|
27 *******************************************
28 * Welcome to the Koha Installation Guide *
29 *******************************************
30
31 This installer will guide you through the process of installing Koha.
32 It is not a completely automated installation, but a guide for further
33 information please read the documentation or visit the Koha website at
34 http://www.koha.org
35
36 To successfully use Koha you need some additional software:
37
38 * A webserver (It was built to work with Apache, but there is no reason
39 it should not work with any other webserver).
40
41 * Mysql (You could intead use postgres, or another sql based database)
42
43 * Perl
44
45 Are you ready to go through the installation process now? (Y/[N]):
46 |;
47
48 my $answer = <STDIN>;
49 chomp $answer;
50
51 if ($answer eq "Y" || $answer eq "y") {
52 print "Beginning setup... \n";
53 } else {
54 print qq|
55 When you are ready to complete the installation just run this installer again.
56 |;
57 exit;
58 };
59
60 print "\n";
61
62
63 #
64 # Test for Perl - Do we need to explicity check versions?
65 #
66 print "\nChecking that perl and the required modules are installed ...\n";
67 unless (eval "require 5.004") {
68 die "Sorry, you need at least Perl 5.004\n";
69 }
70
71 #
72 # Test for Perl Dependancies
73 #
74 my @missing = ();
75 unless (eval require DBI) { push @missing,"DBI" };
76 unless (eval require Date::Manip) { push @missing,"Date::Manip" };
77 unless (eval require DBD::mysql) { push @missing,"DBD::mysql" };
78
79 #
80 # Print out a list of any missing modules
81 #
82 if (@missing > 0) {
83 print "\n\n";
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";
89 exit(1);
90 }} else{
91 print "Perl and required modules appear to be installed, continuing...\n";
92 };
93
94
95 print "\n";
96
97 #
98 #KOHA conf
99 #
100 print qq|
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).
104
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).
108 |;
109
110 my $dbname;
111 my $hostname;
112 my $user;
113 my $pass;
114 my $inc_path;
115
116 print "\n";
117 print "\n";
118 print qq|
119 Please provide the name of the mysql database that you wish to use
120 for koha. This is normally "Koha".
121 |;
122
123 #Get the database name
124 do {
125 print "Enter database name:";
126 chomp($dbname = <STDIN>);
127 };
128
129
130 print "\n";
131 print "\n";
132 print qq|
133 Please provide the hostname for mysql. Unless the database is located
134 on another machine this is likely to be "localhost".
135 |;
136
137 #Get the hostname for the database
138 do {
139 print "Enter hostname:";
140 chomp($hostname = <STDIN>);
141 };
142
143
144 print "\n";
145 print "\n";
146 print qq|
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.
150 |;
151
152 #Set the username for the database
153 do {
154 print "Enter username:";
155 chomp($user = <STDIN>);
156 };
157
158
159 print "\n";
160 print "\n";
161 print qq|
162 Please provide a password for the mysql user $user.
163 |;
164
165 #Set the password for the database user
166 do {
167 print "Enter password:";
168 chomp($pass = <STDIN>);
169 };
170
171 print "\n";
172 print "\n";
173 print qq|
174 Please provide the full path to your Koha Intranet/Librarians installation.
175 Usually /usr/local/www/koha/htdocs
176 |;
177
178 #Get the password for the database user
179 do {
180 print "Enter installation path:";
181 chomp($inc_path = <STDIN>);
182 };
183
184
185 #Create the configuration file
186 open(SITES,">koha.conf") or die "Couldn't create file.
187 Must have write capability.\n";
188 print SITES <<EOP
189 database=$dbname
190 hostname=$hostname
191 user=$user
192 password=$pass
193 includes=$inc_path/includes
194 EOP
195 ;
196 close(SITES);
197
198 print "Successfully created the Koha configuration file.\n";
199
200 print "\n";
201
202 #
203 #SETUP Virtual Host Directives
204 #
205 #OPAC Settings
206 #
207 my $opac_svr_admin;
208 my $opac_docu_root;
209 my $opac_svr_name;
210
211 print qq|
212 You need to setup your Apache configuration file for the
213 OPAC virtual host.
214
215 Please enter the servername for the OPAC interface.
216 Usually opac.your.domain
217 |;
218 do {
219 print "Enter servername address:";
220 chomp($opac_svr_name = <STDIN>);
221 };
222
223
224 print qq|
225 Please enter the e-mail address for your webserver admin.
226 Usually webmaster\@your.domain
227 |;
228 do {
229 print "Enter e-mail address:";
230 chomp($opac_svr_admin = <STDIN>);
231 };
232
233
234 print qq|
235 Please enter the full path to your OPAC\'s document root.
236 usually something like \"/usr/local/www/opac/htdocs\".
237 |;
238 do {
239 print "Enter Document Roots Path:";
240 chomp($opac_docu_root = <STDIN>);
241 };
242
243
244 #
245 # Update Apache Conf File.
246 #
247 open(SITES,">>koha-apache.conf") or die "Couldn't write to file.
248 Must have write capability.\n";
249 print SITES <<EOP
250
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
257 </VirtualHost>
258
259 EOP
260 ;
261 close(SITES);
262
263
264 #
265 #Intranet Settings
266 #
267 my $intranet_svr_admin;
268 my $intranet_svr_name;
269
270 print qq|
271 You need to setup your Apache configuration file for the
272 Intranet/librarian virtual host.
273
274 Please enter the servername for your Intranet/Librarian interface.
275 Usually koha.your.domain
276 |;
277 do {
278 print "Enter servername address:";
279 chomp($intranet_svr_name = <STDIN>);
280 };
281
282
283 print qq|
284 Please enter the e-mail address for your webserver admin.
285 Usually webmaster\@your.domain
286 |;
287 do {
288 print "Enter e-mail address:";
289 chomp($intranet_svr_admin = <STDIN>);
290 };
291
292
293
294 #
295 # Update Apache Conf File.
296 #
297 open(SITES,">>koha-apache.conf") or die "Couldn't write to file.
298 Must have write capability.\n";
299 print SITES <<EOP
300
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
307 </VirtualHost>
308
309 EOP
310 ;
311 close(SITES);
312
313
314 print "Successfully created the Apache Virtual Host Configuration file.\n";
315
316 system('clear');
317 print qq|
318 *******************************************
319 * Koha Installation Guide - Continued *
320 *******************************************
321
322 In order to finish the installation of Koha, there is still a couple
323 of steps that you will need to complete.
324
325 * Setup mysql
326 1. Create a new mysql database called for example Koha
327 From command line: mysqladmin -uroot -ppassword create Koha
328
329 2. Set up a koha user and password in mysql
330 Log in to mysql: mysql -uroot -ppassword
331
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:
335
336 grant all privileges on Koha.* to koha\@localhost identified by 'kohapassword'\;
337
338 Press ENTER, and if you see no errors then enter \q to quit mysql.
339
340
341 3. Use the mysql script to create the tables
342 mysql -uusername -ppassword Koha < koha.mysql
343
344 4. Update your database tables
345 perl updatedatabase -I /pathtoC4
346
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)
350
351 * Koha.conf
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.
355
356
357 |;
358 #
359 # It is completed
360 #
361 print "\nCongratulations ... your Koha installation is complete!\n";
362 print "\nYou will need to restart your webserver before using Koha!\n";
Something went wrong with that request. Please try again.