Install DSpace 7.6 on Ubuntu 22 (AWS, Azure, DigitalOcean)

In today’s rapidly evolving digital landscape, efficient management of research data and scholarly content is paramount. DSpace, a robust and widely acclaimed open-source repository software, stands as a stalwart solution for academic and research institutions seeking a reliable platform to organize, preserve, and share their valuable resources. With the release of DSpace 7.6, the software takes a significant leap forward, introducing enhancements and features that promise to streamline the repository management process.

This comprehensive guide serves as your compass to navigate the seamless installation and setup of DSpace 7.6 on the cloud, specifically leveraging the power of Ubuntu 22.04LTS. The cloud’s versatility and scalability, coupled with Ubuntu’s stability, make for an ideal environment to harness DSpace’s potential. Whether you’re eyeing Amazon Web Services (AWS), Microsoft Azure, or DigitalOcean, the step-by-step instructions provided here will empower you to confidently deploy DSpace 7.6 on your chosen cloud platform. Join us as we delve into the intricacies of this installation process, exploring key concepts and ensuring that you’re well-equipped to harness DSpace’s capabilities for effective research data management and dissemination.

Dspace 7.6 installation on cloud or server, aws, azure, digital ocean.

Getting started

Before embarking on the journey to set up DSpace 7.6 on the cloud, it’s imperative to lay a sturdy foundation. Ensure that your chosen cloud environment, be it AWS, Azure, or DigitalOcean, is primed to accommodate the requirements of DSpace 7.5. Firstly, confirm that your cloud instance is powered by either Ubuntu 22.04LTS or 20.04, guaranteeing optimal compatibility and support for the installation process. To accommodate DSpace’s expansive capabilities, allocate a minimum of 40GB of storage and 16GB of memory to your instance. This allocation ensures that you’ll have ample room to house your repository’s contents and provides the necessary resources to maintain smooth operations.

Moreover, fostering seamless communication is pivotal. DSpace relies on specific ports to facilitate data exchange, and it’s crucial to ensure that these pathways remain unobstructed. Take a moment to configure your cloud platform’s security settings and open the essential ports, notably port 8080 and port 4000, to enable unhindered access to DSpace’s web interface and APIs. 

1. Setup DSpace user

Let’s initiate the process by establishing a dedicated user for DSpace within our system. Employ the following command to generate the ‘dspace’ user:

					sudo adduser dspace


Next, we’ll grant the user appropriate privileges by including them in the ‘sudo’ group. Execute the ensuing command to achieve this:

					sudo usermod -aG sudo dspace


With the user prepared, proceed by transitioning into the designated ‘dspace’ account using the subsequent command:

					sudo su - dspace


This progression ensures that you’re now operating within the ‘dspace’ user context, setting the stage for subsequent configuration steps.

2. Installing JAVA Runtime

We will then install Java and make the required configurations. The easiest way of installing Java 11 on Ubuntu is by executing the below commands:

					sudo apt update -y

					sudo apt-get install openjdk-11-jdk  vim

The next thing is to export the JAVA_HOME. Open the file by running this command:

					$ vim ~/.bashrc

Now add the content below into the file:

					# [...]
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
export PATH=$PATH:$JAVA_HOME/bin

Save the changes and source the profile:

					source ~/.bashrc

3. Install and Configure PostgreSQL

DSpace relies on PostgreSQL as its underlying database management system. To ensure seamless interaction, we need to install and configure PostgreSQL along with its prerequisites. Begin by installing the necessary packages using the command

					sudo apt-get install postgresql postgresql-contrib libpostgresql-jdbc-java -y

Once the installation is complete, we’ll enable the host’s access to the PostgreSQL server. Add the following line to the pg_hba.conf file:

					echo "host dspace dspace md5" | sudo tee -a /etc/postgresql/*/main/pg_hba.conf


Next, we’ll configure user permissions for DSpace. Adjust the authentication methods in the pg_hba.conf file as follows:

					sudo sed -i 's/ident/trust/' /etc/postgresql/*/main/pg_hba.conf

					sudo sed -i 's/md5/trust/' /etc/postgresql/*/main/pg_hba.conf
					sudo sed -i 's/peer/trust/' /etc/postgresql/*/main/pg_hba.conf

After making these changes, restart the PostgreSQL service:

					sudo systemctl restart postgresql


Moving forward, switch to the Postgres user to perform specific database operations:

					sudo su postgres

Within the Postgres user context, create a dedicated user and database for DSpace:

					createuser dspace

					createdb dspace -E UNICODE


Access the PostgreSQL shell:

					psql -d dspace


In the PostgreSQL shell, create the necessary pgcrypto extension:

					CREATE EXTENSION pgcrypto;

Set a password for the ‘dspace’ user and assign the required permissions:

					ALTER ROLE dspace WITH PASSWORD 'Passw0rd';

					ALTER DATABASE dspace OWNER TO dspace;



Exit the PostgreSQL shell:



Leave the Postgres user’s context:


Finally, restart the PostgreSQL service to ensure that all the changes take effect:

					sudo systemctl restart postgresql


By meticulously configuring PostgreSQL and establishing the essential user and database components, we’re now poised to seamlessly integrate DSpace with its designated database management system.

4. Install Apache SOLR 8

Now, let’s delve into the next step which entails the installation of Apache Solr 8. To begin, fetch the Apache Solr distribution by employing the wget command:

					wget -c


Upon successful download, proceed to extract the contents of the downloaded tarball:

					tar xvf solr-*.tgz


With the contents extracted, initiate the installation of Apache Solr using the provided installation script:

					sudo bash solr-8.11.2/bin/ solr-8.11.2.tgz


This installation process establishes a symbolic link within the /opt/solr directory, facilitating easy access and management.

5. Installing TOMCAT 9

Now let’s proceed to install Apache Tomcat 9, another integral component of the DSpace setup. Tomcat serves as the application server, facilitating the deployment and operation of DSpace. Begin the installation by executing the following command:

					sudo apt install tomcat9


Once Tomcat is installed, it’s essential to configure its environment variables and memory allocation. Open the Tomcat configuration file for editing:

					sudo vim /etc/default/tomcat9


Inside this file, make the following adjustments to define JAVA_OPTS and JAVA_HOME:

					JAVA_OPTS="-Djava.awt.headless=true -Xmx2048m -Xms1024m -XX:MaxPermSize=1024m"

These settings allocate memory and establish Java runtime options suitable for DSpace’s requirements.

Additionally, there’s a need to modify the Tomcat server configuration file. Open the server.xml file for editing:

					sudo vim /etc/tomcat9/server.xml

Within the server.xml file, adjust the indicated lines as follows:

					<Connector port="8080" 


Configure DSpace installation path to Tomcat:

					sudo vim /lib/systemd/system/tomcat9.service


Inside the file, locate the section labeled “#Security” and add the specified line at the end:



To implement the changes you’ve made and restart Tomcat with the updated configuration, follow these steps:

					sudo systemctl restart tomcat9.service


If you encounter the warning message:

Warning: The unit file, source configuration file or drop-ins of tomcat9.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.

Execute the following command to reload the daemon and reflect the changes:

					sudo systemctl daemon-reload


Once you’ve reloaded the daemon, attempt to restart Tomcat again:

					sudo systemctl restart tomcat9.service


6. Install Git, Maven and Ant

To facilitate the compilation and installation processes of DSpace 7, Maven and Ant play integral roles. Maven handles the compilation and dependency management, while Ant takes care of the installation of the compiled code. To set up these tools, employ the following command:

					sudo apt-get install ant ant-optional maven git -y


6. Install DSpace 7.6

Next, we proceed to install DSpace 7.6 As of writing this, version 7.6 is the latest one, so we’ll proceed with that. 

Download and Extract DSpace:

					sudo wget

Extract the archive:

					tar -zxvf dspace-*.tar.gz

Rename the folder to a simpler name:

					mv DSpace-dspace-* dspace-7-src

Switch to the directory:

					cd dspace-7-src

Create a new directory for deployment:

					sudo mkdir /opt/dspace-7


Set the ownership to the DSpace user:

					sudo chown dspace:dspace -R /opt/dspace-7

Create a configuration file from the default available one:

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


Modify this configuration file:

					vim dspace/config/local.cfg


Make the below adjustments:

dspace.server.url = http://REPLACE_WITH_SERVER_IP:8080/server
dspace.ui.url = http://REPLACE_WITH_SERVER_IP = DSpace Demo
solr.server = http://localhost:8983/solr
db.url = jdbc:postgresql://localhost:5432/dspace
db.driver = org.postgresql.Driver
db.username = dspace
db.password = Passw0rd

Once the adjustments have been made, start building Dspace:

					mvn package


Navigate to the created installer directory:

					cd dspace/target/dspace-installer


Deploy the generated code:

					ant fresh_install

After this command, the output should say BUILD SUCCESSFUL

Once complete, configure Tomcat9 to serve DSpace:

					cd /var/lib/tomcat9/webapps
					sudo ln -s /opt/dspace-7/webapps/server server


Copy Solr folders and change permissions:

					sudo cp -R /opt/dspace-7/solr/* /var/solr/data

					sudo cp -R /opt/dspace-7/solr/* /var/solr/data


Copy the DSpace web apps folder to the Tomcat server:

					sudo cp -R /opt/dspace-7/webapps/* /var/lib/tomcat9/webapps


Restart Apache Solr:

					sudo systemctl restart solr


Run database migrations:

					cd /opt/dspace-7
					./bin/dspace database migrate


Next, we create an adminstrator login for DSpace. This will be used to login to your DSpace installation:

					/opt/dspace-7/bin/dspace create-administrator

Creating an initial administrator account

E-mail address:

First name: test

Last name: user

Password will not display on screen.

Password: Again to confirm:

Is the above data correct? (y or n): y

Administrator account created

Change permission of DSpace to Tomcat user and restart Tomcat:

					sudo chown -R tomcat:tomcat /opt/dspace-7/

					sudo systemctl restart tomcat9.service

Now you can access the DSPace Backed using the URL http://YOUR_SERVER_IP:8080/server

Dspace 7.6 installation

If you get a 404 error on accessing the backend, try restarting the TOMCAT9 server again. Else make sure you have the required ports open in your cloud hosting.

6. Install DSpace Frontend

To install the DSpace 7 Front End, certain packages are required, notably Node.js. DSpace 7 is compatible with Node.js (version 16 or 18) and requires DSpace 7 and above to function properly.

We’ll begin by installing Node.js using NVM (Node Version Manager), which can be set up using the following command:

					curl -o- | bash


Once NVM is installed, source the profile to ensure it’s available in your session:

					source ~/.bashrc


Next, we’ll install Node.js 16 (LTS) using NVM:

					nvm install v16


Proceed by installing NPM from the package repositories:

					sudo apt install npm


Additionally, we’ll install Yarn and PM2:

					sudo npm install --global yarn

					sudo npm install --global pm2

Download the DSpace Frontend from the GitHub releases page or utilize Wget:

					cd ~
					wget -c

Once the download is complete, extract the archive:

					tar -zxvf dspace-*.tar.gz


Rename the extracted directory to a more concise name:

					mv dspace-angular-dspace-* dspace-7-angular


Navigate into the renamed directory:

					cd dspace-7-angular


Proceed to install all the required dependencies:

					yarn install


Once the dependencies are installed, initiate the build process:

					yarn build:prod


Copy the generated files to a dedicated directory in /opt:

					sudo cp -r ../dspace-7-angular/ /opt/dspace-7-angular


Set the correct permissions for the copied directory:

					sudo chown dspace:dspace -R /opt/dspace-7-angular/


Configure PM2:

Navigate to the copied directory:

					cd /opt/dspace-7-angular/


Create and edit the PM2 configuration file:

					vim dspace-ui.json


Inside the file, add the following configuration:

    "apps": [
            "name": "dspace-angular",
            "cwd": "/opt/dspace-7-angular",
            "script": "yarn",
            "args": "run serve:ssr",
            "interpreter": "none"


Save the file and exit.

Create a configuration file for communication between the Frontend and the Backend:

Create and edit the configuration file:

					vim config/config.yml


Modify the values in the file to match your DSpace server:

  ssl: false
  host: SERVER_IP_ADDRESS (without http://)
  port: 8080
  nameSpace: /server


Save the file and exit.

Start the DSpace Front End using PM2:

					pm2 start dspace-ui.json


At this stage, the DSpace Front End will be up and running, listening on port 4000 on your localhost.

7. Configure Nginx Reverse Proxy

To enable access to the DSpace Frontend using your IP address, a reverse proxy configuration is required. In this guide, we will use Nginx for this purpose.

Start by installing Nginx using the following command:

					sudo apt install nginx -y


Create a Virtual Host Configuration File:

Create a new configuration file for your DSpace UI in the Nginx conf.d directory:

					sudo vim /etc/nginx/conf.d/dspace_ui.conf


Add the Reverse Proxy Configuration:

Inside the configuration file, add the following lines. Replace YOUR_SERVER_IP with your actual domain name or IP address. Do not put HTTP://

					server {
  listen 80;
  server_name YOUR_SERVER_IP;
  access_log /var/log/nginx/dspace-access.log;
  error_log /var/log/nginx/dspace-error.log;

  location / {
      proxy_pass http://localhost:4000/;
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;


This configuration sets up a reverse proxy to forward requests from Nginx to your DSpace Frontend, which is running on localhost:4000.

Restart Nginx:

After creating the configuration file, restart Nginx to apply the changes:

					sudo service nginx restart


With these steps, you’ve successfully configured Nginx as a reverse proxy for your DSpace Frontend. Now, you can access your DSpace instance using your Server IP address. Nginx will handle the reverse proxying, forwarding requests to the DSpace Frontend, and allowing users to interact with your repository through a user-friendly and accessible interface.

Dspace 7.6 cloud isntallation

In case you get Error 500, you need to modify the dspace.ui.url on your Dspace Backend to match what you are trying to access the server with. Else, restart TOMCAT service. 

Related articles:

Leave a Reply