Installation on Dspace on Ubuntu 18.04 LTS
Login as root
sudo su
Enter password
Update the Ubuntu : apt-get update
Install OpenJDK 8 : apt-get install openjdk-8-jdk
Apache Maven 3.x (Java build tool) and Apache ant : apt-get install ant maven
Relational Database (PostgreSQL) : apt-get install postgresql
Servlet Engine (Apache Tomcat 8) : apt-get install tomcat8
Note: it is advisable to select from package list tomcat java server, postgresql and openssh-server during installation of Ubuntu server operating system.
Create Dspace user
useradd -m dspace
passwd dspace [enter a password for the new user dspace]
mkdir /dspace
chown dspace /dspace
Configure Postgresql and Create Database
- Create the PostgreSQL "dspace" user
Log in to postgresql:
sudo su postgres
Next, we will create a database called “dspace” and database user called “dspace” with password “dspace”. Don’t confuse database user with normal user. Both are different.
createuser -U postgres -d -A -P dspace
Enter password for new role: ## Enter password for the user dsapce
Enter it again: ## Re-enter password
If asked the following:
Shall the new role be allowed to create more new roles? (y/n) y
Answer "y" for yes.
Than type exit and come to root
Open up the /etc/postgresql/10/main/pg_hba.conf file:
nano /etc/postgresql/10/main/pg_hba.conf
Add the following line shown in red color at last of the file.
local all dspace md5
Type the following to restart:
/etc/init.d/postgresql restart
Create the PostgreSQL 'dspace' database
Login as:
sudo su dspace
createdb -U dspace -E UNICODE dspace
Than type exit and come to root
sudo su postgres
Now type the following command to create extension pgcrypto
psql
--username=postgres dspace -c "CREATE EXTENSION pgcrypto;"
Type the following to restart postgres:
/etc/init.d/postgresql restart
NOTE: while deleting or creating the database log in to the concern user, like for dspace user (sudo su dspace) than apply the commands
exit
go to root
Create Dspace directory
mkdir /build
chmod -R 777 /build
cd /build
Download Dsapce to /build directory
You can check latest version of Dspace from here.
Run the command mentioned below at command prompt. (Ensure that Internet is working).
tar -zxf dspace-6.2-src-release.tar.gz
cd /build/dspace-6.2-src-release
mvn -fn package
(Please note in case of build failure delete the following lines from /build/dspace-6.0-src-release/dspace-api/pom.xml its due to some known Bug)
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>
cd dspace/target/dspace-installer
ant fresh_install
Configure Tomcat
nano /etc/tomcat8/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="/solr" docBase="/dspace/webapps/solr" allowLinking="true"/>
Than close the file
OR
You may use the below method also to configure the Tomcat instead of inserting the above text in server.xml file
copy any web applications from /dspace/webapps/ to the appropriate place for your servlet container. For example, ‘$CATALINA_HOME/webapps’ for Tomcat.
First set the environment variables to Tomcat server.
Edit file /etc/profile,
nano /etc/profile
Add the following lines at the end:
export CATALINA_BASE=/var/lib/tomcat8
export CATALINA_HOME=/usr/share/tomcat8
Save and close the file. Then, run the following command to take effect the environment variables settings.
source /etc/profile
Now, copy the dspace/webapps directory contents to the tomcat webapps directory.
sudo cp -r /dspace/webapps/* $CATALINA_BASE/webapps/
Java environment settings for Tomcat webapp server/ JVM memory (heap) setting
nano /etc/default/tomcat8
# You may pass JVM startup parameters to Java here. If unset, the default
# options will be: -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC
JAVA_OPTS="-Djava.awt.headless=true –Xmx768m –Xms128m -XX:MaxPermSize=1024m"
# Use "-XX:+UseConcMarkSweepGC" to enable the CMS garbage collector (improved
# response time). If you use that option and you run Tomcat on a machine with
# exactly one CPU chip that contains one or two cores, you should also add
# the "-XX:+CMSIncrementalMode" option.
JAVA_OPTS="-Djava.awt.headless=true -Xmx512m -XX:+UseConcMarkSweepGC"
nano /etc/init.d/tomcat8
# Default Java options
# Set java.awt.headless=true if JAVA_OPTS is not set so the
# Xalan XSL transformer can work without X11 display on JDK 1.4+
# It also looks like the default heap size of 64M is not enough for most cases
# so the maximum heap size is set to 128M
if [ -z "$JAVA_OPTS" ]; then
JAVA_OPTS="-Djava.awt.headless=true -Xmx1024M"
Java environment settings for other java web applications
nano /etc/environment
Add the below line in the file:
JAVA_HOME="/usr/lib/jvm/default-java"
JAVA_OPTS="-Djava.awt.headless=true -Xmx1024m -Xms512m -Dfile.encoding=UTF-8"
Fix Tomcat permissions, and restart the Tomcat server
chown tomcat8:tomcat8 /dspace -R
Restart Tomcat
/etc/init.d/tomcat8 restart
Make an initial administrator account (an e-person) in DSpace:
/dspace/bin/dspace create-administrator
It will ask to enter email address for user login. Enter an email address (e.g. dspace@localhost).
Enter First name and surename (e.g. dspace)
Enter a password.
View the installed default DSpace interface.
You can load either one Dspace interface in a browser.
http://localhost:8080/xmlui