Friday, October 30, 2009

DSpace 1.5.2 installation procedure on CentOS 5.3

DSpace 1.5.2 installation procedure on CentOS 5.3
I have just complete a clean install of DSpace 1.5.2 on a CentOS 5.3 box.

Here is the installation process I followed:

Login as the root user and download dspace to /root:
lynx http://sourceforge.net/project/showfiles.php?group_id=19984%20%20

Create an account for the dspace user:
useradd dspace
passwd dspace

JAVA JDK

As root, and in the root users home directory, download the JDK from Sun and install it using the following commands:

https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jdk-6u13-oth-JPR@CDS-CDS_Developer


chmod 755 jdk-6u13-linux-i586-rpm.bin\&File\=jdk-6u13-linux-i586-rpm.bin
./jdk-6u13-linux-i586-rpm.bin\&File\=jdk-6u13-linux-i586-rpm.bin

Edit /etc/profile and set the JAVA_HOME variable as follows:

JAVA_HOME=/usr/java/jdk1.6.0_13
export JAVA_HOME
PATH=${PATH}:${JAVA_HOME}/bin
export PATH

Change the symlink for Java to point to the new location:

rm /usr/bin/java
ln -siv /usr/java/jdk1.6.0_13/bin/java /usr/bin/java

The java -version command will now produce the following output:

java version "1.6.0_13"
Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)


Download and install maven and ant:
cd /root
lynx http://maven.apache.org/download.html
mkdir /usr/local/apache-maven
mv apache-maven-2.1.0-bin.tar.gz /usr/local/apache-maven/
cd /usr/local/apache-maven
tar -xzvf apache-maven-2.1.0-bin.tar.gz

Apache Ant
cd /usr/local
lynx http://ant.apache.org/bindownload.cgi
mv /root/apache-ant-1.7.1-bin.tar.gz .
tar -xzvf apache-ant-1.7.1-bin.tar.gz

Add paths to /etc/profile:
nano /etc/profile

Add the following:
M2_HOME=/usr/local/apache-maven/apache-maven-2.1.0
export M2_HOME
MAVEN_OPTS="-Xms256m -Xmx512m"
export MAVEN_OPTS
M2=$M2_HOME/bin
export M2
PATH=${PATH}:${M2}
ANT_HOME=/usr/local/apache-ant-1.7.1
export ANT_HOME
PATH=${PATH}:${ANT_HOME}/bin
export PATH

Logout and log back in again so that the environment variables from /etc/profile are applied.

Check that maven and ant are installed:

mvn --version
Apache Maven 2.1.0 (r755702; 2009-03-18 19:10:27+0000)
Java version: 1.6.0_13
Java home: /usr/java/jdk1.6.0_13/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.18-92.1.22.el5xen" arch: "i386" Family: "unix"

ant -version
Apache Ant version 1.7.1 compiled on June 27 2008

Install the postgresql database and configure postgresql:

yum install postgresql postgresql-server
chkconfig --level 2345 postgresql on
service postgresql start

nano /var/lib/pgsql/data/postgresql.conf
For 8.0+, in
postgresql.conf uncomment the line starting:
listen_addresses = 'localhost'
#---------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#---------------------------------------------------------------------------
# - Connection Settings -
listen_addresses = 'localhost' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all

nano /var/lib/pgsql/data/pg_hba.conf

Then don't tighten up security a bit by editing
pg_hba.conf as the default file is already too restrictive to allow creation of the dspace database. Just enter the following contents into the actual configuration section of the file and delete everything else from this section.

# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust

Check the databases already present:
su - postgres
-bash-3.2$ psql -l
List of databases
Name | Owner | Encoding
-----------+----------+----------
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(3 rows)

Create the user and database:
-bash-3.2$ createuser -U postgres -d -A -P dspace
Enter password for new role: XXXX
Enter it again: XXXX
Shall the new role be allowed to create more new roles? (y/n) n
CREATE ROLE
-bash-3.2$ createdb -U dspace -E UNICODE dspace
CREATE DATABASE

-bash-3.2$ psql -l
List of databases
Name | Owner | Encoding
-----------+----------+----------
dspace | dspace | UTF8
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8

service postgresql stop
Stopping postgresql service: [ OK ]
service postgresql start
Starting postgresql service: [ OK ]

nmap 127.0.0.1
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2009-04-10 08:47 BST
Interesting ports on localhost.localdomain (127.0.0.1):
Not shown: 1667 closed ports
PORT STATE SERVICE
25/tcp open smtp
80/tcp open http
443/tcp open https
631/tcp open ipp
3306/tcp open mysql
4444/tcp open krb524
5432/tcp open postgres
5801/tcp open vnc-http-1
5901/tcp open vnc-1
6001/tcp open X11:1
8009/tcp open ajp13
8080/tcp open http-proxy
9090/tcp open zeus-admin
Nmap finished: 1 IP address (1 host up) scanned in 0.120 seconds

As the root user, download and install Tomcat:

cd /root
lynx http://tomcat.apache.org/download-60.cgi
cp apache-tomcat-6.0.18.tar.gz /home/dspace
cd /home/dspace
chown dspace:dspace apache-tomcat-6.0.18.tar.gz
su - dspace
tar -xzvf apache-tomcat-6.0.18.tar.gz
exit

nano /etc/profile
and append the following lines:

JAVA_OPTS="-Xmx512M -Xms64M -Dfile.encoding=UTF-8"
export JAVA_OPTS

Here I tell DSpace/Tomcat to listen on port 8081 and AJP connector port 8010 (I have to do this as JBoss Tomcat used with LAMS is already listening on 8080 and 8009):

su - dspace
rm -rf apache-tomcat-6.0.18.tar.gz
cd apache-tomcat-6.0.18/conf
nano server.xml
In server.xml change any references to port 8080 to port 8081 and any references for port 8009 to port 8010.

cd /home/dspace/apache-tomcat-6.0.18/bin
./startup.sh
Using CATALINA_BASE: /home/dspace/apache-tomcat-6.0.18
Using CATALINA_HOME: /home/dspace/apache-tomcat-6.0.18
Using CATALINA_TMPDIR: /home/dspace/apache-tomcat-6.0.18/temp
Using JRE_HOME: /usr/java/jdk1.6.0_13

Just to confirm that DSpace/Tomcat is listening on port 8081:

nmap 127.0.0.1
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2009-04-11 17:08 BST
Interesting ports on localhost.localdomain (127.0.0.1):
Not shown: 1666 closed ports
PORT STATE SERVICE
25/tcp open smtp
80/tcp open http
443/tcp open https
631/tcp open ipp
3306/tcp open mysql
4444/tcp open krb524
5432/tcp open postgres
5801/tcp open vnc-http-1
5901/tcp open vnc-1
6001/tcp open X11:1
8009/tcp open ajp13
8080/tcp open http-proxy
8081/tcp open blackice-icecap
9090/tcp open zeus-admin

./shutdown.sh
Using CATALINA_BASE: /home/dspace/apache-tomcat-6.0.18
Using CATALINA_HOME: /home/dspace/apache-tomcat-6.0.18
Using CATALINA_TMPDIR: /home/dspace/apache-tomcat-6.0.18/temp
Using JRE_HOME: /usr/java/jdk1.6.0_13

Now install DSpace:

su - root
cd /root
cp dspace-1.5.2-release.tar.gz /home/dspace
cd /home/dspace
chown dspace:dspace dspace-1.5.2-release.tar.gz


tar -xzvf dspace-1.5.2-release.tar.gz
cd dspace-1.5.2-release/dspace/config
nano dspace.cfg

The configuration settings shown below in dspace.cfg are just the settings I either changed or uncommented in the default file:

dspace.dir = /home/dspace
dspace.url = http://vleinternal.bromley.ac.uk/jspui
dspace.hostname = vleinternal.bromley.ac.uk
dspace.name = DSpace for eLearning Evaluation at Bromley College
db.name = postgres
db.url = jdbc:postgresql://localhost:5432/dspace
db.driver = org.postgresql.Driver
db.username = dspace
db.password = XXXX
mail.server=vleinternal.bromley.ac.uk
mail.from.address = dspace-noreply@vleinternal.bromley.ac.uk
feedback.recipient = dspace-help@vleinternal.bromley.ac.uk
mail.admin = dspace-help@vleinternal.bromley.ac.uk
default.language = en_GB

cd ..
mvn package
A lot of information now appears on the screen. Below are shown the last lines confirming success:
[INFO] Copying 861 files to /home/dspace/dspace-1.5.2-release/dspace/target/dspace-1.5.2-build.dir
[INFO]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] ------------------------------------------------------------------------
[INFO] DSpace Addon Modules .................................. SUCCESS [30.453s]
[INFO] DSpace XML-UI (Manakin) :: Web Application ............ SUCCESS [1:14.611s]
[INFO] DSpace LNI :: Web Application ......................... SUCCESS [10.261s]
[INFO] DSpace OAI :: Web Application ......................... SUCCESS [6.427s]
[INFO] DSpace JSP-UI :: Web Application ...................... SUCCESS [8.017s]
[INFO] DSpace SWORD :: Web Application ....................... SUCCESS [5.869s]
[INFO] DSpace Assembly and Configuration ..................... SUCCESS [43.018s]
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 minutes 59 seconds
[INFO] Finished at: Sun Apr 12 07:40:07 BST 2009
[INFO] Final Memory: 25M/255M
[INFO] ------------------------------------------------------------------------

exit

Now to set up postgresql to allow access to the dspace database:
nano /var/lib/pgsql/data/pg_hba.conf
Add the following line to end of the file:

host dspace dspace 127.0.0.1 255.255.255.255 md5

service postgresql restart

su - dspace
cd /home/dspace/dspace-1.5.2-release/dspace/target/dspace-1.5.2-build.dir
ant fresh_install
A lot of information now appears on the screen. Below are shown the last lines confirming success:
[echo] ====================================================================
[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: /home/dspace/webapps/
[echo]
[echo] OR, copy any web applications from /home/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] /home/dspace/bin/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://vleinternal.bromley.ac.uk/dspace
[echo]
[echo] You should also be able to access the administrator UI:
[echo]
[echo] http://vleinternal.bromley.ac.uk/dspace/dspace-admin
[echo] ====================================================================
[echo]
BUILD SUCCESSFUL

cd /home/dspace/apache-tomcat-6.0.18/conf
nano server.xml and add the following to the end of the host section:
Note that the standard html opening and closing tag braces have been replaced by {} in this blog purely for display purposes.

{!-- DEFINE A CONTEXT PATH FOR DSpace JSP User Interface --}
{Context path="/jspui" docBase="/home/dspace/webapps/jspui" debug="0"
reloadable="true" cachingAllowed="false"
allowLinking="true"/}
{!-- DEFINE A CONTEXT PATH FOR DSpace OAI User Interface --}
{Context path="/oai" docBase="/home/dspace/webapps/oai" debug="0"
reloadable="true" cachingAllowed="false"
allowLinking="true"/}

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

/home/dspace/apache-tomcat-6.0.18/bin
./shutdown.sh
./startup.sh

Now visit http://127.0.0.1:8081/jspui from the browser and it works !!!!!!