Install Invenio

Now that all the prerequisites have been set up in Install prerequisites, we can proceed with the installation of the Invenio itself. The installation is happening on the web node (192.168.50.10).

We start by creating and configuring a new Invenio instance, continue by populating it with some example records, and finally we start the web application. This can be done in an automated unattended way by running the following scripts:

source .inveniorc
./scripts/create-instance.sh
./scripts/populate-instance.sh
./scripts/start-instance.sh

Note

If you want to install the very-bleeding-edge Invenio packages from GitHub, you can run the create-instance.sh script with the --devel argument:

./scripts/create-instance.sh --devel

Let’s see in detail about every Invenio installation step.

Create instance

We start by creating a fresh new Python virtual environment that will hold our brand new Invenio v3.0 instance:


mkvirtualenv "${INVENIO_WEB_VENV}"
cdvirtualenv

We continue by installing Invenio v3.0 Integrated Library System flavour demo site from PyPI:


pip install invenio-app-ils[postgresql,elasticsearch2]

Let’s briefly customise our instance with respect to the location of the database server, the Redis server, the Elasticsearch server, and all the other dependent services in our multi-server environment:


mkdir -p "var/instance/"
pip install "jinja2-cli>=0.6.0"
jinja2 "$scriptpathname/instance.cfg" > "var/instance/${INVENIO_WEB_INSTANCE}.cfg"

In the instance folder, we run Npm to install any JavaScript libraries that Invenio needs:


${INVENIO_WEB_INSTANCE} npm
cdvirtualenv "var/instance/static"
CI=true npm install

We can now collect and build CSS/JS assets of our Invenio instance:


${INVENIO_WEB_INSTANCE} collect -v
${INVENIO_WEB_INSTANCE} assets build

Our first new Invenio instance is created and ready for loading some example records.

Populate instance

We proceed by creating a dedicated database that will hold persistent data of our installation, such as bibliographic records or user accounts. The database tables can be created as follows:


${INVENIO_WEB_INSTANCE} db init
${INVENIO_WEB_INSTANCE} db create

We continue by creating a user account:


${INVENIO_WEB_INSTANCE} users create \
       "${INVENIO_USER_EMAIL}" \
       --password "${INVENIO_USER_PASS}" \
       --active

We can now create the Elasticsearch indexes and initialise the indexing queue:


${INVENIO_WEB_INSTANCE} index init
sleep 20
${INVENIO_WEB_INSTANCE} index queue init

We proceed by populating our Invenio demo instance with some example demo MARCXML records:


${INVENIO_WEB_INSTANCE} demo init

Start instance

Let’s now start the web application:


${INVENIO_WEB_INSTANCE} run -h 0.0.0.0 &

and the web server:


    $sudo service nginx restart
    

We should now see our demo records on the web:

firefox http://${INVENIO_WEB_HOST}/records/1

and we can access them via REST API:

curl -i -H "Accept: application/json" \
     http://${INVENIO_WEB_HOST}/api/records/1

We are done! Our first Invenio v3.0 demo instance is fully up and running.