LINUX, FOSS AND LIBRARY TECHNOLOGY ENTHUSIAST

Monday, June 29, 2020

Install DSpace 6.3 on Ubuntu 20.04 LTS

16 comments

This is an updated blog post over Installation of DSpace 6.3 on Ubuntu 18.04.1 LTS, in that, we learned how to install DSpace on Ubuntu 18.04 LTS. This is the tutorial on Ubuntu 20.04 LTS. 


Hardware Recommendations

Recommended hardware as a DSpace server.


Minimum DSpace Production

3-4GB RAM

20GB Storage


Mid-range DSpace Production

5-6GB RAM

200GB Storage


High-end DSpace Production

9-10GB RAM

1TB Storage


Software Requirements

Software needed to run DSpace.

  • Java JDK 8
  • Apache Maven
  • Apache Ant
  • PostgreSQL
  • Apache Tomcat


Create User

Create a dspace user.


sudo useradd -m dspace

sudo passwd dspace


Install PostgreSQL

Install PostgreSQL database.


sudo apt install postgresql postgresql-client -y


Create a dspace user with a dspace password in PostgreSQL.


sudo su postgres

createuser -U postgres -d -A -P dspace

exit


Create a dspace database .


sudo -u dspace createdb -U dspace -E UNICODE dspace


Activate the pgcrypto extension.


sudo su postgres

psql --username=postgres dspace -c "CREATE EXTENSION pgcrypto;"

exit


Open the PostgreSQL configuration file.


sudo nano /etc/postgresql/12/main/pg_hba.conf


Add the following line at the bottom of the configuration.


local  all  dspace  md5


Restart PostgreSQL.


sudo systemctl restart postgresql

sudo systemctl status postgresql


Building DSpace

Install OpenJDK 8.


sudo apt install openjdk-8-jdk -y


If you have previously installed another version of OpenJDK, change the default java to OpenJDK 8.


sudo update-alternatives --config java


Install ant and maven.


sudo apt install ant maven -y


Create a dspace folder.


sudo mkdir /dspace

sudo chown dspace /dspace


Create a build folder for building DSpace.


sudo mkdir /build

sudo chmod -R 777 /build

cd /build


Download DSpace 6.3 from GitHub 


wget https://github.com/DSpace/DSpace/releases/download/dspace-6.3/dspace-6.3-src-release.tar.gz


Extract dspace*.tar.gz


sudo tar xzvf dspace*.tar.gz


Move to the dspace-6.3-src-release folder


cd dspace-6.3-src-release


Copy the local.cfg file.


sudo cp dspace/config/local.cfg.EXAMPLE dspace/config/local.cfg


Compile the DSpace package.


sudo mvn -U package


Install DSpace.


cd dspace/target/dspace-installer

sudo ant fresh_install


Install Apache Tomcat

Download and extract Apache Tomcat 9.


cd /opt

sudo wget https://downloads.apache.org/tomcat/tomcat-9/v9.0.41/bin/apache-tomcat-9.0.41.tar.gz

sudo tar xzvf apache-tomcat-9.0.41.tar.gz


Change the apache-tomcat-9.0.41 folder to tomcat.


sudo mv apache-tomcat-9.0.41 tomcat


Open the file /etc/profile.


sudo nano /etc/profile


Add these lines at the bottom, configuration environment variables for Java.


export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64

export CATALINA_HOME=/opt/tomcat


Copy dspace webapps to tomcat webapps.


sudo cp -r /dspace/webapps/* /opt/tomcat/webapps


Create a bash script so that Tomcat can run automatically.


sudo nano /etc/init.d/tomcat


Enter the following bash script.


#!/bin/bash

### BEGIN INIT INFO

# Provides:        tomcat8

# Required-Start:  $network

# Required-Stop:   $network

# Default-Start:   2 3 4 5

# Default-Stop:    0 1 6

# Short-Description: Start/Stop Tomcat server

### END INIT INFO


PATH=/sbin:/bin:/usr/sbin:/usr/bin


start() {

 sh /opt/tomcat/bin/startup.sh

}


stop() {

 sh /opt/tomcat/bin/shutdown.sh

}


case $1 in

  start|stop) $1;;

  restart) stop; start;;

  *) echo "Run as $0 <start|stop|restart>"; exit 1;;

esac


Give it executable permissions and set it as service.


sudo chmod +x /etc/init.d/tomcat

sudo update-rc.d tomcat defaults


Run Tomcat server and check its status.


sudo service tomcat start

sudo service tomcat status


DSpace Administrator


Create a DSpace administrator account.


sudo /dspace/bin/dspace create-administrator


Delete the builds folder.


sudo rm -rf /build


DSpace access test.


http://localhost:8080/xmlui or http://serverIP:8080/xmlui

http://localhost:8080/jspui or http://serverIP:8080/jspui

16 comments:

  1. Sir I was traying to install Dspace on Linux (Mint 20) After executing the command "sudo mvn -U package" i am getting an error. What may be the problem?

    ReplyDelete
    Replies
    1. Did you remove that bunch of code mentioned in the post?

      Delete
  2. Hi sir,
    It is a very great guide.
    But, I faced the following error.
    Would you say somthing on how I can fix that, please?
    Thank you!

    kiki@DESKTOP-FCE765O:/mnt/c/Users/zizuw$ createuser --username=postgres --no-superuser --pwprompt dspace
    Enter password for new role:
    Enter it again:
    createuser: error: could not connect to database postgres: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
    kiki@DESKTOP-FCE765O:/mnt/c/Users/zizuw$

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Thanks Sir. I find it very helpful.
    I succeed to install DSpace 6.3 on Ubuntu 20.04.
    But I try to Install in Centos 7, (with command suitable for RHEL/Centos of course).
    I found folder /dspace/webapps/ is empty.

    Kindly need your help. Thanks in advance.

    ReplyDelete
  6. BUILD FAILED
    /build/dspace-6.3-src-release/dspace/target/dspace-installer/build.xml:789: Java returned: 1

    ReplyDelete
  7. Sir I am getting following error after running command sudo ant fresh_install
    BUILD FAILED
    /build/dspace-6.3-src-release/dspace/target/dspace-installer/build.xml:789: Java returned: 1

    ReplyDelete
  8. This article saved me, thanks!
    waiting for your new tutorial about dspace7 and the last ubuntu.

    ReplyDelete
  9. Hello !!! sir again thanks to you u make an Dspace installation very simple and comfortable. Today i shall do it. Again thanks for guide me...

    ReplyDelete
  10. Sir,
    After completion of all commands this msg will come

    HTTP Status 404 – Not Found

    Type Status Report

    Message /xmlu

    Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
    Apache Tomcat/9.0.31 (Ubuntu)

    ReplyDelete