Installing the Evergreen server =============================== :toc: :numbered: Preamble: referenced user accounts ---------------------------------- In subsequent sections, we will refer to a number of different accounts, as follows: * Linux user accounts: ** The *user* Linux account is the account that you use to log onto the Linux system as a regular user. ** The *root* Linux account is an account that has system administrator privileges. On Debian you can switch to this account from your *user* account by issuing the `su -` command and entering the password for the *root* account when prompted. On Ubuntu you can switch to this account from your *user* account using the `sudo su -` command and entering the password for your *user* account when prompted. ** The *opensrf* Linux account is an account that you create when installing OpenSRF. You can switch to this account from the *root* account by issuing the `su - opensrf` command. ** The *postgres* Linux account is created automatically when you install the PostgreSQL database server. You can switch to this account from the *root* account by issuing the `su - postgres` command. * PostgreSQL user accounts: ** The *evergreen* PostgreSQL account is a superuser account that you will create to connect to the PostgreSQL database server. * Evergreen administrator account: ** The *egadmin* Evergreen account is an administrator account for Evergreen that you will use to test connectivity and configure your Evergreen instance. Preamble: developer instructions -------------------------------- [NOTE] Skip this section if you are using an official release tarball downloaded from http://evergreen-ils.org/egdownloads Developers working directly with the source code from the Git repository, rather than an official release tarball, must perform one step before they can proceed with the `./configure` step. As the *user* Linux account, issue the following command in the Evergreen source directory to generate the configure script and Makefiles: [source, bash] ------------------------------------------------------------------------------ autoreconf -i ------------------------------------------------------------------------------ Installing prerequisites ------------------------ * **PostgreSQL**: The minimum supported version is 9.6. * **Linux**: Evergreen has been tested on Debian Buster (10), Debian Stretch (9), Debian Jessie (8), Ubuntu Bionic Beaver (18.04), and Ubuntu Xenial Xerus (16.04). If you are running an older version of these distributions, you may want to upgrade before upgrading Evergreen. For instructions on upgrading these distributions, visit the Debian or Ubuntu websites. * **OpenSRF**: The minimum supported version of OpenSRF is 3.2.0. Evergreen has a number of prerequisite packages that must be installed before you can successfully configure, compile, and install Evergreen. 1. Begin by installing the most recent version of OpenSRF (3.2.0 or later). You can download OpenSRF releases from http://evergreen-ils.org/opensrf-downloads/ + 2. Issue the following commands as the *root* Linux account to install prerequisites using the `Makefile.install` prerequisite installer, substituting `debian-buster`,`debian-stretch`,`debian-jessie`,`ubuntu-bionic`, or `ubuntu-xenial` for <osname> below: + [source, bash] ------------------------------------------------------------------------------ make -f Open-ILS/src/extras/Makefile.install <osname> ------------------------------------------------------------------------------ + [[optional_developer_additions]] 3. OPTIONAL: Developer additions + To perform certain developer tasks from a Git source code checkout, including the testing of the Angular web client components, additional packages may be required. As the *root* Linux account: + * To install packages needed for retrieving and managing web dependencies, use the <osname>-developer Makefile.install target. Currently, this is only needed for building and installing the web staff client. + [source, bash] ------------------------------------------------------------------------------ make -f Open-ILS/src/extras/Makefile.install <osname>-developer ------------------------------------------------------------------------------ + * To install packages required for building Evergreen translations, use the <osname>-translator Makefile.install target. + [source, bash] ------------------------------------------------------------------------------ make -f Open-ILS/src/extras/Makefile.install <osname>-translator ------------------------------------------------------------------------------ + * To install packages required for building Evergreen release bundles, use the <osname>-packager Makefile.install target. + [source, bash] ------------------------------------------------------------------------------ make -f Open-ILS/src/extras/Makefile.install <osname>-packager ------------------------------------------------------------------------------ Extra steps for web staff client -------------------------------- [NOTE] Skip this entire section if you are using an official release tarball downloaded from http://evergreen-ils.org/downloads. Otherwise, ensure you have installed the <<optional_developer_additions,optional developer additions>> before proceeding. [[install_files_for_web_staff_client]] Install AngularJS files for web staff client ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. Building, Testing, Minification: The remaining steps all take place within the staff JS web root: + [source,sh] ------------------------------------------------------------------------------ cd $EVERGREEN_ROOT/Open-ILS/web/js/ui/default/staff/ ------------------------------------------------------------------------------ + 2. Install Project-local Dependencies. npm inspects the 'package.json' file for dependencies and fetches them from the Node package network. + [source,sh] ------------------------------------------------------------------------------ npm install # fetch JS dependencies ------------------------------------------------------------------------------ + 3. Run the build script. + [source,sh] ------------------------------------------------------------------------------ # build, concat+minify npm run build-prod ------------------------------------------------------------------------------ + 4. OPTIONAL: Test web client code if the <osname>-developer packages were installed. CHROME_BIN should be set to the path to chrome or chromimum, e.g., `/usr/bin/chromium`: + [source,sh] ------------------------------------------------------------------------------ CHROME_BIN=/path/to/chrome npm run test ------------------------------------------------------------------------------ [[install_files_for_angular_web_staff_client]] Install Angular files for web staff client ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. Building, Testing, Minification: The remaining steps all take place within the Angular staff root: + [source,sh] ------------------------------------------------------------------------------ cd $EVERGREEN_ROOT/Open-ILS/src/eg2/ ------------------------------------------------------------------------------ + 2. Install Project-local Dependencies. npm inspects the 'package.json' file for dependencies and fetches them from the Node package network. + [source,sh] ------------------------------------------------------------------------------ npm install # fetch JS dependencies ------------------------------------------------------------------------------ + 3. Run the build script. + [source,sh] ------------------------------------------------------------------------------ # build and run tests ng build --prod ------------------------------------------------------------------------------ + 4. OPTIONAL: Test eg2 web client code if the <osname>-developer packages were installed: CHROME_BIN should be set to the path to chrome or chromimum, e.g., `/usr/bin/chromium`: + [source,sh] ------------------------------------------------------------------------------ CHROME_BIN=/path/to/chrome npm run test ------------------------------------------------------------------------------ Configuration and compilation instructions ------------------------------------------ For the time being, we are still installing everything in the `/openils/` directory. From the Evergreen source directory, issue the following commands as the *user* Linux account to configure and build Evergreen: [source, bash] ------------------------------------------------------------------------------ PATH=/openils/bin:$PATH ./configure --prefix=/openils --sysconfdir=/openils/conf make ------------------------------------------------------------------------------ These instructions assume that you have also installed OpenSRF under `/openils/`. If not, please adjust PATH as needed so that the Evergreen `configure` script can find `osrf_config`. Installation instructions ------------------------- 1. Once you have configured and compiled Evergreen, issue the following command as the *root* Linux account to install Evergreen and copy example configuration files to `/openils/conf`. + [source, bash] ------------------------------------------------------------------------------ make install ------------------------------------------------------------------------------ Change ownership of the Evergreen files --------------------------------------- All files in the `/openils/` directory and subdirectories must be owned by the `opensrf` user. Issue the following command as the *root* Linux account to change the ownership on the files: [source, bash] ------------------------------------------------------------------------------ chown -R opensrf:opensrf /openils ------------------------------------------------------------------------------ Run ldconfig ------------ On Debian Stretch / Buster, run the following command as the root user: [source, bash] ------------------------------------------------------------------------------ ldconfig ------------------------------------------------------------------------------ Additional Instructions for Developers -------------------------------------- [NOTE] Skip this section if you are using an official release tarball downloaded from http://evergreen-ils.org/egdownloads Developers working directly with the source code from the Git repository, rather than an official release tarball, need to install the Dojo Toolkit set of JavaScript libraries. The appropriate version of Dojo is included in Evergreen release tarballs. Developers should install the Dojo 1.3.3 version of Dojo by issuing the following commands as the *opensrf* Linux account: [source, bash] ------------------------------------------------------------------------------ wget http://download.dojotoolkit.org/release-1.3.3/dojo-release-1.3.3.tar.gz tar -C /openils/var/web/js -xzf dojo-release-1.3.3.tar.gz cp -r /openils/var/web/js/dojo-release-1.3.3/* /openils/var/web/js/dojo/. ------------------------------------------------------------------------------ Configure the Apache Web server ------------------------------- . Use the example configuration files to configure your Web server for the Evergreen catalog, web staff client, Web services, and administration interfaces. Issue the following commands as the *root* Linux account: + [source,bash] ------------------------------------------------------------------------------------ cp Open-ILS/examples/apache_24/eg_24.conf /etc/apache2/sites-available/eg.conf cp Open-ILS/examples/apache_24/eg_vhost_24.conf /etc/apache2/eg_vhost.conf cp Open-ILS/examples/apache_24/eg_startup /etc/apache2/ # Now set up SSL mkdir /etc/apache2/ssl cd /etc/apache2/ssl ------------------------------------------------------------------------------------ + . The `openssl` command cuts a new SSL key for your Apache server. For a production server, you should purchase a signed SSL certificate, but you can just use a self-signed certificate and accept the warnings in the and browser during testing and development. Create an SSL key for the Apache server by issuing the following command as the *root* Linux account: + [source,bash] ------------------------------------------------------------------------------ openssl req -new -x509 -days 365 -nodes -out server.crt -keyout server.key ------------------------------------------------------------------------------ + . As the *root* Linux account, edit the `eg.conf` file that you copied into place. a. To enable access to the offline upload / execute interface from any workstation on any network, make the following change (and note that you *must* secure this for a production instance): * Replace `Require host 10.0.0.0/8` with `Require all granted` . Change the user for the Apache server. * As the *root* Linux account, edit `/etc/apache2/envvars`. Change `export APACHE_RUN_USER=www-data` to `export APACHE_RUN_USER=opensrf`. . As the *root* Linux account, configure Apache with KeepAlive settings appropriate for Evergreen. Higher values can improve the performance of a single client by allowing multiple requests to be sent over the same TCP connection, but increase the risk of using up all available Apache child processes and memory. * Edit `/etc/apache2/apache2.conf`. a. Change `KeepAliveTimeout` to `1`. b. Change `MaxKeepAliveRequests` to `100`. . As the *root* Linux account, configure the prefork module to start and keep enough Apache servers available to provide quick responses to clients without running out of memory. The following settings are a good starting point for a site that exposes the default Evergreen catalogue to the web: + .`/etc/apache2/mods-available/mpm_prefork.conf` [source,bash] ------------------------------------------------------------------------------ <IfModule mpm_prefork_module> StartServers 15 MinSpareServers 5 MaxSpareServers 15 MaxRequestWorkers 75 MaxConnectionsPerChild 500 </IfModule> ------------------------------------------------------------------------------ + . As the *root* user, enable the mpm_prefork module: + [source,bash] ------------------------------------------------------------------------------ a2dismod mpm_event a2enmod mpm_prefork ------------------------------------------------------------------------------ + . As the *root* Linux account, enable the Evergreen site: + [source,bash] ------------------------------------------------------------------------------ a2dissite 000-default # OPTIONAL: disable the default site (the "It Works" page) a2ensite eg.conf ------------------------------------------------------------------------------ + . As the *root* Linux account, enable Apache to write to the lock directory; this is currently necessary because Apache is running as the `opensrf` user: + [source,bash] ------------------------------------------------------------------------------ chown opensrf /var/lock/apache2 ------------------------------------------------------------------------------ Learn more about additional Apache options in the following sections: * <<_apache_rewrite_tricks,Apache Rewrite Tricks>> * <<_apache_access_handler_perl_module,Apache Access Handler Perl Module>> Configure OpenSRF for the Evergreen application ----------------------------------------------- There are a number of example OpenSRF configuration files in `/openils/conf/` that you can use as a template for your Evergreen installation. Issue the following commands as the *opensrf* Linux account: [source, bash] ------------------------------------------------------------------------------ cp -b /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml cp -b /openils/conf/opensrf.xml.example /openils/conf/opensrf.xml ------------------------------------------------------------------------------ When you installed OpenSRF, you created four Jabber users on two separate domains and edited the `opensrf_core.xml` file accordingly. Please refer back to the OpenSRF README and, as the *opensrf* Linux account, edit the Evergreen version of the `opensrf_core.xml` file using the same Jabber users and domains as you used while installing and testing OpenSRF. [NOTE] The `-b` flag tells the `cp` command to create a backup version of the destination file. The backup version of the destination file has a tilde (`~`) appended to the file name, so if you have forgotten the Jabber users and domains, you can retrieve the settings from the backup version of the files. `eg_db_config`, described in <<_creating_the_evergreen_database,Creating the Evergreen database>>, sets the database connection information in `opensrf.xml` for you. Configure action triggers for the Evergreen application ------------------------------------------------------- _Action Triggers_ provide hooks for the system to perform actions when a given event occurs; for example, to generate reminder or overdue notices, the `checkout.due` hook is processed and events are triggered for potential actions if there is no checkin time. To enable the default set of hooks, issue the following command as the *opensrf* Linux account: [source, bash] ------------------------------------------------------------------------------ cp -b /openils/conf/action_trigger_filters.json.example /openils/conf/action_trigger_filters.json ------------------------------------------------------------------------------ For more information about configuring and running action triggers, see <<_processing_action_triggers,Notifications / Action Triggers>>. Creating the Evergreen database ------------------------------- Setting up the PostgreSQL server ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For production use, most libraries install the PostgreSQL database server on a dedicated machine. Therefore, by default, the `Makefile.install` prerequisite installer does *not* install the PostgreSQL 9 database server that is required by every Evergreen system. You can install the packages required by Debian or Ubuntu on the machine of your choice using the following commands as the *root* Linux account: . Installing PostgreSQL server packages Each OS build target provides the postgres server installation packages required for each operating system. To install Postgres server packages, use the make target 'postgres-server-<OSTYPE>'. Choose the most appropriate command below based on your operating system. This will install PostgreSQL 9.6, the minimum supported version. [source, bash] ------------------------------------------------------------------------------ make -f Open-ILS/src/extras/Makefile.install postgres-server-debian-buster make -f Open-ILS/src/extras/Makefile.install postgres-server-debian-stretch make -f Open-ILS/src/extras/Makefile.install postgres-server-debian-jessie make -f Open-ILS/src/extras/Makefile.install postgres-server-ubuntu-xenial make -f Open-ILS/src/extras/Makefile.install postgres-server-ubuntu-bionic ------------------------------------------------------------------------------ To install PostgreSQL version 10, use the following command for your operating system: [source, bash] ------------------------------------------------------------------------------ make -f Open-ILS/src/extras/Makefile.install postgres-server-debian-buster-10 make -f Open-ILS/src/extras/Makefile.install postgres-server-debian-stretch-10 make -f Open-ILS/src/extras/Makefile.install postgres-server-debian-jessie-10 make -f Open-ILS/src/extras/Makefile.install postgres-server-ubuntu-xenial-10 make -f Open-ILS/src/extras/Makefile.install postgres-server-ubuntu-bionic-10 ------------------------------------------------------------------------------ For a standalone PostgreSQL server, install the following Perl modules for your distribution as the *root* Linux account: .(Debian and Ubuntu) No extra modules required for these distributions. You need to create a PostgreSQL superuser to create and access the database. Issue the following command as the *postgres* Linux account to create a new PostgreSQL superuser named `evergreen`. When prompted, enter the new user's password: [source, bash] ------------------------------------------------------------------------------ createuser -s -P evergreen ------------------------------------------------------------------------------ .Enabling connections to the PostgreSQL database Your PostgreSQL database may be configured by default to prevent connections, for example, it might reject attempts to connect via TCP/IP or from other servers. To enable TCP/IP connections from localhost, check your `pg_hba.conf` file, found in the `/etc/postgresql/` directory on Debian and Ubuntu. A simple way to enable TCP/IP connections from localhost to all databases with password authentication, which would be suitable for a test install of Evergreen on a single server, is to ensure the file contains the following entries _before_ any "host ... ident" entries: ------------------------------------------------------------------------------ host all all ::1/128 md5 host all all 127.0.0.1/32 md5 ------------------------------------------------------------------------------ When you change the `pg_hba.conf` file, you will need to reload PostgreSQL to make the changes take effect. For more information on configuring connectivity to PostgreSQL, see http://www.postgresql.org/docs/devel/static/auth-pg-hba-conf.html Creating the Evergreen database and schema ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Once you have created the *evergreen* PostgreSQL account, you also need to create the database and schema, and configure your configuration files to point at the database server. Issue the following command as the *root* Linux account from inside the Evergreen source directory, replacing <user>, <password>, <hostname>, <port>, and <dbname> with the appropriate values for your PostgreSQL database (where <user> and <password> are for the *evergreen* PostgreSQL account you just created), and replace <admin-user> and <admin-pass> with the values you want for the *egadmin* Evergreen administrator account: [source, bash] ------------------------------------------------------------------------------ perl Open-ILS/src/support-scripts/eg_db_config --update-config \ --service all --create-database --create-schema --create-offline \ --user <user> --password <password> --hostname <hostname> --port <port> \ --database <dbname> --admin-user <admin-user> --admin-pass <admin-pass> ------------------------------------------------------------------------------ This creates the database and schema and configures all of the services in your `/openils/conf/opensrf.xml` configuration file to point to that database. It also creates the configuration files required by the Evergreen `cgi-bin` administration scripts, and sets the user name and password for the *egadmin* Evergreen administrator account to your requested values. You can get a complete set of options for `eg_db_config` by passing the `--help` parameter. Loading sample data ~~~~~~~~~~~~~~~~~~~ If you add the `--load-all-sample` parameter to the `eg_db_config` command, a set of authority and bibliographic records, call numbers, copies, staff and regular users, and transactions will be loaded into your target database. This sample dataset is commonly referred to as the _concerto_ sample data, and can be useful for testing out Evergreen functionality and for creating problem reports that developers can easily recreate with their own copy of the _concerto_ sample data. Creating the database on a remote server ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In a production instance of Evergreen, your PostgreSQL server should be installed on a dedicated server. PostgreSQL 9.6 and later ^^^^^^^^^^^^^^^^^^^^^^^^ To create the database instance on a remote database server running PostgreSQL 9.6 or later, simply use the `--create-database` flag on `eg_db_config`. Starting Evergreen ------------------ 1. As the *root* Linux account, start the `memcached` and `ejabberd` services (if they aren't already running): + [source, bash] ------------------------------------------------------------------------------ /etc/init.d/ejabberd start /etc/init.d/memcached start ------------------------------------------------------------------------------ + 2. As the *opensrf* Linux account, start Evergreen. The `-l` flag in the following command is only necessary if you want to force Evergreen to treat the hostname as `localhost`; if you configured `opensrf.xml` using the real hostname of your machine as returned by `perl -ENet::Domain 'print Net::Domain::hostfqdn() . "\n";'`, you should not use the `-l` flag. + [source, bash] ------------------------------------------------------------------------------ osrf_control -l --start-all ------------------------------------------------------------------------------ + ** If you receive the error message `bash: osrf_control: command not found`, then your environment variable `PATH` does not include the `/openils/bin` directory; this should have been set in the *opensrf* Linux account's `.bashrc` configuration file. To manually set the `PATH` variable, edit the configuration file `~/.bashrc` as the *opensrf* Linux account and add the following line: + [source, bash] ------------------------------------------------------------------------------ export PATH=$PATH:/openils/bin ------------------------------------------------------------------------------ + 3. As the *opensrf* Linux account, generate the Web files needed by the web staff client and catalogue and update the organization unit proximity (you need to do this the first time you start Evergreen, and after that each time you change the library org unit configuration. ): + [source, bash] ------------------------------------------------------------------------------ autogen.sh ------------------------------------------------------------------------------ + 4. As the *root* Linux account, restart the Apache Web server: + [source, bash] ------------------------------------------------------------------------------ /etc/init.d/apache2 restart ------------------------------------------------------------------------------ + If the Apache Web server was running when you started the OpenSRF services, you might not be able to successfully log in to the OPAC or web staff client until the Apache Web server is restarted. Testing connections to Evergreen -------------------------------- Once you have installed and started Evergreen, test your connection to Evergreen via `srfsh`. As the *opensrf* Linux account, issue the following commands to start `srfsh` and try to log onto the Evergreen server using the *egadmin* Evergreen administrator user name and password that you set using the `eg_db_config` command: [source, bash] ------------------------------------------------------------------------------ /openils/bin/srfsh srfsh% login <admin-user> <admin-pass> ------------------------------------------------------------------------------ You should see a result like: Received Data: "250bf1518c7527a03249858687714376" ------------------------------------ Request Completed Successfully Request Time in seconds: 0.045286 ------------------------------------ Received Data: { "ilsevent":0, "textcode":"SUCCESS", "desc":" ", "pid":21616, "stacktrace":"oils_auth.c:304", "payload":{ "authtoken":"e5f9827cc0f93b503a1cc66bee6bdd1a", "authtime":420 } } ------------------------------------ Request Completed Successfully Request Time in seconds: 1.336568 ------------------------------------ [[install-troubleshooting-1]] If this does not work, it's time to do some troubleshooting. * As the *opensrf* Linux account, run the `settings-tester.pl` script to see if it finds any system configuration problems. The script is found at `Open-ILS/src/support-scripts/settings-tester.pl` in the Evergreen source tree. * Follow the steps in the http://evergreen-ils.org/dokuwiki/doku.php?id=troubleshooting:checking_for_errors[troubleshooting guide]. * If you have faithfully followed the entire set of installation steps listed here, you are probably extremely close to a working system. Gather your configuration files and log files and contact the http://evergreen-ils.org/communicate/mailing-lists/[Evergreen development mailing list] for assistance before making any drastic changes to your system configuration. Getting help ------------ Need help installing or using Evergreen? Join the mailing lists at http://evergreen-ils.org/communicate/mailing-lists/ or contact us on the Freenode IRC network on the #evergreen channel. License ------- This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.