Setting up DSpace can seem daunting, but with the right approach, you can have both the backend (REST API) and frontend (Angular UI) running smoothly on a single server. This DSpace 9.1 installation guide for Ubuntu 22 LTS walks you through every step, from preparing your server to deploying with Nginx and securing it with Let’s Encrypt SSL.


Prerequisites

  • Ubuntu 22 LTS server (e.g., AWS Lightsail)
  • Fully qualified domain name (e.g., your-domain.com) with DNS A record pointing to server’s public IP
  • Root or sudo access to the server

Section 1: Initial Server Preparation

Update Packages

sudo apt update && sudo apt upgrade -y

Configure Firewall

Ensure these ports are open:

  • 80/tcp (HTTP)
  • 443/tcp (HTTPS)
  • 22/tcp (SSH)

Create DSpace User

sudo useradd -m dspace
sudo passwd dspace
sudo usermod -aG sudo dspace

Host Resolution Setup

Edit /etc/hosts:

127.0.0.1   localhost your-domain.com

Section 2: Install Backend Dependencies

Java JDK 17

sudo apt install -y openjdk-17-jdk

Maven & Ant

sudo apt install -y maven ant

PostgreSQL

sudo apt install -y postgresql postgresql-contrib

Apache Solr 9.x

cd /tmp
wget https://archive.apache.org/dist/solr/solr/9.6.1/solr-9.6.1.tgz
tar xzf solr-9.6.1.tgz solr-9.6.1/bin/install_solr_service.sh --strip-components=2
sudo bash ./install_solr_service.sh solr-9.6.1.tgz

Enable Solr configs in /etc/default/solr.in.sh:

SOLR_OPTS="$SOLR_OPTS -Dsolr.config.lib.enabled=true"

Section 3: DSpace Backend Installation

Setup Directories & Source

sudo mkdir /dspace
sudo chown dspace:dspace /dspace
cd /opt
sudo wget -O dspace-backend-9.x.tar.gz https://github.com/DSpace/DSpace/archive/refs/tags/dspace-9.1.tar.gz
sudo tar -zxf dspace-backend-9.x.tar.gz
sudo mv DSpace-dspace-9.1 dspace-source
sudo chown -R dspace:dspace /opt/dspace-source

Database Setup

sudo -u postgres createuser --username=postgres --no-superuser --pwprompt dspace
sudo -u postgres createdb --username=postgres --owner=dspace --encoding=UNICODE dspace

Configure local.cfg

Update DB credentials, domain, and Solr settings.

Build & Install

cd /opt/dspace-source
mvn package
cd /opt/dspace-source/dspace/target/dspace-installer
ant fresh_install

Deploy Service

Create dspace-backend.service and enable it via systemd.


Section 4: DSpace Frontend Installation

Install Node.js & PM2

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g pm2

Download Frontend Source

cd /opt
sudo wget -O dspace-frontend-9.x.tar.gz https://github.com/DSpace/dspace-angular/archive/refs/tags/dspace-9.1.tar.gz
sudo tar -zxf dspace-frontend-9.x.tar.gz
sudo mv dspace-angular-dspace-9.1 dspace-angular

Build Application

cd /opt/dspace-angular
npm install
npm run build:prod

Deploy with PM2

Configure dspace-ui.json and launch with PM2.


Section 5: Nginx Reverse Proxy & SSL

Install Nginx & Certbot

sudo apt install -y nginx python3-certbot-nginx

Obtain SSL Certificate

sudo certbot --nginx -d your-domain.com

Nginx Config

Setup reverse proxy for frontend (port 4000) and backend (port 8080) with HTTPS redirection.


Section 6: Post-Installation & Troubleshooting

  • Cron Jobs: Setup scheduled tasks for statistics, media filters, etc.
  • No _links section found: Check backend logs with journalctl -u dspace-backend.service -f
  • Could not resolve host: Ensure /etc/hosts includes your domain
  • Filename conflict: Always use wget -O for unique filenames

Conclusion

By following this DSpace 9.x installation guide for Ubuntu 22 LTS, you can deploy a production-ready DSpace repository with SSL-enabled frontend and backend. With Nginx handling traffic and PM2 managing Node processes, your system will be stable, scalable, and easy to maintain.