Showing posts with label DSpace installation. Show all posts
Showing posts with label DSpace installation. Show all posts

Saturday, May 19, 2012

AgriOcean DSpace: Easy Install on Windows and Linux

Installing DSpace could be difficult sometimes, specially with Java and Maven issues popping up every now and then. That is why I am so thankful to those who have produced ready to use working LiveCD and LiveDVD with DSpace and other software like Koha, Greenstone, and WordPress. However, for those who wants an easier experience in installing DSpace, there is a pre-compiled DSpace instance called AgriOcean DSpace available.

AgriOcean DSpace is a customized version of DSpace1.7.1 (JSPUI version), made available through a joint initiative of the United Nations agencies of FAOand UNESCO-IOC/IODE. Even though it is set up for the digital repository communities of AGRIS(FAO) and Odin(UNESCO-IOC),  other institutes specially those are in the field of oceanography, agriculture and related sciences, can use it to make their scientific literature available in digital form. More information can be found at http://aims.fao.org/agriocean-dspace

You can download the easy install Windows version and the Linux version along with the install guide for the respective OS at Google code - http://code.google.com/p/agriocean/downloads/list. So for whatever purposes go ahead, download it and play with it. Better yet join the community, so you can share your experience with everybody else, I for one wouldn't mind hearing from those who tested it.

AgriOcean DSpace on GSDLKOha LiveCD

I also managed to install AgriOcean DSpace Linux version at our GSDLKoha LiveCD running on hard disk following the installation guide at Google code. It was relatively easy to install because I didn't have to wrangle with Maven. However, it doesn't come with XMLUI, so if you are planning to use modules that requires XMLUI, like Vireo for eTheses submission and management, this won't be useful to you.

Multiple DSpace in one Tomcat server

In case you are wondering, yes it is possible to have multiple instance of DSpace in one server using one Tomcat. Just make sure that you have separate database, and ideally different install source for each instance. Read for more information - Setting up multiple DSpace instances in one Tomcat Server.
https://wiki.duraspace.org/display/DSPACE/MultipleDspaceOneServer

Driven by my inquisitive nature, I decided to test it out. Happy to say that I was successful in setting up two distinct DSpace instance : AgriOcean and DSpace 1.8.2, in one server. The LiveDVD iso that I created and currently testing have these two DSpace running, together with the rest of the other software pre-installed in the GSDLKoha LiveDVD. The only change I made is to use 8181 as my Tomcat port because 8080 is used by my Internet proxy.

I would be releasing this LiveDVD iso on Sourceforge, after running all the tests on VirtualBox, and hearing from the people who created GSDLKoha LiveCD, in order to give full credit to all their hard work on the GSDLKoha LiveCD. My goal is just to add DSpace to GSDLKoha LiveCD and make it available for those who wish to use it (like me) with the rest of all the wonderful software in it. For people who are only interested in using just DSpace or Koha there, are existing LiveCDs that would meet their needs. That would be the subject of my next blog.

Wednesday, May 16, 2012

Installing Dspace on GSDLKoha LiveCD Powered by Lubuntu 11.04

After testing the GSDLKoha LiveCD, I decided to install it in our development server - HP Proliant DL380 G7.

I am happy with it because it runs lots of library application software that I am testing and evaluating. However it lacks DSpace. I don't want to run and maintain two development servers, so I decided to install DSpace in this GSDLKoha instance.

The GSDLKoha LiveCd is running on Lubuntu 11.04 (Ubuntu variant using LXDE), so I followed the installation notes in the DuraSpace wiki on Installing DSpace 1.7.2 on Ubuntu. https://wiki.duraspace.org/display/DSPACE/Installing+DSpace+1.7+on+Ubuntu

The following is a modified version of that installation to address the bumps and mishaps along the way.

Installing Dspace on GSDLKoha LiveCD


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

sudo apt-get install tasksel

sudo tasksel

    Select the following packages (select and click spacebar)
    [*] PostgreSQL database
    [*] Tomcat Java server

Install the Compile / Build tools
sudo apt-get install ant maven2

Create the database user (dspace)

sudo su postgres
createuser -U postgres -d -A -P dspace
exit

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

sudo vi /etc/postgresql/9.1/main/pg_hba.conf

# Add this line to the configuration:
 local all dspace md5

sudo service postgresql restart

Create the dspace database

createdb -U dspace -E UNICODE dspace

Configure Tomcat to know about the DSpace webapps.
sudo vi /etc/tomcat6/server.xml

# Insert the following chunk 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.
sudo mkdir /dspace

Change the ownership and permissions of the [dspace] directory from the Ubuntu user (currently logged in) to the Tomcat user created by the installation process using taskskel.
To know/set/change the default tomcat user sudo vi /etc/tomcat6/tomcat-users.xml
chown -R <Ubuntu-user>:<tomcat-user> /dspace
chmod -R 775 /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].

cd /dspace
wget http://sourceforge.net/projects/dspace/files/DSpace%20Stable/1.8.2/dspace-1.8.2-src-release.tar.bz2
tar -xvjf dspace-1.8.2-src-release.tar.bz2

edit DSpace configuration particularly the database user and password before compiling. You can also make other changes (email, port number ...)

sudo vi /dspace/config/dspace.cfg

##### Basic information ######

# DSpace installation directory
dspace.dir = /dspace

# DSpace host name - should match base URL.  Do not include port number
dspace.hostname = localhost

# DSpace base host URL.  Include port number etc.
dspace.baseUrl = http://localhost:8080

# DSpace base URL.  Include port number etc., but NOT trailing slash
# Change to xmlui if you wish to use the xmlui as the default, or remove
# "/jspui" and set webapp of your choice as the "ROOT" webapp in
# the servlet engine.
dspace.url = ${dspace.baseUrl}/xmlui

# Name of the site
dspace.name = DSpace at My University (name or Title of Your Repository)

##### Database settings #####

# Database name ("oracle", or "postgres")
db.name = postgres
#db.name = postgres
#db.name = oracle

# URL for connecting to database
db.url = jdbc:postgresql://localhost:5432/dspace
#db.url = jdbc:postgresql://localhost:5432/dspace

# JDBC Driver
db.driver = org.postgresql.Driver
#db.driver = org.postgresql.Driver

# Database username and password
db.username = dspace
db.password = (password you gave to dspace [database user])
#db.username = dspace
#db.password = dspace

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.    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.8.2-src-release
mvn -U -e package (-e will show errors if there are any)

I encountered three errors that I have to fix before it can compile. There were files reported missing.
1) org.apache.zookeeper:zookeeper:jar:3.3.1
2) org.codehaus.woodstox:wstx-asl:jar:3.2.7
I tried downloading it from their website and installed it manually. It didn't work, I guess because of version incompatibilty. Apache zookeeper 3.3.1 is no longer avaiable on the website so I used another version, which resulted reading /compilation error during build.

I solved this by searching and downloading the files from a Maven repository http://mvnrepository.com/
wget http://repo1.maven.org/maven2/org/apache/zookeeper/zookeeper/3.3.1/zookeeper-3.3.1.jar
wget http://repo1.maven.org/maven2/org/codehaus/woodstox/wstx-asl/3.2.7/wstx-asl-3.2.7.jar

Then I installed it using Maven (note that in my case the downloaded file is in /dspace) change the path-to-file to point it to the right directory if you placed the download in a different directory
mvn install:install-file -DgroupId=org.apache.zookeeper -DartifactId=zookeeper -Dversion=3.3.1 -Dpackaging=jar -Dfile=/dspace/zookeeper-3.3.1.jar
mvn install:install-file -DgroupId=org.codehaus.woodstox -DartifactId=wstx-asl -Dversion=3.2.7 -Dpackaging=jar -Dfile=/dspace/wstx-asl-3.2.9.jar

Run this code to  check for any unresolved dependency (found another one missing)
mvn dependency:list

Misssing file
1) com.yahoo.platform.yui:yuicompressor:jar:2.3.6

To resolve download manually and install
wget http://repo1.maven.org/maven2/com/yahoo/platform/yui/yuicompressor/2.3.6/yuicompressor-2.3.6.jar
mvn install:install-file -DgroupId=com.yahoo.platform.yui -DartifactId=yuicompressor -Dversion=2.3.6 -Dpackaging=jar -Dfile=/dspace/yuicompressor-2.3.6.jar

Compile using Maven
mvn -U -e package

if successful compile you would see this at the terminal
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20 minutes 25 seconds
[INFO] Finished at: Thu May 17 11:21:57 PHT 2012
[INFO] Final Memory: 163M/466M
[INFO] ------------------------------------------------------------------------

Build using Ant
cd dspace/target/dspace-1.8.2-build.dir
sudo ant fresh_install

if successful
[echo]  The DSpace code has been installed, and the database initialized.
     [echo]
     [echo]  To complete installation, you should do the following:
     [echo]
     [echo]  * Setup your Web servlet container (e.g. Tomcat) to look for your
     [echo]    DSpace web applications in: /dspace/webapps/
     [echo]
     [echo]    OR, copy any web applications from /dspace/webapps/ to
     [echo]    the appropriate place for your servlet container.
     [echo]    (e.g. '$CATALINA_HOME/webapps' for Tomcat)
     [echo]
     [echo]  * Make an initial administrator account (an e-person) in DSpace:
     [echo]
     [echo]    /dspace/bin/dspace create-administrator
     [echo]
     [echo]  * Start up your servlet container (Tomcat etc.)
     [echo]
     [echo]  You should then be able to access your DSpace's 'home page':
     [echo]
     [echo]    http://localhost:8080/xmlui
     [echo]
     [echo]  You should also be able to access the administrator UI:
     [echo]
     [echo]    http://localhost:8181/xmlui/dspace-admin
     [echo] ====================================================================
     [echo]        

BUILD SUCCESSFUL
Total time: 29 seconds

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.

sudo chown tomcat6:tomcat6 /dspace -R

sudo service tomcat6 restart

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

Create Administrator

cd /dspace/bin
sudo ./dspace create-administrator

(prompt would look like)
Creating an initial administrator account
E-mail address: <your email>
First name: <your name>
Last name: <last name>
WARNING: Password will appear on-screen.
Password: <your password>
Again to confirm: <your password>
Is the above data correct? (y or n): y
Administrator account created
***@***:/dspace/bin$

It is now time to tinker with the configuration and administration of my new Dspace 1.8.2. Next project creation of integrated GSDLKoha + DSpace LiveCD iso.

Fell free to comment or report any errors or difficulties in following this install guide.