Skip to content
Jozef Misutka edited this page May 15, 2015 · 39 revisions

Read Installation - Prerequisites before.

The following variables will be used in the following text:

export INSTITUTE=our_institute
export DSPACE_INSTANCE_NAME=repository
export DSPACE_SOURCE_DIRECTORY=/opt/repository/$INSTITUTE/sources/dspace
export DSPACE_WORKSPACE=/opt/repository/$INSTITUTE/workspace
export DSPACE_INSTALLATION_DIRECTORY=/opt/repository/$INSTITUTE/installations

Note for upgrading from lindat-repository (previous version based on DSpace 1.8.2)

[Upgrading from lindat-repository](Upgrade From Lindat Repository) based on 1.8.2 version.

Note for Windows users

Windows users should read this.

Clone LINDAT DSpace from Git

Clone https://github.com/ufal/lindat-dspace.git repository branch lindat for read-only access.

git clone https://github.com/ufal/lindat-dspace.git -b lindat $DSPACE_SOURCE_DIRECTORY

Populate workspace

To get the directory structure of old lindat-repository

cd $DSPACE_SOURCE_DIRECTORY/utilities/project_helpers
./setup.sh $DSPACE_WORKSPACE

Directory structure

Run utilities/project_helpers/setup.sh in order to create {config,scripts,..} directories in the main source directory.

Update Configuration

Update DSpace Configuration

If the variables in $DSPACE_SOURCE_DIRECTORY/config/variable.makefile.example are not correct, copy the file to $DSPACE_SOURCE_DIRECTORY/config/variable.makefile and update them.

cd $DSPACE_SOURCE_DIRECTORY/config/
cp variable.makefile.example variable.makefile
vim variable.makefile

Optionally create start/stop scripts to start/stop your server "stack" (apache, tomcat, postgres...) review $DSPACE_WORKSPACE/scripts/start_stack_example.sh and $DSPACE_WORKSPACE/scripts/stop_stack_example.sh. If you don't like what is in there create $DSPACE_WORKSPACE/scripts/start_stack.sh and $DSPACE_WORKSPACE/scripts/stop_stack.sh of your own. You might want to check another examples in $DSPCAE_WORKSPACE/scripts/{start,stop}_stack_example.old

Create a copy of distribution config file inside $DSPACE_WORKSAPCE/sources/ and name it local.properties

cp $DSPACE_WORKSPACE/config/local.conf.dist $DSPACE_WORKSAPCE/sources/local.properties

Update the local.properties file and provide the required values (list should be updated!):

See Configuration

Update Tomcat Configuration

Add the following configuration in the /etc/tomcat6/server.xml file inside the element Host.

<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">

        <Context path="/$DSPACE_INSTANCE_NAME/xmlui" docBase="$DSPACE_INSTALLATION_DIRECTORY/webapps/xmlui"
                       reloadable="true" cachingAllowed="false" allowLinking="true" />
        <Context path="/$DSPACE_INSTANCE_NAME/solr" docBase="$DSPACE_INSTALLATION_DIRECTORY/webapps/solr"
                       reloadable="true" cachingAllowed="false" allowLinking="true" />
        <Context path="/$DSPACE_INSTANCE_NAME/oai" docBase="$DSPACE_INSTALLATION_DIRECTORY/webapps/oai"
                       reloadable="true" cachingAllowed="false" allowLinking="true" />
</Host>

If the directories do not match the installation directory, you have to create links to these directories.

Note: We could also create a tomcat virtual host (see section Multiple Instances Dspace), but our current configuration of DSpace Shibboleth login has problems with such a setup, so for now please use the above configuration instead.

Note 2: Ensure Tomcat runs with -Dfile.encoding=UTF8 and/or <Connector port="8080" ... URIEncoding="UTF-8" />.

Update Apache Configuration

Add the following in the /etc/apache2/sites-enabled/https-tomcat6 (or ssl-dspace.conf) file inside the element in case your path is not caught by the LocationMatch.

<Location /$DSPACE_INSTANCE_NAME/xmlui/shibboleth-login>
        AuthType shibboleth
        ShibRequireSession On
        ShibUseHeaders On
        require valid-user
</Location>

Create Databases

Create DSpace and Utilities Database

  • Create user dspace
  sudo -u postgres createuser --username=postgres --no-superuser --pwprompt dspace
  • Skip this step if the databases already exists
cd $DSPACE_WORKSPACE/scripts
sudo make create_databases

Branding

Branding (headers and footers of DSpace web interface) is done by cloning LINDAT Common Theme git repository at https://redmine.ms.mff.cuni.cz/lindat/lindat-common.git to directory defined by configuration variable lindat.common.theme in $DSPACE_SOURCE_DIRECTORY/config/local.conf. This directory is then symlinked to directory defined by ${ufal.dspace.dir}/webapps/xmlui/themes/UFAL/lib/lindat.

This is done automatically as a part of postinstall target in $DSPACE_SOURCE_DIRECTORY/scripts/makefile which is run as a part of the deployment process.

This mechanism ensures, that the instance is always using the latest branding and the branding can be updated independently in the installation directory after the deploy.

Compilation and Deployment of DSpace

Interesting fields in dspace.cfg

As a rule of thumb don't use trailing slash

Field Value Comments
dspace.url ${dspace.baseUrl}/xmlui webapp we are using. No trailing slashes. Not used by /logout (see #686)

Set up prerequisities e.g. local libraries

sudo make install_libs

Compile and deploy new DSpace instance

sudo make new_deploy

Run initialization scripts

First create an administrator for the dspace instance. Make sure to use the same email address with which you are registered on the Identity Provided, so that you have the administration rights when login through shibboleth.

sudo $DSPACE_INSTALLATION_DIRECTORY/bin/dspace create-administrator

Initialize the statistics, we are still in the scripts directory.

sudo make init_statistics

Update discovery

sudo make update_discovery

Update OAI

sudo make update_oai

Add a cronjob to update statistics regularly (Do not use sudo to run this command so that the job will added only for the current user)

make add_cronjobs

Also see section Initialize Stats.

Finally start/restart the server

  • If the server is not running
cd $DSPACE_WORKSPACE/scripts
sudo make start
  • If the server is running
cd $DSPACE_WORKSPACE/scripts
sudo make restart

Once the server starts the instance is ready to use.

Redeploy DSpace

If any change is made to the local configuration and/or source code, redeploy needs to be done:

cd $DSPACE_WORKSPACE/scripts
sudo make deploy

Other useful stuff

Important makefile targets

  • To only compile the code:
sudo make compile
  • To install the compiled code:
sudo make install
  • To compile and install at once:
sudo make deploy
  • If there are only configuration changes. You don't need to compile or deploy the whole dspace, use the following target and restart the server.
make update_config

Note: If you are using previous versions of ant then deploying/updating the application will not update the config files correctly. It will create config files with .new extension. Please update your ant version to 1.8 above.

Handle server

If you will be running your own handle server follow the official guide or check one of the older issues

Restore a database

sudo make restore_database

Update AssestStore path

If you have restored data from 1.6.2 database then also update assetstore path in dspace.cfg to redirect it to the location where 1.6.2 submission's data is actually stored.

change,

assetstore.dir = ${dspace.dir}/assetstore

to,

assetstore.dir = /mnt/DATA/121/home/dspace/installations/dspace/stable/assetstore

Note: If you also want to make submissions from your own 1.8.2 instance then instead of changing path just copy 1.6.2 assetstore data into your instance assetstore directory.

Initialize stats

sudo make init_statistics

Once the stats are initialized. Add a cron job for following targets to update the solr statistics regularly.

sudo make update_statistics

To add the cronjob automatically (Do not use sudo to run this command so that the job will added only for the current user)

Note: Sitemaps are regenerated periodically but make sure you have at least one collection (or you'll be getting NullPointerExceptions).

Start/Stop/Restart the servers

Start/Restart/Stop all servers (defined in scripts/{start,stop}_stack.sh)

sudo make start
sudo make restart
sudo make stop

Logs

The last compilation or installation logs can be accesses in the directory $DSPACE_WORSKPACE/logs

Multiple Instances Dspace

To create multiple dspace instances on the same server with single tomcat, we can use the name based virtual hosts. Add the following in /etc/tomcat6/server.xml to create a new virtual host.

  • Be sure that the defaultHost from matches name in <Host*>
        <Host name="localhost/$DSPACE_INSTANCE_NAME" debug="0" 
                appBase="$DSPACE_INSTALLATION_DIRECTORY/webapps" 
                autoDeploy="true" unpackWARs="true">

                <Valve className="org.apache.catalina.valves.AccessLogValve"
                        directory="[PATH_OF_LOGS]"
                        prefix="tomcat_access."
                        suffix=".log"
                        pattern="common"
                        resolveHost="false"
                />

                <Context path="/xmlui" docBase="$DSPACE_INSTALLATION_DIRECTORY/webapps/xmlui"
                        reloadable="true" cachingAllowed="false"
                        allowLinking="true"/>
                <Context path="/wiki-test/solr" docBase="$DSPACE_INSTALLATION_DIRECTORY/webapps/solr"
                        reloadable="true" cachingAllowed="false" allowLinking="true" />
        </Host>

The installed dspace can be accessed using http://localhost/$DSPACE_INSTANCE_NAME/xmlui

  • The above code can be automatically inserted using the following target of makefile but you should rather do it manually for better control*
cd $DSPACE_WORKSPACE/scripts
sudo make add_virtual_host

The virtual host will be created based on your source directory name. If you want to use a different name update the HOST_NAME in variables file.

Additional changes to the installed server

apache/tomcat

  • xml+cmdi on specific http headers (#513) ** there's an /cite endpoint (under oai webapp) that is used for displaying some of the metadata in form suitable for copy and paste. We are using apache rewrites to "direct" links like HANDLE@format=cite_FORMAT to this endpoint. This might be handled by cocoon matchers in the future.
  • run programs from control panel (#551)
  • aptitude install python-dateutil python-lxml (#611)
  • shibboleth errors (#629)
Clone this wiki locally