Skip to content

Latest commit

 

History

History
268 lines (222 loc) · 11.1 KB

DSpace4SARA-HOWTO.md

File metadata and controls

268 lines (222 loc) · 11.1 KB

Install & Configure DSpace6 for SARA using bwCloud

Intro

This manual provides a step-by-step setup for a fully configured instance of DSpace6 server. The final instance can be used as institutional repository to receive automated deposits from SARA Service via swordv2.

Further reading: https://wiki.duraspace.org/display/DSDOC6x/DSpace+6.x+Documentation

About SARA: https://sara-service.org

In case of questions please contact:

  • Stefan Kombrink, Ulm University, Germany / e-mail: stefan.kombrink[at]uni-ulm.de
  • Volodymyr Kushnarenko, Ulm University, Germany / e-mail: volodymyr.kushnarenko[at]uni-ulm.de
  • Franziska Rapp, Ulm University, Germany / e-mail: franziska.rapp[at]uni-ulm.de

Setup

Connect to the machine using your credentials (ssh, putty)

Please use the credentials handed out to you, e.g.

Linux/MacOS:

Windows: Download putty and install it

Get Resources

git clone https://github.com/sara-service/workshop.git

Installation

sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get -y install openjdk-8-jdk maven ant postgresql postgresql-contrib curl wget haveged ruby-compass ruby-sass
sudo apt-get remove -y openjdk-11-jre-headless # do NOT install java 11

Postgres

sudo systemctl start postgresql
sudo groupadd dspace
sudo useradd -m -g dspace dspace
sudo -u postgres createuser --no-superuser dspace
sudo -u postgres psql -c "ALTER USER dspace WITH PASSWORD 'dspace';"
sudo -u postgres createdb --owner=dspace --encoding=UNICODE dspace
sudo -u postgres psql dspace -c "CREATE EXTENSION pgcrypto;"

Tomcat

wget http://archive.apache.org/dist/tomcat/tomcat-8/v8.5.32/bin/apache-tomcat-8.5.32.tar.gz -O /tmp/tomcat.tgz
sudo mkdir /opt/tomcat
sudo tar xzvf /tmp/tomcat.tgz -C /opt/tomcat --strip-components=1
sudo cp ~/workshop/DSpace/config/tomcat/tomcat.service /etc/systemd/system/tomcat.service
sudo cp ~/workshop/DSpace/config/tomcat/server.xml /opt/tomcat/conf/server.xml
sudo chown -R dspace.dspace /opt/tomcat
sudo systemctl daemon-reload
sudo systemctl start tomcat

Now you should be able to find your tomcat running under http://vm-XXX-XXX.bwcloud.uni-ulm.de:8080

DSpace

# install mirage2 deps locally
sudo -H -u dspace sh -c 'wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash'
sudo -H -u dspace bash -c 'export NVM_DIR="$HOME/.nvm" && source "$NVM_DIR/nvm.sh" && nvm install v8'
sudo -H -u dspace bash -c 'export NVM_DIR="$HOME/.nvm" && source "$NVM_DIR/nvm.sh" && npm install -g bower grunt grunt-cli'
wget https://github.com/DSpace/DSpace/releases/download/dspace-6.3/dspace-6.3-src-release.tar.gz -O /tmp/dspace-src.tgz
mkdir -p /tmp/dspace-src
tar -xzvf /tmp/dspace-src.tgz -C /tmp/dspace-src --strip-components=1
sudo chown -R dspace:dspace /tmp/dspace-src 
sudo mkdir /dspace
sudo chown dspace /dspace
sudo chgrp dspace /dspace
# NOTE needs sudo interactive or else build fails for Mirage2(xmlui)
sudo -H -u dspace bash -c 'export GEM_HOME=/var/lib/gems/2.5.0 && export GEM_PATH=/var/lib/gems/2.5.0 && export NVM_DIR="$HOME/.nvm" && source "$NVM_DIR/nvm.sh" && cd /tmp/dspace-src && mvn -e clean package -Dmirage2.on=true -Dmirage2.deps.included=false'
sudo -H -u dspace -- sh -c 'cd /tmp/dspace-src/dspace/target/dspace-installer; ant fresh_install'
ADMIN_EMAIL="[email protected]" # will be needed later again...
# Create dspace admin
sudo -u dspace /dspace/bin/dspace create-administrator -e $ADMIN_EMAIL -f "Super" -l "User" -p "iamthebest" -c en

Apply presets

# Enable Mirage2 Themes
cat ~/workshop/DSpace/config/xmlui.xconf             | sudo -u dspace sh -c 'cat > /dspace/config/xmlui.xconf'
# Apply customized item submission form
cat ~/workshop/DSpace/config/item-submission.xml     | sudo -u dspace sh -c 'cat > /dspace/config/item-submission.xml'
cat ~/workshop/DSpace/config/input-forms.xml         | sudo -u dspace sh -c 'cat > /dspace/config/input-forms.xml'
# Custom item view
cat ~/workshop/DSpace/config/xmlui/item-view.xsl     | sudo -u dspace sh -c 'cat > /dspace/webapps/xmlui/themes/Mirage2/xsl/aspect/artifactbrowser/item-view.xsl'
# Custom messages
cat ~/workshop/DSpace/config/xmlui/messages.xml      | sudo -u dspace sh -c 'cat > /dspace/webapps/xmlui/i18n/messages.xml'
cat ~/workshop/DSpace/config/xmlui/messages_de.xml   | sudo -u dspace sh -c 'cat > /dspace/webapps/xmlui/i18n/messages_de.xml'
# Custom landing page
cat ~/workshop/DSpace/config/xmlui/news-xmlui.xml    | sudo -u dspace sh -c 'cat > /dspace/config/news-xmlui.xml'
# Custom thumbnails
cat ~/workshop/DSpace/config/xmlui/Logo_SARA_RGB.png | sudo -u dspace sh -c 'cat > /dspace/webapps/xmlui/themes/Mirage2/images/Logo_SARA_RGB.png'
# Custom icons
cat ~/workshop/DSpace/config/xmlui/arrow.png         | sudo -u dspace sh -c 'cat > /dspace/webapps/xmlui/themes/Mirage2/images/arrow.png'
# Copy email templates
sudo cp ~/workshop/DSpace/config/emails/* /dspace/config/emails/
sudo chown -R dspace /dspace/config/emails
sudo chgrp -R dspace /dspace/config/emails
# Apply custom local configurations
cat ~/workshop/DSpace/config/local.cfg | sed 's/devel-dspace.sara-service.org/'$(hostname)'/g' | sudo -u dspace tee /dspace/config/local.cfg
# Apply default deposit license
cat ~/workshop/DSpace/config/default.license | sudo -u dspace tee /dspace/config/default.license
# Copy all webapps from dspace to tomcat
sudo rsync -a -v -z --delete --force /dspace/webapps/ /opt/tomcat/webapps
sudo systemctl restart tomcat
sudo systemctl enable postgresql
sudo systemctl enable tomcat

Test your instance

hostname # this is your DSpace hostname!

Open the start page of your DSpace server: http://vm-XXX-XXX.bwcloud.uni-ulm.de:8080/xmlui You should be able to login with your admin account.

Configuration

Create an initial configuration

First we will create a sample bibliography:

sudo -u dspace /dspace/bin/dspace structure-builder -f ~/workshop/DSpace/config/DSpace_Import_Structure.xml -o /tmp/DSpace_Export_Structure.xml -e "$ADMIN_EMAIL"

Now we will create a service user dedicated to SARA. This user restrains the collections a SARA user will have access to! You can even use a non-existing email address here since you are admin.

sudo /dspace/bin/dspace user --add --email [email protected] --password SaraTest --givenname SARA --surname ServiceUser

...and two demo users

sudo /dspace/bin/dspace user --add --email [email protected] --password SaraTest --givenname Demo --surname User
sudo /dspace/bin/dspace user --add --email [email protected] --password SaraTest --givenname Demo --surname Loser

After that, we need to create groups and configure permissions. You will need to login with $ADMIN_EMAIL using the DSpace UI:

  • create a group called SARA User and add [email protected]
  • create a group called DSpace User and add [email protected]
  • for the two Research Data collections allow submissions for both DSpace User and SARA User
  • for Faculty of Education -> Publication do nothing
  • for Faculty of Science and Technology -> Publication collection allow submissions for SARA User group only

Validate Swordv2 functionality (HTTP)

Now we check whether the Sword Interface is configured properly and a valid ServiceDocument is being delivered. We distinguish three cases:

  • USER1 is registered and has access to at least one collection
  • USER2 is registered but has no access to any collection
  • USER3 is not registered at all
DSPACE_SERVER="$(hostname):8080"

SARA_USER="[email protected]"
SARA_PWD="SaraTest"
USER1="[email protected]" # set existing SARA User
USER2="[email protected]" # set existing user without any permissions
USER3="[email protected]" # set nonexisting user

curl -H "on-behalf-of: $USER1" -i $DSPACE_SERVER/swordv2/servicedocument --user "$SARA_USER:$SARA_PWD"  # => downloads TermsOfServices for all available collections
curl -H "on-behalf-of: $USER2" -i $DSPACE_SERVER/swordv2/servicedocument --user "$SARA_USER:$SARA_PWD"  # => downloads empty service document
curl -H "on-behalf-of: $USER3" -i $DSPACE_SERVER/swordv2/servicedocument --user "$SARA_USER:$SARA_PWD"  # => HTML Error Status 403: Forbidden

Install apache httpd

sudo apt-get -y install apache2
sudo a2enmod ssl proxy proxy_http proxy_ajp
sudo systemctl restart apache2

Now you will see the standard apache index page: http://vm-XXX-XXX.bwcloud.uni-ulm.de

Install letsencrypt, create and configure SSL cert

sudo apt -y install python3-certbot-apache
sudo systemctl stop apache2
sudo letsencrypt --authenticator standalone --installer apache --domains $(hostname)

Choose secure redirect . Now you should be able to access via https only: http://vm-XXX-XXX.bwcloud.uni-ulm.de

Configure apache httpd

First stop tomcat:

sudo systemctl stop tomcat

Then append the following section to your virtual server config under /etc/apache2/sites-enabled/000-default-le-ssl.conf :

sudo vim /etc/apache2/sites-enabled/000-default-le-ssl.conf
        ProxyPass /xmlui ajp://localhost:8009/xmlui
        ProxyPassReverse /xmlui ajp://localhost:8009/xmlui

        ProxyPass /oai ajp://localhost:8009/oai
        ProxyPassReverse /oai ajp://localhost:8009/oai
        ProxyPass /rest ajp://localhost:8009/rest
        ProxyPassReverse /rest ajp://localhost:8009/rest
        ProxyPass /solr ajp://localhost:8009/solr
        ProxyPassReverse /solr ajp://localhost:8009/solr
        ProxyPass /swordv2 ajp://localhost:8009/swordv2

        ProxyPass / ajp://localhost:8009/xmlui
        ProxyPassReverse / ajp://localhost:8009/xmlui

Restart apache:

sudo systemctl restart apache2

Update DSpace local.cfg

Now you need to remove the local port 8080 and the http in the dspace config:

sudo sed -i 's#dspace.baseUrl = http://${dspace.hostname}:8080#dspace.baseUrl = https://${dspace.hostname}#' /dspace/config/local.cfg
sudo service tomcat restart

Validate Swordv2 functionality (HTTPS)

Experience shows that many things can break while setting up apache+SSL hence we will repeat the previous checks.

DSPACE_SERVER="https://$(hostname)"

SARA_USER="[email protected]"
SARA_PWD="SaraTest"
USER1="[email protected]" # set existing SARA User
USER2="[email protected]" # set existing user without any permissions
USER3="[email protected]" # set nonexisting user

curl -H "on-behalf-of: $USER1" -i $DSPACE_SERVER/swordv2/servicedocument --user "$SARA_USER:$SARA_PWD"  # => downloads TermsOfServices for all available collections
curl -H "on-behalf-of: $USER2" -i $DSPACE_SERVER/swordv2/servicedocument --user "$SARA_USER:$SARA_PWD"  # => downloads empty service document
curl -H "on-behalf-of: $USER3" -i $DSPACE_SERVER/swordv2/servicedocument --user "$SARA_USER:$SARA_PWD"  # => HTML Error Status 403: Forbidden

Congratulations, you are done!