Installing DSpace 6.3 on Ubuntu 18.04 LTS

Scope: This blog demonstrates a fresh installation of DSpace 6.3 on Ubuntu 18.04 using Amazon Web Services (AWS) EC2.

Note: The installation page on DSpace site is length and sometimes not all the details are there. So I tested installation on AWS EC2. Installing on a physical server shall work as well. If you experience issues on MVN, you might need to see the error messages. Typical errors are: (1) Java version; (2) database connection


  1. Create an instance in AWS EC2
    • Choose Ubuntu 18.04LTS (Ubuntu 16.04 LTS is ok, I would recommend to do an upgrade to 18.04 LTS)
    • Configure the EC2 node. Select type “t2.micro” for testing/development use; select “t3a.small” for a small repository; I have used “medium” to handle 50,000 users.
    • For root (/dev/sda1), choose size >= 30 GB. Installation of DSpace and related applications (database, tomcat) will take some space. Ingestion of new titles will require bigger storage, you shall add new volume for DSpace files.
  2. Ports: Security group to open appropriate ports/IPs (e.g. 80 for HTTP, 8080 for Tomcat,
  3. If you have previous or later version of Java and postgresql, you need to take extra steps to see if the versions are compatible.

Installation Steps:

Note: there are same names for the database user “dspace”, the ubuntu user “dspace”, but they are different things.

  1. Log in:
    • $ ssh -i keypair2.pem ubuntu@
  2. Update Ubuntu patches to latest packages:
    • $sudo apt update
    • $sudo apt upgrade (note: when upgrading, choose “install the package maintainer’s version” typically works well)
  3. Install required system applications: (openjdk-8, postgresql, ant, and maven)
    • $sudo apt install openjdk-8-jdk postgresql ant maven
  4. Create Ubuntu user “dspace” with directory “/dspace” and let user “dspace” owning directory “/dspace”
    • $sudo useradd -m dspace
    • $sudo passwd dspace
    • $sudo mkdir /dspace
    • $sudo chown dspace /dspace
  5. Become user “postgres” so that it can create postgreSQL database user
    • $sudo su postgres
  6. Create a new PostgreSQL user
    • $createuser -U postgres -d -A -P dspace
    • Enter password for new role: 
    • Enter it again:
    • $exit
  7. Ubuntu user “dspace” to create database “dspace”
    • $sudo -u dspace createdb -U dspace -E UNICODE dspace
  8. Be ubuntu user “postgres” and enable postgreSQL extension “pgcrypto” for hash function. (a regular Postgres extension. Install it once per database)
    • $sudo su postgres
    • $psql –username=postgres dspace -c “CREATE EXTENSION pgcrypto;”
  9. Exit to be user “ubuntu” again.
    • $exit
  10. Allow database user “dspace” to connect to PostgreSQL
    • $sudo nano /etc/postgresql/10/main/pg_hba.conf
    • go to the last line, add “local   all             dspace                                  md5
    • save and close the file
  11. Restart postgreSQL (to make the change effecitve)
    • $sudo /etc/init.d/postgresql restart
  12. Create “/build” directory for compiling and installation
    • $sudo mkdir /build; sudo chmod -R 777 /build; cd /build
  13. Download Dspace to “/build” directory and extract DSpace tar file
    • $wget
    • $ tar -zxf dspace-6.3-src-release.tar.gz
    • $ cd /build/dspace-6.3-src-release
  14. Ensure appropriate Java version.
    • $sudo update-alternatives –config java (select 2)
  15. Compile Dspace package
    • $ mvn -U package
    • Note: you shall see results like this
    • If you see “BUILD FAILURE” like this, you need to update java version to use “openjdk-8”, Ubuntu 18.04 LTS carries java 11, which will fail the compile. Go to previous step to choose right java version and re-compile.
  16. Install DSpace
    • $ cd /build/dspace-6.3-src-release/dspace/target/dspace-installer
    • $sudo ant fresh_install
  17. Install Tomcat
    • $sudo cd /opt; sudo wget
    • $sudo tar xvzf apache-tomcat-8.0.37.tar.gz
    • $sudo ln -s apache-tomcat-8.0.37 tomcat
  18. Set Tomcat environment variables
    • $sudo nano /etc/profile
    • copy/paste to the last line”
      export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
      export CATALINA_HOME=/opt/tomcat
    • save and close the file.
  19. Copy DSpace webapps to Tomcat websapps (so that Tomcat will run DSpace webapps)
    • $sudo cp -r /dspace/webapps/* /opt/tomcat/webapps
  20. Run Tomcat
    • $sudo /opt/tomcat/bin/
    • Open an browser, enter “ip:8080/xmlui” for XMLUI interface, you shall see this. This is nice.

Using DSpace

  1. Interfaces:
    • JSP: residing in /jspui/. To access: enter [IP}:8080/jspui/. Example:
    • XMLUI: residing in /xmlui/. To access: enter [IP}:8080/xmlui/. Example:
  2. Create adminstrative account:
    • $sudo /dspace/bin/dspace create-administrator