Installing DSpace 6.x on Ubuntu 14.04/16.04/18.04 LTS

This is tested to work on a Ubuntu Server 14.04, 16.04 and 18.04 LTS versions on a physical machine and on a Proxmox container.

The development server was built on a basic Ubuntu Server installation with only OpenSSH installed beyond the basic conf. (Proxmox container template)

As usual, let’s begin with an update and upgrade. On the command line type:

sudo apt-get update && sudo apt-get upgrade -y

Install OpenJDK 7 (or later version – 8):

sudo apt-get install openjdk-7-jdk

For Ubuntu 16.04 or 18.04, you can use OpenJDK 8

sudo apt-get install openjdk-8-jdk

Install ant:

sudo apt-get install ant

Install maven:

sudo apt-get install maven

Install Apache Tomcat:

sudo apt-get install tomcat8

Install Git (not actually used with this method, but it resolves an error produced by maven):

sudo apt-get install git

You can also run all the installations with a line of code

sudo apt-get install openjdk-7-jdk ant maven tomcat7

For Ubuntu 16.04 or 18.04, you can use:

sudo apt-get install openjdk-8-jdk ant maven tomcat8

Create the DSpace user in Ubuntu:

sudo useradd -m dspace

sudo passwd dspace

Install PostgreSQL 9.6: (earlier versions of PostgreSQL < 9.4 might not work properly with DSpace, because of the pgcrypto add-in version)

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add - 

sudo apt-get update 

sudo apt-get install postgresql postgresql-contrib

Let’s login to PostgreSQL and create the DSpace database (using template0) and database user:

sudo su - postgres 

createuser --username=postgres --no-superuser --pwprompt dspace

createdb --username=postgres --owner=dspace --encoding=UNICODE -T template0 dspace

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

exit

Now we should add a line to the PostgreSQL for client authentication:

Open the pg_hba.conf file with your favorite editor (nano, vi, etc.)

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

And add the following line

local     all     dspace    md5

Restart PostgreSQL to adopt the changes

sudo /etc/init.d/postgresql restart

We are now ready to download the DSpace source from GitHub: (You can replace the 6.2 version with any 6.x version)

mkdir dspace_build 

cd dspace_build

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

Decompress the source file:

tar -zxf dspace-6.2-src-release.tar.gz
cd dspace-6.2-src-release 

sudo mvn -U package

The final result should look like:

[INFO] ----------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ----------------------------------------------------------
[INFO] Total time: xxxxxxxxx
[INFO] Finished at: xxxxxxxxx
[INFO] Final Memory: xxxxxxxxx
[INFO] ----------------------------------------------------------

If the result does not look like the above code, then something went wrong somewhere. Start all over and go through the process carefully.

And ant is next:

cd dspace/target/dspace-installer 

sudo ant fresh_install

When you run the ant fresh_install and it fails, then supply the database details to the DSpace configuration file, else you will run into problems when fresh installing ant. Open the DSpace config file.

sudo nano /dspace/config/dspace.cfg

Edit the following line and replace with the correct details

#Database username and password
db.username = dspace
db.password = xxxxxxxxxx

Save the file and re-run ant.

After a hopefully happy installation, we move the focus to the DSpace installation directory /dspace.

sudo chown -R tomcat7:tomcat7 /dspace

For Ubuntu 16.04 or 18.04 use:

sudo chown -R tomcat8:tomcat8 /dspace

Next, create the DSpace administrator

sudo /dspace/bin/dspace create-administrator

Depending on your server specs, it can take a few seconds and up to a minute to get a response. Be patient. You will be asked for an administrative e-mail address which will also be the administrator login, along with a first and last name and a password. Please write them down or remember them.

It’s time to move the DSpace web applications to Tomcat to get online.

Let’s stop Tomcat (change all instances of tomcat7 to tomcat8 where applicable):

sudo service tomcat7 stop

and move the webapps to Tomcat’s webapps directory.

Either:

sudo cp -r /dspace/webapps/*    /var/lib/tomcat7/webapps

if you want all apps moved, or if you only need the responsive jsp user interface and fewer modules:

sudo cp -r /dspace/webapps/jspui/ /var/lib/tomcat7/webapps 

sudo cp -r /dspace/webapps/oai/ /var/lib/tomcat7/webapps

sudo cp -r /dspace/webapps/solr/ /var/lib/tomcat7/webapps

Let’s give Tomcat some breathing space, increasing the available resources and addressing some problems:

Edit the file /etc/default/tomcat7

sudo nano /etc/default/tomcat7

and replace the relevant JAVA_OPTS with this or simply add the line at the end of file:

JAVA_OPTS="${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -Djava.awt.headless=true -Xmx512m -XX:MaxPermSize=256m -XX:+UseConcMarkSweepGC"

Fix Tomcat permissions, and restart the Tomcat server

cd /var/lib/tomcat7/webapps 

sudo chown -R tomcat7:tomcat7 *

sudo service tomcat7 start

You can now access the DSpace XML front page at:

http://host:8080/jspui   replace host with the server's host address or URL

Depending on your server specs and Tomcat’s responsiveness, this can take some time, even up to several minutes to get the first response. Be patient. This happens only on the first contact and on every server restart 

I hope this helps.

Scroll to Top