Skip to content

EuropeanaRS Installation

Aldo edited this page Apr 3, 2017 · 8 revisions

EuropeanaRS Installation

  1. Previous requirements
    1. Generate SSH keys for GitHub
  2. Installation for development
    1. Required packages
    2. Set up the EuropeanaRS instance
    3. Database
      1. PostgreSQL installation
      2. Populate
    4. Install the search engine
    5. Start server

  • A computer with:
    • Ubuntu 14.04
    • Internet connection

Install ruby and git:

sudo apt-get install ruby git-core

To access to GitHub repositories via git you need to generate public and private keys. If you have already generated SSH keys for Github, you can skip this step.
To generate the ssh keys, you can check the official github guide, or follow the next instructions.

Execute the following command:

ssh-keygen

Accept the default name it proposes and do not introduce password (if you introduce one you will have to introduce it every time you access the repository).

In /home/{username}/.ssh (where username is the name of your user) there will be two files: id_rsa and id_rsa.pub.
Now you have to add the public key (the one in id_rsa.pub) to your GitHub account.
To do that, go to Settings -> SSH keys -> Add SSH Key in your account, and save your public key.

To check that it has been added correctly execute the following command:

If everything works fine, this command will print a message like "You've successfully authenticated".

 
 

First off, you have to download the source code from git.
Go to your workspace folder and execute the following command to clone the EuropeanaRS repository:

git clone https://github.com/agordillo/EuropeanaRS.git

##Required packages

The following packages should be installed.

sudo apt-get install libxml2-dev libxslt-dev libmysqlclient-dev libsqlite3-dev libpq-dev nodejs

Now enter in the folder europeanars and execute the following commands:

cd europeanars  
gem install bundler  
bundle install

##Set up the EuropeanaRS instance To start the EuropeanaRS application you need to set up the EuropeanaRS instance.
First off, you must copy the file /config/application_config.yml.example to config/application_config.yml.

cp config/application_config.yml.example config/application_config.yml

This file will look something like this:

development:
  domain: "localhost:3000"
  secret_token: ""     # Execute 'bundle exec rake secret' to generate a new secret_token and copy it here
  europeana:
    api_key: ""        #Request an API key here: http://labs.europeana.eu/api/introduction
    private_key: ""
    oauth2_client_id: ""
    oauth2_client_key: ""
    oai_pmh_key: ""    #Request an access key for the OAI-PMH service here: http://labs.europeana.eu/api/oai-pmh-access-key
    # my_europeana: "mimic" #To use a mimic of the MyEuropeana API instead of the real one. This should be used only for development.
  facebook: #Get Facebook credentials for your app from https://developers.facebook.com/
    app_id: ""
    app_secret: ""
  mail:
    no_reply_mail: "[email protected]"
    main_mail: "[email protected]"
    type: "SMTP" #Type can be "SENDMAIL" or "SMTP" (default)
    # gmail_credentials:
    #   username: ""
    #   password: ""
  settings: #settings for the Recommender System
    resource_types: ["TEXT","VIDEO","SOUND","IMAGE","3D"]
    max_text_length: 50 #Maximun length in characters of the texts that will be taking into account when measuring semantic distances. High values could lead to performance issues.
    max_user_los: 2 #Maximum number of LOs of the users to be processed on the RS. High values could lead to performance issues.
    europeanars_database:
      max_preselection_size: 500 #Maximun number of Learning Objects retrieved by the search engine in the preselection phase of the recommendations. High values could lead to performance issues.
    europeana_database:
      max_preselection_size: 500 #Maximun number of Learning Objects retrieved from Europeana in the preselection phase. High values could lead to performance issues.
  default_settings: #Default settings for the Recommender System
    database: "EuropeanaRS" #database used for generate the recommendations. Accepted values: "EuropeanaRS", "Europeana", "All"
    query: ""
    preselection_filter_resource_type: "true"
    preselection_filter_languages: "true"
    europeanars_database:
      preselection_size: 500
    europeana_database:
      preselection_size: 500
      query:
        skos_concept: "http://vocab.getty.edu/aat/300026656"
        type: "TEXT"
  europeanars_api:
    require_key: "true" #if false, no app key would be required when using the EuropeanaRS API.
  weights:
    default_rs:
      los_score: 0.4
      us_score: 0.4
      quality_score: 0.1
      popularity_score: 0.1
    default_los:
      title: 0.2
      description: 0.15
      language: 0.5
      year: 0.15
    default_us:
      language: 0.5
      los: 0.5
    popularity:
      visit_count: 0.5
      like_count: 0.5
  filters:
    default_rs:
      los_score: 0
      us_score: 0
      quality_score: 0
      popularity_score: 0
    default_los:
      title: 0
      description: 0
      language: 0
      year: 0
    default_us:
      language: 0
      los: 0

test:
  secret_token: ""

To set up a EuropeanaRS instance for development, some values should be specified in this file.

Execute the following command and use its output as the value for the secret_token key of the application_config.yml file.

bundle exec rake secret

If you want to use the Europeana repository, you should get an API key from http://labs.europeana.eu/api/introduction. Without a key, EuropeanaRS will not be able to use the Europeana Search API or any other Europeana service.
After obtaining the key, you will be able to fill these settings:

europeana:
    api_key: ""        #Request an API key here: http://labs.europeana.eu/api/introduction
    private_key: ""

If you are interested in the different options that can be specified in the application_config.yml file to customize and set up a EuropeanaRS instance, you can check the setting up a EuropeanaRS instance section.

 

##Database EuropeanaRS requires postgres 9.3.9+ as database management system. To install it:

sudo apt-get install postgresql postgresql-contrib

To assign a password to the postgres user:

sudo -u postgres psql postgres
posgres#> ALTER USER postgres with password '{your_db_password}';
posgres#> \q

To create the europeanars database for development:

sudo -u postgres createdb europeanars_development

Copy the file /config/database.yml.example to config/database.yml.

cp config/database.yml.example config/database.yml

The config/database.yml file should look like this:

development:
  adapter: postgresql
  encoding: unicode
  database: europeanars_development
  host: localhost
  pool: 5
  username: postgres
  password: {your_db_password}

##Populate the database

You can use a development dump which will populate the database with all necessary entities for starting the application and perform developing tasks, or just start with an empty database.

###Use the development dump

Execute the following commands:

cd EuropeanaRS
sudo ./dumps/loaddump.sh
(and type 'y' when the script asks for confirmation)

###Starts with an empty database

Execute the following commands:

cd EuropeanaRS
bundle exec rake db:migrate

If you want to create an initial user and an initial application execute the following command:

bundle exec rake db:populate:install

After this, your EuropeanaRS application will have:
A user called 'Demo' with email '[email protected]' and password 'demonstration'.
An application called 'EuropeanaRS' and API KEY and PRIVATE KEY 'demonstration'.

 

##Install the search engine
EuropeanaRS requires Sphinx 2.2.10 or higher as search engine. To install it:

wget http://sphinxsearch.com/files/sphinxsearch_2.2.10-release-0ubuntu12~precise_amd64.deb
sudo dpkg -i sphinxsearch_2.2.10-release-0ubuntu12~precise_amd64.deb

Besides, you must copy the file /config/thinking_sphinx.yml.example to config/thinking_sphinx.yml.

cp config/thinking_sphinx.yml.example config/thinking_sphinx.yml

Finally, to set up and initiate Sphinx execute the following commands in the EuropeanaRS folder:

bundle exec rake ts:index
bundle exec rake ts:config
bundle exec rake ts:rebuild

After that, your local EuropeanaRS instance will be ready for development.

 

##Start local server for development

Start the server executing:

bundle exec rake ts:rebuild
bundle exec rails s

Check that it is working with a web browser by opening http://localhost:3000.
Remember that you can log in using the demo user (email '[email protected]' and password 'demonstration').