]> git.evergreen-ils.org Git - working/Evergreen.git/blob - docs/installation/server_installation.txt
"Queue Compression" -- let one do the work for all identical, concurrent searches
[working/Evergreen.git] / docs / installation / server_installation.txt
1 Installing the Evergreen server
2 ===============================
3 :toc:
4 :numbered:
5
6 Preamble: referenced user accounts
7 ----------------------------------
8
9 In subsequent sections, we will refer to a number of different accounts, as
10 follows:
11
12   * Linux user accounts:
13     ** The *user* Linux account is the account that you use to log onto the
14        Linux system as a regular user.
15     ** The *root* Linux account is an account that has system administrator
16        privileges. On Debian and Fedora you can switch to this account from
17        your *user* account by issuing the `su -` command and entering the
18        password for the *root* account when prompted. On Ubuntu you can switch
19        to this account from your *user* account using the `sudo su -` command
20        and entering the password for your *user* account when prompted.
21     ** The *opensrf* Linux account is an account that you create when installing
22        OpenSRF. You can switch to this account from the *root* account by
23        issuing the `su - opensrf` command.
24     ** The *postgres* Linux account is created automatically when you install
25        the PostgreSQL database server. You can switch to this account from the
26        *root* account by issuing the `su - postgres` command.
27   * PostgreSQL user accounts:
28     ** The *evergreen* PostgreSQL account is a superuser account that you will
29        create to connect to the PostgreSQL database server.
30   * Evergreen administrator account:
31     ** The *egadmin* Evergreen account is an administrator account for
32        Evergreen that you will use to test connectivity and configure your
33        Evergreen instance.
34
35 Preamble: developer instructions
36 --------------------------------
37
38 [NOTE]
39 Skip this section if you are using an official release tarball downloaded
40 from http://evergreen-ils.org/downloads
41
42 Developers working directly with the source code from the Git repository,
43 rather than an official release tarball, must install some extra packages
44 and perform one step before they can proceed with the `./configure` step.
45
46 As the *root* Linux account, install the following packages:
47
48   * autoconf
49   * automake
50   * libtool
51
52 As the *user* Linux account, issue the following command in the Evergreen
53 source directory to generate the configure script and Makefiles:
54
55 [source, bash]
56 ------------------------------------------------------------------------------
57 autoreconf -i
58 ------------------------------------------------------------------------------
59
60 After running `make install`, developers also need to install the Dojo Toolkit
61 set of JavaScript libraries. The appropriate version of Dojo is included
62 in Evergreen release tarballs. Developers should install the Dojo 1.3.3
63 version of Dojo by issuing the following commands as the *opensrf* Linux
64 account:
65
66 [source, bash]
67 ------------------------------------------------------------------------------
68 wget http://download.dojotoolkit.org/release-1.3.3/dojo-release-1.3.3.tar.gz
69 tar -C /openils/var/web/js -xzf dojo-release-1.3.3.tar.gz
70 cp -r /openils/var/web/js/dojo-release-1.3.3/* /openils/var/web/js/dojo/.
71 ------------------------------------------------------------------------------
72
73 Installing prerequisites
74 ------------------------
75
76 Evergreen has a number of prerequisite packages that must be installed
77 before you can successfully configure, compile, and install Evergreen.
78
79 1. Begin by installing the most recent version of OpenSRF (2.1 or later).
80    You can download OpenSRF releases from http://evergreen-ils.org/opensrf.php
81 2. On many distributions, it is necessary to install PostgreSQL 9 from external
82    repositories.
83 +
84   * On Debian Squeeze, open `/etc/apt/sources.list` in a text editor as the
85     *root* Linux account and add the following line:
86 +
87 [source, bash]
88 ------------------------------------------------------------------------------
89 deb http://backports.debian.org/debian-backports squeeze-backports main contrib
90 ------------------------------------------------------------------------------
91 +
92   * On Ubuntu Lucid, you can use a PPA (personal package archive), which are 
93     package sources hosted on Launchpad. The one most commonly used by Evergreen
94     Community members is maintained by Martin Pitt, who also maintains the
95     official PostgreSQL packages for Ubuntu. As the *root* Linux account, issue
96     the following commands to add the PPA source:
97 +
98 [source, bash]
99 ------------------------------------------------------------------------------
100 apt-get install python-software-properties
101 add-apt-repository ppa:pitti/postgresql
102 ------------------------------------------------------------------------------
103 +
104   * Ubuntu Precise comes with PostgreSQL 9, so no additional steps are required.
105 +
106   * Fedora comes with PostgreSQL 9, so no additional steps are required.
107 +
108 3. On Debian and Ubuntu, run `aptitude update` as the *root* Linux account to
109    retrieve the new packages from the backports repository.
110 4. Issue the following commands as the *root* Linux account to install
111    prerequisites using the `Makefile.install` prerequisite installer,
112    substituting `debian-squeeze`, `fedora`, `ubuntu-lucid`, or
113    `ubuntu-precise` for <osname> below:
114 +
115 [source, bash]
116 ------------------------------------------------------------------------------
117 make -f Open-ILS/src/extras/Makefile.install <osname>
118 ------------------------------------------------------------------------------
119 +
120 5. Add the libdbi-libdbd libraries to the system dynamic library path by
121    issuing the following commands as the *root* Linux account:
122 +
123 [NOTE]
124 You should skip this step if installing on Ubuntu Precise. The ubuntu-precise
125 target uses libdbd-pgsql from packages.
126 +
127 .Debian / Ubuntu Lucid
128 [source, bash]
129 ------------------------------------------------------------------------------
130 echo "/usr/local/lib/dbd" > /etc/ld.so.conf.d/eg.conf
131 ldconfig
132 ------------------------------------------------------------------------------
133 +
134 .Fedora
135 [source, bash]
136 ------------------------------------------------------------------------------
137 echo "/usr/lib64/dbd" > /etc/ld.so.conf.d/eg.conf
138 ldconfig
139 ------------------------------------------------------------------------------
140
141 Configuration and compilation instructions
142 ------------------------------------------
143
144 For the time being, we are still installing everything in the `/openils/`
145 directory. From the Evergreen source directory, issue the following commands as
146 the *user* Linux account to configure and build Evergreen:
147
148 [source, bash]
149 ------------------------------------------------------------------------------
150 ./configure --prefix=/openils --sysconfdir=/openils/conf
151 make
152 ------------------------------------------------------------------------------
153
154 Installation instructions
155 -------------------------
156
157 1. Once you have configured and compiled Evergreen, issue the following
158    command as the *root* Linux account to install Evergreen, build the server
159    portion of the staff client, and copy example configuration files to
160    `/openils/conf`.
161    Change the value of the `STAFF_CLIENT_STAMP_ID` variable to match the version
162    of the staff client that you will use to connect to the Evergreen server.
163 +
164 [source, bash]
165 ------------------------------------------------------------------------------
166 make STAFF_CLIENT_STAMP_ID=rel_name install
167 ------------------------------------------------------------------------------
168 +
169 2. The server portion of the staff client expects `http://hostname/xul/server`
170    to resolve. Issue the following commands as the *root* Linux account to
171    create a symbolic link pointing to the `server` subdirectory of the server
172    portion of the staff client that we just built using the staff client ID
173    'rel_name':
174 +
175 [source, bash]
176 ------------------------------------------------------------------------------
177 cd /openils/var/web/xul
178 ln -sf rel_name/server server
179 ------------------------------------------------------------------------------
180
181 Change ownership of the Evergreen files
182 ---------------------------------------
183
184 All files in the `/openils/` directory and subdirectories must be owned by the
185 `opensrf` user. Issue the following command as the *root* Linux account to
186 change the ownership on the files:
187
188 [source, bash]
189 ------------------------------------------------------------------------------
190 chown -R opensrf:opensrf /openils
191 ------------------------------------------------------------------------------
192
193 Configure the Apache Web server
194 -------------------------------
195
196 1. Use the example configuration files in `Open-ILS/examples/apache/` (for
197 Apache versions below 2.4) or `Open-ILS/examples/apache_24/` (for Apache
198 versions 2.4 or greater) to configure your Web server for the Evergreen
199 catalog, staff client, Web services, and administration interfaces. Issue the
200 following commands as the *root* Linux account:
201 +
202 .Debian and Ubuntu
203 [source,bash]
204 ------------------------------------------------------------------------------
205 cp Open-ILS/examples/apache/eg.conf       /etc/apache2/sites-available/
206 cp Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/
207 cp Open-ILS/examples/apache/eg_startup    /etc/apache2/
208 # Now set up SSL
209 mkdir /etc/apache2/ssl
210 cd /etc/apache2/ssl
211 ------------------------------------------------------------------------------
212 +
213 .Fedora 17
214 [source,bash]
215 ------------------------------------------------------------------------------
216 cp Open-ILS/examples/apache/eg.conf       /etc/httpd/conf.d/
217 cp Open-ILS/examples/apache/eg_vhost.conf /etc/httpd/
218 cp Open-ILS/examples/apache/eg_startup    /etc/httpd/
219 # Now set up SSL
220 mkdir /etc/httpd/ssl
221 cd /etc/httpd/ssl
222 ------------------------------------------------------------------------------
223 +
224 .Fedora 18
225 [source,bash]
226 ------------------------------------------------------------------------------
227 cp Open-ILS/examples/apache_24/eg.conf       /etc/httpd/conf.d/
228 cp Open-ILS/examples/apache_24/eg_vhost.conf /etc/httpd/
229 cp Open-ILS/examples/apache/startup.pl       /etc/httpd/
230 # Now set up SSL
231 mkdir /etc/httpd/ssl
232 cd /etc/httpd/ssl
233 ------------------------------------------------------------------------------
234 +
235 2. The `openssl` command cuts a new SSL key for your Apache server. For a
236 production server, you should purchase a signed SSL certificate, but you can
237 just use a self-signed certificate and accept the warnings in the staff client
238 and browser during testing and development. Create an SSL key for the Apache
239 server by issuing the following command as the *root* Linux account:
240 +
241 [source,bash]
242 ------------------------------------------------------------------------------
243 openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key
244 ------------------------------------------------------------------------------
245 +
246 3. As the *root* Linux account, edit the `eg.conf` file that you copied into
247 place.
248   a. To enable access to the offline upload / execute interface from any
249      workstation on any network, make the following change (and note that
250      you *must* secure this for a production instance):
251      * (Apache 2.2): Replace `Allow from 10.0.0.0/8` with `Allow from all`
252      * (Apache 2.4): Replace `Require host 10.0.0.0/8` with `Require all granted`
253   b. (Fedora): Change references from the non-existent `/etc/apache2/` directory
254      to `/etc/httpd/`.
255 4. Change the user for the Apache server.
256   * (Debian and Ubuntu): As the *root* Linux account, edit
257     `/etc/apache2/envvars`.  Change `export APACHE_RUN_USER=www-data` to 
258     `export APACHE_RUN_USER=opensrf`.
259   * (Fedora): As the *root* Linux account , edit `/etc/httpd/conf/httpd.conf`.
260     Change `User apache` to `User opensrf`.
261 5. Configure Apache with performance settings appropriate for Evergreen:
262   * (Debian and Ubuntu): As the *root* Linux account, edit
263     `/etc/apache2/apache2.conf`:
264   * (Fedora): As the *root* Linux account, edit `/etc/httpd/conf/httpd.conf`:
265     a. Change `KeepAliveTimeout` to `1`. Higher values reduce the chance of
266        a request timing out unexpectedly, but increase the risk of using up
267        all available Apache child processes.
268     b. 'Optional': Change `MaxKeepAliveRequests` to `100`
269     c. Update the prefork configuration section to suit your environment. The
270        following settings apply to a busy system:
271 +
272 [source,bash]
273 ------------------------------------------------------------------------------
274 <IfModule mpm_prefork_module>
275    StartServers           20
276    MinSpareServers         5
277    MaxSpareServers        15
278    MaxClients            150
279    MaxRequestsPerChild 10000
280 </IfModule>
281 ------------------------------------------------------------------------------
282 +
283 6. (Fedora): As the *root* Linux account, edit the `/etc/httpd/eg_vhost.conf`
284    file to change references from the non-existent `/etc/apache2/` directory
285    to `/etc/httpd/`.
286 7. (Debian and Ubuntu): As the *root* Linux account, enable the Evergreen site:
287 +
288 [source,bash]
289 ------------------------------------------------------------------------------
290 a2dissite default  # OPTIONAL: disable the default site (the "It Works" page)
291 a2ensite eg.conf
292 ------------------------------------------------------------------------------
293
294 Configure OpenSRF for the Evergreen application
295 -----------------------------------------------
296 There are a number of example OpenSRF configuration files in `/openils/conf/`
297 that you can use as a template for your Evergreen installation. Issue the
298 following commands as the *opensrf* Linux account:
299
300 [source, bash]
301 ------------------------------------------------------------------------------
302 cp -b /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml
303 cp -b /openils/conf/opensrf.xml.example /openils/conf/opensrf.xml
304 ------------------------------------------------------------------------------
305
306 When you installed OpenSRF, you created four Jabber users on two
307 separate domains and edited the `opensrf_core.xml` file accordingly. Please
308 refer back to the OpenSRF README and, as the *opensrf* Linux account, edit the
309 Evergreen version of the `opensrf_core.xml` file using the same Jabber users
310 and domains as you used while installing and testing OpenSRF.
311
312 [NOTE]
313 The `-b` flag tells the `cp` command to create a backup version of the
314 destination file. The backup version of the destination file has a tilde (`~`)
315 appended to the file name, so if you have forgotten the Jabber users and
316 domains, you can retrieve the settings from the backup version of the files.
317
318 `eg_db_config`, described in the following section, sets the database
319 connection information in `opensrf.xml` for you.
320
321 Creating the Evergreen database
322 -------------------------------
323
324 By default, the `Makefile.install` prerequisite installer does not install
325 the PostgreSQL 9 database server required by every Evergreen system;
326 for production use, most libraries install the PostgreSQL database server on a
327 dedicated machine. You can install the packages required by Debian or Ubuntu Lucid
328 on the machine of your choice using the following commands as the *root*
329 Linux account:
330
331 .(Debian and Ubuntu Lucid) Installing PostgreSQL 9.1 server packages
332 [source, bash]
333 ------------------------------------------------------------------------------
334 make -f Open-ILS/src/extras/Makefile.install install_pgsql_server_backport_debs_91
335 ------------------------------------------------------------------------------
336
337 .(Ubuntu Precise) Installing PostgreSQL 9.1 server packages
338 [source, bash]
339 ------------------------------------------------------------------------------
340 make -f Open-ILS/src/extras/Makefile.install install_pgsql_server_debs_91
341 ------------------------------------------------------------------------------
342
343 You can install the packages required by Fedora on the machine of your choice
344 using the following commands as the *root* Linux account:
345
346 .(Fedora) Installing PostgreSQL server packages
347 [source, bash]
348 ------------------------------------------------------------------------------
349 make -f Open-ILS/src/extras/Makefile.install install_fedora_pgsql_server
350 postgresql-setup initdb
351 ------------------------------------------------------------------------------
352
353 For a standalone PostgreSQL server, install the following Perl modules as the
354 *root* Linux account:
355
356 .(Debian / Ubuntu) Installing additional Perl modules on a standalone PostgreSQL 9 server
357 [source, bash]
358 ------------------------------------------------------------------------------
359 aptitude install gcc libxml-libxml-perl libxml-libxslt-perl
360 cpan Business::ISBN
361 cpan JSON::XS
362 cpan Library::CallNumber::LC
363 cpan MARC::Record
364 cpan MARC::File::XML
365 cpan UUID::Tiny
366 cpan Rose::URI
367 ------------------------------------------------------------------------------
368
369 .(Fedora) Installing additional Perl modules on a standalone PostgreSQL 9 server
370 [source, bash]
371 ------------------------------------------------------------------------------
372 yum install gcc perl-XML-LibXML perl-XML-LibXSLT perl-Business-ISBN
373 cpan Library::CallNumber::LC
374 cpan MARC::Record
375 cpan MARC::File::XML
376 cpan UUID::Tiny
377 ------------------------------------------------------------------------------
378
379 You need to create a PostgreSQL superuser to create and access the database.
380 Issue the following command as the *postgres* Linux account to create a new
381 PostgreSQL superuser named `evergreen`. When prompted, enter the new user's
382 password:
383
384 [source, bash]
385 ------------------------------------------------------------------------------
386 createuser -s -P evergreen
387 ------------------------------------------------------------------------------
388
389 Once you have created the *evergreen* PostgreSQL account, you also need to
390 create the database and schema, and configure your configuration files to point
391 at the database server. Issue the following command as the *root* Linux account
392 from inside the Evergreen source directory, replacing <user>, <password>,
393 <hostname>, <port>, and <dbname> with the appropriate values for your
394 PostgreSQL database (where <user> and <password> are for the *evergreen*
395 PostgreSQL account you just created), and replace <admin-user> and <admin-pass>
396 with the values you want for the *egadmin* Evergreen administrator account:
397
398 [source, bash]
399 ------------------------------------------------------------------------------
400 perl Open-ILS/src/support-scripts/eg_db_config --update-config \
401        --service all --create-database --create-schema --create-offline \
402        --user <user> --password <password> --hostname <hostname> --port <port> \
403        --database <dbname> --admin-user <admin-user> --admin-pass <admin-pass>
404 ------------------------------------------------------------------------------
405
406 This creates the database and schema and configures all of the services in
407 your `/openils/conf/opensrf.xml` configuration file to point to that database.
408 It also creates the configuration files required by the Evergreen `cgi-bin`
409 administration scripts, and sets the user name and password for the *egadmin*
410 Evergreen administrator account to your requested values.
411
412 Creating the database on a remote server
413 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
414 In a production instance of Evergreen, your PostgreSQL server should be
415 installed on a dedicated server.
416
417 PostgreSQL 9.1 and later
418 ^^^^^^^^^^^^^^^^^^^^^^^^
419 To create the database instance on a remote database server running PostgreSQL
420 9.1 or later, simply use the `--create-database` flag on `eg_db_config`.
421
422 For PostgreSQL 9.0
423 ^^^^^^^^^^^^^^^^^^
424 To create the database instance on a remote database server running PostgreSQL
425 9.0, you can either:
426
427   *  Install the PostgreSQL contrib modules on the machine on which you
428      are installing the Evergreen code, and use the `--create-database`
429      option from that machine, or
430   *  Copy the `Open-ILS/src/sql/Pg/create_database.sql` script to your
431      PostgreSQL server and invoke it as the *postgres* Linux account:
432 +
433 [source, bash]
434 ------------------------------------------------------------------------------
435 psql -vdb_name=<dbname> -vcontrib_dir=`pg_config --sharedir`/contrib -f create_database.sql
436 ------------------------------------------------------------------------------
437
438 Then you can issue the `eg_db_config` command as above _without_ the
439 `--create-database` argument to create your schema and configure your
440 configuration files.
441
442 Starting Evergreen
443 ------------------
444 1. As the *root* Linux account, start the `memcached` and `ejabberd` services
445 (if they aren't already running):
446 +
447 [source, bash]
448 ------------------------------------------------------------------------------
449 /etc/init.d/ejabberd start
450 /etc/init.d/memcached start
451 ------------------------------------------------------------------------------
452 +
453 2. As the *opensrf* Linux account, start Evergreen. The `-l` flag in the
454 following command is only necessary if you want to force Evergreen to treat the
455 hostname as `localhost`; if you configured `opensrf.xml` using the real
456 hostname of your machine as returned by `perl -ENet::Domain 'print
457 Net::Domain::hostfqdn() . "\n";'`, you should not use the `-l` flag.
458 +
459 [source, bash]
460 ------------------------------------------------------------------------------
461 osrf_ctl.sh -l -a start_all
462 ------------------------------------------------------------------------------
463 +
464   ** If you receive the error message `bash: osrf_ctl.sh: command not found`,
465      then your environment variable `PATH` does not include the `/openils/bin`
466      directory; this should have been set in the *opensrf* Linux account's
467      `.bashrc` configuration file. To manually set the `PATH` variable, edit the
468      configuration file `~/.bashrc` as the *opensrf* Linux account and add the
469      following line:
470 +
471 [source, bash]
472 ------------------------------------------------------------------------------
473 export PATH=$PATH:/openils/bin
474 ------------------------------------------------------------------------------
475 +
476 3. As the *opensrf* Linux account, generate the Web files needed by the staff
477    client and catalogue and update the organization unit proximity (you need to do
478    this the first time you start Evergreen, and after that each time you change
479    the library hierarchy in `config.cgi`):
480 +
481 [source, bash]
482 ------------------------------------------------------------------------------
483 autogen.sh -u
484 ------------------------------------------------------------------------------
485 +
486 4. As the *root* Linux account, restart the Apache Web server:
487 +
488 [source, bash]
489 ------------------------------------------------------------------------------
490 /etc/init.d/apache2 restart
491 ------------------------------------------------------------------------------
492 +
493 If the Apache Web server was running when you started the OpenSRF services, you
494 might not be able to successfully log in to the OPAC or staff client until the
495 Apache Web server is restarted.
496
497 Testing connections to Evergreen
498 --------------------------------
499
500 Once you have installed and started Evergreen, test your connection to
501 Evergreen via `srfsh`. As the *opensrf* Linux account, issue the following
502 commands to start `srfsh` and try to log onto the Evergreen server using the
503 *egadmin* Evergreen administrator user name and password that you set using the
504 `eg_db_config` command:
505
506 [source, bash]
507 ------------------------------------------------------------------------------
508 /openils/bin/srfsh
509 srfsh% login <admin-user> <admin-pass>
510 ------------------------------------------------------------------------------
511
512 You should see a result like:
513
514     Received Data: "250bf1518c7527a03249858687714376"
515     ------------------------------------
516     Request Completed Successfully
517     Request Time in seconds: 0.045286
518     ------------------------------------
519
520     Received Data: {
521        "ilsevent":0,
522        "textcode":"SUCCESS",
523        "desc":" ",
524        "pid":21616,
525        "stacktrace":"oils_auth.c:304",
526        "payload":{
527           "authtoken":"e5f9827cc0f93b503a1cc66bee6bdd1a",
528           "authtime":420
529        }
530
531     }
532
533     ------------------------------------
534     Request Completed Successfully
535     Request Time in seconds: 1.336568
536     ------------------------------------
537
538 If this does not work, it's time to do some troubleshooting.
539
540   * As the *opensrf* Linux acccount, run the `settings-tester.pl` script to see
541     if it finds any system configuration problems. The script is found at
542     `Open-ILS/src/support-scripts/settings-tester.pl` in the Evergreen source
543     tree.
544   * Follow the steps in the http://evergreen-ils.org/dokuwiki/doku.php?id=troubleshooting:checking_for_errors[troubleshooting guide].
545   * If you have faithfully followed the entire set of installation steps
546     listed here, you are probably extremely close to a working system.
547     Gather your configuration files and log files and contact the
548     http://open-ils.org/listserv.php[Evergreen development mailing list]
549     for assistance before making any drastic changes to your system
550     configuration.
551
552 Getting help
553 ------------
554
555 Need help installing or using Evergreen? Join the mailing lists at
556 http://evergreen-ils.org/listserv.php or contact us on the Freenode
557 IRC network on the #evergreen channel.
558
559 License
560 -------
561 This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
562 Unported License. To view a copy of this license, visit
563 http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
564 Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.