Installing DSpace 1.7 on Ubuntu 10.04

Original wiki entry by

Peter Dietz.

The goal of this guide is to provide a simple path that will get a user up-and-running as quickly as possible. Peter Dietz did a great job with this, however there are issues about setting up DSpace on an Ubuntu 10.04LTS server that I didn’t think were covered well. This is not entirely surprising because there have been two Ubuntu releases since April of 2010, and it is at least because my company doesn’t set up servers on the bleeding edge of Ubuntu development. There may be a switch to Debian at some point. Debian Stable is even more stable than Ubuntu LTS, I must admit, but we are more comfortable with Ubuntu.

Installing DSpace is almost as simple as changing between DSpace versions (eg between 1.6 and 1.7). It can be done in only a few minutes. The installation and configuration of the prerequisites is the step that takes all the time. Within the world of the Ubuntu server, this is standard stuff. Ubuntu has an application to help with setting up the web application stack. The following is steps that are performed from Terminal, the command line interface in Ubuntu. These steps can also be done through a ssh secure shell from any machine with a ssh client, or from runlevel 3 command-line with networking.

This how-to was originally written for Ubuntu 10.10 (Maverick Meerkat) and has been tested with Ubuntu 11.04 (Natty Narwhal). The current write-up is developed for Ubuntu Lucid Lynx 10.04LTS for use at Lyrasis, where I work as a Linux Systems Administrator. We have a policy of using LTS versions of the OS in my department, so we will not be updating our servers until the next Long-Term-Support version appears, next year. Here is the original wiki link, so you can see what I added. https://wiki.duraspace.org/display/DSPACE/Installing+DSpace+1.7+on+Ubuntu ..modified by Wolf Halton 8/18/2011

Acting as Root where You will be Doing Dozens of Commands as Root

Rather than repeat “sudo” over and over, one can use sudo -i to act as if one had logged in to a root session. The root session is a larger security risk than typing sudo over and over, however if you are planning to leave your computer you can easily type “exit” to leave the root session or lock your screen if you must leave the machine.

Install Prerequisites

Install the server stack of Tomcat (web server) and PostgreSQL (database)

sudo-iEnter password# aptitude install tasksel

# tasksel

  • Select the following packages

[*] LAMP server[*] PostgreSQL database

[*] Tomcat Java server

Install the Compile / Build tools

# aptitude install ant maven2

Configure the Prerequisite Software

Create the database user (dspace)

# su - postgres

$ createuser -U postgres -d -A -P dspace

$ exit

Allow the database user (dspace) to connect to the database

# vi /etc/postgresql/9.4/main/pg_hba.conf# Add this line to the configuration:

local all dspace md5

# /etc/init.d/postgresql restart

Set the PostgreSQL Listening Port Wide

# vi /etc/postgresql/9.0/main/postgresql.conf# Add on line 57 in the configuration:

listen_address = ‘*’

# /etc/init.d/postgresql restart

 

Create the dspace database

As the postgres user

# su – postgres

createdb -U dspace -E UNICODE dspace

Configure Tomcat to know about the DSpace webapps.

As root user

# vi /etc/tomcat6/server.xml# Insert the following block of text just above the closing </Host><!-- Define a new context path for all DSpace web apps -->

<Context path="/xmlui"

docBase="/dspace/webapps/xmlui"

allowLinking="true"/>

<Context path="/sword"

docBase="/dspace/webapps/sword"

allowLinking="true"/>

<Context path="/oai"

docBase="/dspace/webapps/oai"

allowLinking="true"/>

<Context path="/jspui"

docBase="/dspace/webapps/jspui"

allowLinking="true"/>

<Context path="/lni"

docBase="/dspace/webapps/lni"

allowLinking="true"/>

<Context

path=”/solr”

docBase="/dspace/webapps/solr"

allowLinking="true"/>

Download and Install DSpace

Create the [dspace] directory.

The [dspace] directory is where the running dspace code will reside. As the root user:

# mkdir /dspace

Download the Source Release

The source release allows you to customize every aspect of DSpace. This step downloads the compressed archive from SourceForge, and unpacks it in your current directory. The dspace-1.x.x-src-release directory is typically referred to

as [dspace-src].

You may have noticed there is not a unix system user called “dspace.” At this point you might want to “su: to your standard user – in my case that user would be “wolf” so I would type:

su – wolf# then type the following commands (note that I didn’t just exit from root. I didn’t want to type in a password when I go back to being “root” again).

wget http://sourceforge.net/projects/dspace/files/DSpace%20Stable/1.7.2/dspace-1.7.2-src-release.tar.gz

tar -xvzf dspace-1.7.2-src-release.tar.gz

Compile and Build DSpace

The source release that has been obtained is human readable source code, and must be compiled to machine code for the server to run it. “mvn package” compiles the source code, and “ant” will do all the work necessary to initialize the database with the DSpace schema, and copy all of the compiled machine code to a location where the web server can serve it.

As the root user perform the following steps”

Note: ant fresh_install will populate the dspace database and [dspace] directory with new information. This will overwrite any existing installation of DSpace that you may have.

For upgrades the better command to use would be ant update, as it doesn’t alter the database or modify your assetstore.

# cd dspace-1.7.2-src-release# mvn -U package# cd dspace/target/dspace-1.7.2-build.dir

# ant fresh_install

Fix Tomcat permissions, and restart the Tomcat server

This guide follows the convention where the tomcat user will own all of the files in [dspace], so we have to change the owner of the files to tomcat6. Restarting tomcat will deploy the dspace webapps that are now ready to be viewed.

# chown tomcat6:tomcat6 /dspace -R

# /etc/init.d/tomcat6 restart

 

XMLUI Display Issues

When any change is done to anything that changes the content of the static xmlui pages, one good solution which comes from http://www.mail-archive.com/dspace-tech@lists.sourceforge.net/msg14441.html is that the cocoon cache has to be emptied. I have spent 2 days searching for a way to update a change in web-admin email address that appears on the contacts page. In our setup, the file we need to get rid of is /var/cache/tomcat6/Catalina/localhost/xmlui/cache-dir/cocoon-ehcache.data

To be on the safe side I just moved the file to cocoon-ehcache.data.old, restarted tomcat6, and “Bang!” the contacts page displays properly.

Test it out in your browser

That is all that is required to install DSpace on Ubuntu. There are two main webapps that provide a similar turn-key repository interface

http://localhost:8080/xmlui

http://localhost:8080/jspui

Setting an Admin Account

To add an admin account for administering Dspace, go to [dspace]/bin/ and run the command

./dspace create-administrator

The following lines are an

(almost) exact display of how that application works.

root@DSPACE-TEST-01:/dspace/bin#

./dspace create-administrator
Creating an initial administrator account

E-mail address:

wolf.halton@lyrasis.org

 

First name: Wolf

Last name: Halton

WARNING: Password will appear on-screen.

Password: your-admin’s-secret-password

Again to confirm: your-admin’s-secret-password

Is the above data correct?

(y or n):y

Administrator account created

root@DSPACE-TEST-01:/dspace/bin#

Check for proper connections in dspace.cfg

vi /dspace/config/dspace.cfg

You can

also keep your changes in dspace.cfg in [dspace-source]/dspace/config/. Whenever you edit dspace.cfg in [dspace-source]/dspace/config/, you should then run 'ant init_configs' in the directory [dspace-source]/dspace/target/dspace-1.5.2-build.dir so that any

changes you may have made are reflected in the configuration files of other applications, for example Apache. You may then need to restart those applications, depending on what you changed.

In 1.5.2 the default behavior of the "update" will check the checksums/file sizes of the installation configuration files in

“[dspace]/config” and will put a new configuration file example in “<filename>.new” if there is any difference. The end of the update process will list all the configuration files for which this happened, you should review those configuration files and merge each of them by hand to make sure you do not miss any new configuration requirements. Its recommended that you take the new file, place any changes you had made in the old file into it, delete the old and rename the new.

== ^^^^ The suggestions above [didn't solve my issues] ^^^^ ==

== And further, the changes made to the structure of the site directories ==

== was not entirely as advertised in the documentation ==

Editing Site Details

This is not a complete dspace.cfg manual, but just a set of comments for the directives I changed.

1. edit /dspace/config/dspace.cfg

# Basic Information – Site globals

# These directives give the site details so the web apps can find their own installation.

dspace.dir = /dspace

# or whatever directory path your dspace install is in.

# never put comments like this on command lines like the “dspace.dir =” line above it will cause lots of problems, even though it is a comment and the system should not be able to read anything after a ‘#.’

dspace.hostname = example.com

# dspace is looking for your public IP address (which works) or a fully qualified domain name (FQDN)

dspace.baseUrl =

http://example.com:8080

# include the http:// and the port number “:8080.” It makes the next few parts make more sense.

dspace.url =

${dspace.baseUrl}/xmlui

# The ${whatever} structure is how this script uses the variable whose value you set in the previous command and adds the front-end app of your choice

dspace.oai.url =

${dspace.baseUrl}/oai

# This is for using the Open Archives Interface, the set-up of which is described here:

https://wiki.duraspace.org/display/DSPACE/Use+the+OAI-PMH+interface.

Currently not in use on the Lyrasis DSspace Demo

dspace.name = “DSpace Demo at Lyrasis”

# Any string of characters can be used here. This should be a human-readable string.

# Database settings

db.name = postgres

# The other choice here is “oracle.”

db.url =

jdbc:postgresql://192.168.10.22:5432/dspace

# The part after the double-slash (//) will be the server wherever your database is, including the port at which the database is listening “:5432″ and the database name itself “/dspace.”. In the case above, we used the private IP network to talk to a dedicated database server. You could have the database on the same machine as yours, and in that case the line would look more like

jdbc:postgresql://localhost:5432/dspace

db.driver = org.postgresql.Driver

db.username = dspace

it is common to have the same name for your database and the user who has control of that database.

db.password =

whatever_password_you_chose

[skipping a few directives that will have probably been set up automagically]

# SMTP Mail server

# It is probably a good idea to have a genaric role-based email

here, like “support@your_domain.org”

# This will be the same email address you set up in your ticketing system for people to send in requests for maintenance or service.

# File Storage

assetstore.dir

${dspace.dir}/assetstore

# This directory maps to our /dspace/assetstore/ directory. You need to have this directory be owned by your appserver – in our case that is “tomcat6.” I tried to have tomcat6 be a member of the dspace group, and making the group able to write to this folder. It was easier, by far, just to give the entire /dspace directory to the ownership of tomcat6, as was shown above.

This failed, so I ran

# chown -R tomcat6:www-info /dspace

# chmod 775 /dspace/assetstore

# The /dspace/uploads folder has to be treated similarly

When you have gotten your configurations properly done, you will be able to log into

http://yourdomain.org:8080/xmlui

as your administrative user, after which your admin user will be able to make new users inside of DSpace and give them administrative powers.

15 comments

  • hi, I am a librarian at the Indian Institute of Geomagnetism, Navi Mumbai, India, and a complete novice to linux. recently we have been asked to upgrade our libraries and have an institutional repositories. I have attended a basic program for installing dspace however, that program only made me familiar with the basic installation procedures. i have been studying the installation procedures for centos, red-hat linux and fedora, however, i feel ubuntu offers a one stop solution to installing dspace. as a first-timer with very basic knowledge of linux, would I be able to install dspace 1.7.2 on ubuntu 10.04 (LTS), using the commands given in your blog? could you please help me ?

  • Hi Smita,
    I am a Linux administrator for Lyrasis.org and because I work with libraries to set up their repositories and digital catalogs, I have had the chance to put together several of these dspace repositories, both from a single-server set-up, like the above how-to article shows and as a multi-server set-up with the database on a different machine.
    The how-to above should take you there. I wrote it initially as internal documentation for Lyrasis, but decided to publish to this blog to be of use to people like you who are tasked with doing installations on their own, without professional help.
    I agree with you as to the choice of Ubuntu 10.04(LTS). From my experience, it works well. It is more well-documented than CentOS, RHEL or Fedora, and the testing is better documented. I feel sure you can do it. It may take several tries, as it did for me, at first, but don’t give up.

  • Like your how-to. Do u have more of these steps to install on other Linux OS

  • Great! Thanks for the codes.
    Jason´s last blog post ..anti aging treatment

  • hi wolf halton i need your help this is my 8 times installing dspace on my ubuntu server 10.04 lts and i always encountering problem in the installation on this particular part

    # cd dspace-1.7.2-src-release
    # mvn -U package

    on this area i got an error with it “compilation failure”

    ###############################################
    INFO] Compilation failure
    Unable to locate the Javac Compiler in:
    /usr/lib/jvm/java-6-openjdk/jre/../lib/tools.jar
    Please ensure you are using JDK 1.4 or above and
    not a JRE (the com.sun.tools.javac.Main class is required).
    In most cases you can change the location of your Java
    installation by setting the JAVA_HOME environment variable.

    ########################################################

    please help me and looking for your fast response thank you

  • The install process with dspace is a little frustrating, isn’t it?

    1. Do you have JDK 1.4 or newer?
    2. It is hard to tell if the path listed in the error message’s info section is an actual path in your system or the “optimal” expected path.
    3. Since DSpace 1.8.2 is out, you might want to use the newest version.
    4. Since Ubuntu 21.04LTS has been released, it might simplify your upgrade path to upgrade the OS first. Depending upon your specific situation it might not be simpler at all.

    Let me know the answers to these questions.

  • after i do this:
    # cd dspace-1.7.2-src-release
    # mvn -U package
    # cd dspace/target/dspace-1.7.2-build.dir
    and do this:
    # ant fresh_install

    it show message like this:
    Buildfile: /build/dspace-1.7.2-src-release/dspace/target/dspace-1.7.2-build.dir/build.xml

    init_installation:

    init_configs:

    test_database:
    [java] 2012-11-23 11:30:07,073 INFO org.dspace.core.ConfigurationManager @ Loading system provided config property (-Ddspace.configuration): config/dspace.cfg
    [java]
    [java] Error:
    [java] – org.postgresql.util.PSQLException: FATAL: password authentication failed for user “dspace”
    [java]
    [java] Please see the DSpace do2012-11-23 11:30:07,080 INFO org.dspace.core.ConfigurationManager @ Using default log4j provided log configuration,if unintendecumentation for assistance.
    [java]
    [java] d, check your dspace.cfg for (log.init.config)
    [java]
    [java] Attempting to connect to database:
    [java] – URL: jdbc:postgresql://localhost:5432/dspace
    [java] – Driver: org.postgresql.Driver
    [java] – Username: dspace
    [java] – Password: dspace
    [java] – Schema: null
    [java]
    [java] Testing connection…

    BUILD FAILED
    /build/dspace-1.7.2-src-release/dspace/target/dspace-1.7.2-build.dir/build.xml:747: Java returned: 1

    what i must do?

  • Baktilast:
    It looks like you left out the step of making the database user “dspace.” I may have typo’ed the line you needed. [I did, in fact lose a line return between postgres and createuser. I am fixing it right now.]

    “[java] – org.postgresql.util.PSQLException: FATAL: password authentication failed for user ‘dspace”"

    This is telling you where the issue is. If you made the user “dspace” postgresql asked you for a password, and if you remember following this instruction,

    “Create the database user (dspace)
    # su – postgres
    $ createuser -U postgres -d -A -P dspace”
    $ exit

    Then you have a password for that user.

  • I would like to add that we can also create multiple tomcat instances by using the java based portable utility which I developed for automating the steps required to edit the server config files.

  • Till installation i have done successfully. Now I have to install the collections from our journal and theses abstracts. What should i do further. pl. guide me.

    Bhosle

  • https://wiki.duraspace.org/display/DSPACE/Home may be helpful to you. We used both the front-end loader for single item installs and a very customized proprietary bulk-loader. I cannot give you the bulk-loader, but there may be some in the wiki that can do that. I no longer work for the company that owns the bulk-loader.

    As always, best of luck.
    Since the DSpace and Fedora projects have merged, there may be a better bulk-loader coming, but I haven’t been actively using DSpace for about 3 months.
    Wolf Halton´s last blog post ..Debian Wheezy is Released

  • Greetings! Very useful advice in this particular post! It’s the little changes which will
    make the biggest changes. Many thanks for sharing!
    Marylou´s last blog post ..Marylou

  • Great info. Lucky me I found your site by accident (stumbleupon).
    I’ve saved it for later!

  • Wow, awesome blog layout!How long have you been blogging for?
    you make blogging llok easy. The overall look of your web site is fantastic, let alone
    the content!

  • Thanks! I like the custom doodle idea you are doing. I have see them on several sales sites. They make the site or product seem very friendly.

Leave a Reply