Sunday, August 24, 2025

How to install DSpace 9 on Ubuntu 24.04?

DSpace Installation Guide

Complete guide to installing and configuring DSpace 9.1 on Ubuntu 24.04 LTS

What is DSpace?

DSpace is an open-source digital repository and archival software that institutions, libraries and other organisations use to manage, preserve, and disseminate research papers, documents, datasets and other scholarly or institutional digital content.

It was initially developed in collaboration with MIT Libraries and Hewlett-Packard (HP) Labs in the early 2000s.

How to Install DSpace 9.1

Before installing DSpace, it's important to understand that it consists of two main components that work together to provide the complete functionality and user experience:

DSpace Architecture

Backend (Server API)
Frontend (User Interface)
Spring Boot · Java
Angular · TypeScript

Backend

It consists of a Server API ("server" webapp), built on Spring Boot. It is responsible for storing, retrieving, and manipulating digital objects, metadata, and repository configurations. It also provides a REST API that exposes the functionality and data of the repository to other applications or services. The backend is written in Java and uses PostgreSQL as the database management system.

Frontend

It consists of a user interface that is built on angular.io. It runs on the browser and interacts with the user. It is responsible for displaying, formatting, and updating the repository's data, content, and design. It also allows the user to perform actions such as browsing, searching, submitting, editing, and managing the repository. It is written in Angular, a modern framework for building dynamic and responsive web applications.

The backend and frontend are separated by a clear boundary, which makes them easier to develop, maintain, and customize independently. They communicate with each other through the REST API, which ensures a consistent and standardized interface between them.

Installation Guides

Follow these comprehensive guides to install and configure DSpace on your Ubuntu 24.04 system:

Prerequisites

Before diving into the installation process, make sure you have the following prerequisites in place:

For Backend

  • Linux (Operating System)
    • Ubuntu 24.04
  • Open Java Development Kit (JDK) or Oracle JDK
    • Java JDK 17
  • Apache Maven (Java build tool)
    • Maven 3.8.x or above
  • Apache Ant (Java build tool)
    • Ant 1.10.x or later
  • Relational Database (PostgreSQL)
    • PostgreSQL 14.x, 15.x, 16.x or 17.x (with pgcrypto installed)
  • Apache Solr (full-text index/search service)
    • Solr 9.x and above
  • Apache Tomcat (Servlet Engine)
    • Tomcat 10.1.x
  • Git (code version control)
  • (Optional) IP to City Database for Location-based Statistics

For Frontend

  • Linux (Operating System)
    • Ubuntu 24.04
  • Node.js
    • Node (v18.19+ or v20.x or v22.x)
  • PM2 (or another Process Manager for Node.js apps)
    • Optional, but recommended for Production

Thursday, August 21, 2025

How to Install DSpace 9 Backend (Server API) on Ubuntu 24.04 LTS ?

Complete DSpace Installation Guide

Installation of Backend

Step 1: System Preparation

i. Update & Upgrade System Packages

sudo apt update && sudo apt upgrade -y
Purpose: Update and upgrade system packages
Explanation: This command updates the package lists and upgrades all installed packages to their latest versions. The -y flag automatically confirms the upgrade process.

Step 2: Install Required Dependencies

i. Core Tools

sudo apt install wget curl git build-essential unzip zip -y
Purpose: Install core development tools
Explanation: This command installs essential tools needed for software development and system administration, including wget for downloading files, curl for transferring data, git for version control, and build tools for compiling software.

ii. Java Development Kit (OpenJDK 17)

sudo apt install openjdk-17-jdk -y
Purpose: Install Java Development Kit
Explanation: This command installs OpenJDK 17, which is required for running DSpace. DSpace is a Java-based application that requires a Java Runtime Environment.

iii. Verify Java Installation:

# Should show OpenJDK 17
java -version
Purpose: Verify Java installation
Explanation: This command displays the installed Java version, confirming that OpenJDK 17 was installed correctly.

iv. Set the Environment Variable

## Set JAVA_HOME
sudo nano /etc/environment
Purpose: Edit environment variables file
Explanation: This command opens the system environment variables file for editing, where we'll add Java-specific configuration.
Add the following two lines to the file
JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
Purpose: Set JAVA_HOME environment variable
Explanation: This line sets the JAVA_HOME variable to point to the Java installation directory, which is needed by many Java applications.
JAVA_OPTS="-Xmx512M -Xms64M -Dfile.encoding=UTF-8"
Purpose: Set Java runtime options
Explanation: This line configures Java memory settings (maximum heap size of 512MB, initial heap size of 64MB) and sets UTF-8 encoding for proper character handling.
Apply changes, Save and close the editor, and apply the following command
source /etc/environment
Purpose: Reload environment variables
Explanation: This command applies the changes made to the environment variables file to the current shell session.
echo $JAVA_HOME
Purpose: Verify JAVA_HOME variable
Explanation: This command displays the value of the JAVA_HOME environment variable to confirm it was set correctly.
echo $JAVA_OPTS
Purpose: Verify JAVA_OPTS variable
Explanation: This command displays the value of the JAVA_OPTS environment variable to confirm it was set correctly.

v. Build Tools (Maven & Ant)

sudo apt install maven ant -y
Purpose: Install build tools
Explanation: This command installs Maven and Ant, which are build automation tools used to compile and package DSpace.
# Verify Apache Maven Installation, Should show Apache Maven 3.x.x
mvn -version
Purpose: Verify Maven installation
Explanation: This command displays the installed Maven version, confirming that Maven was installed correctly.
# Verify Apache Ant Installation, Should show Apache Ant 1.10.x
ant -version
Purpose: Verify Ant installation
Explanation: This command displays the installed Ant version, confirming that Ant was installed correctly.

Step 3: Install PostgreSQL

sudo apt install postgresql postgresql-contrib libpostgresql-jdbc-java -y
Purpose: Install PostgreSQL database
Explanation: This command installs PostgreSQL database server, additional contributed packages, and the Java JDBC driver for PostgreSQL connectivity.

i. Configure PostgreSQL

sudo -u postgres psql
Purpose: Access PostgreSQL as postgres user
Explanation: This command switches to the postgres system user and starts the PostgreSQL interactive terminal (psql).

ii. Run the following command to setup the database for DSpace

## Creates a PostgreSQL user (role) named dspace with the specified password
CREATE USER dspace WITH PASSWORD 'dspace';
Purpose: Create DSpace database user
Explanation: This SQL command creates a new PostgreSQL user named 'dspace' with the password 'dspace' that will be used by the DSpace application.
## Creates a database named dspace and assigns ownership to the dspace user
CREATE DATABASE dspace WITH OWNER dspace;
Purpose: Create DSpace database
Explanation: This SQL command creates a new database named 'dspace' and assigns ownership to the 'dspace' user created in the previous step.
## Exits the PostgreSQL interactive terminal (psql)
\q
Purpose: Exit PostgreSQL terminal
Explanation: This command exits the PostgreSQL interactive terminal and returns to the regular shell prompt.

iii. Enable pgcrypto Extension

sudo -u postgres psql dspace -c "CREATE EXTENSION pgcrypto;"
Purpose: Enable cryptographic functions
Explanation: This command enables the pgcrypto extension in the dspace database, which provides cryptographic functions that DSpace uses for secure operations.

iv. Update and Configuration network access

Allow PostgreSQL to accept local connections from DSpace. This enables PostgreSQL to listen on localhost (for security, it won't accept external connections). DSpace (running locally) needs to communicate with PostgreSQL via TCP/IP.

sudo nano /etc/postgresql/16/main/postgresql.conf
Purpose: Edit PostgreSQL configuration
Explanation: This command opens the main PostgreSQL configuration file for editing to configure network listening settings.
Locate the line (around line 60) under CONNECTIONS AND AUTHENTICATION:
#listen_addresses = 'localhost'
Purpose: Find listen_addresses setting
Explanation: This is the default commented-out line that needs to be uncommented and modified to allow PostgreSQL to listen on localhost.
Uncomment it by removing #
listen_addresses = 'localhost'
Purpose: Configure PostgreSQL to listen on localhost
Explanation: This line configures PostgreSQL to listen for connections on the localhost interface only, enhancing security while allowing local applications to connect.

v. Configure Client Authentication (pg_hba.conf)

Allow the dspace user to authenticate with a password. This allows the dspace user to connect to the dspace database from localhost using password authentication (md5).

sudo nano /etc/postgresql/16/main/pg_hba.conf
Purpose: Edit PostgreSQL client authentication
Explanation: This command opens the PostgreSQL client authentication configuration file to set up access rules for the dspace database user.
Find the section starting with (line number 118):
# Database administrative login by Unix domain socket
Purpose: Locate authentication section
Explanation: This comment marks the section where authentication rules are defined in the pg_hba.conf file.
Add these lines below it:
#DSpace configuration
Purpose: Add configuration comment
Explanation: This comment helps identify the DSpace-specific configuration in the authentication file.
host dspace dspace 127.0.0.1 255.255.255.255 md5
Purpose: Configure DSpace database access
Explanation: This line allows the dspace user to connect to the dspace database from localhost (127.0.0.1) using password authentication (md5).

vi. Restart PostgreSQL

sudo systemctl restart postgresql
Purpose: Restart PostgreSQL service
Explanation: This command restarts the PostgreSQL service to apply all the configuration changes made to the postgresql.conf and pg_hba.conf files.

Step 4: Install Solr 9.x

## Download latest Solr 9.x Package and saves the file directly to /opt directory
sudo wget https://downloads.apache.org/solr/solr/9.9.0/solr-9.9.0.tgz -P /opt
Purpose: Download Apache Solr
Explanation: This command downloads the Solr 9.9.0 package from the Apache mirrors and saves it to the /opt directory.
## Extract the Archive
sudo tar xzf /opt/solr-9.9.0.tgz -C /opt
Purpose: Extract Solr package
Explanation: This command extracts the downloaded Solr archive to the /opt directory.
## Rename Directory (Cleanup)
sudo mv /opt/solr-9.9.0 /opt/solr
Purpose: Rename Solr directory
Explanation: This command renames the extracted directory to a simpler name for easier reference.
## Remove Downloaded Archive
sudo rm /opt/solr-9.9.0.tgz
Purpose: Clean up downloaded file
Explanation: This command removes the downloaded archive file to free up disk space after extraction.
## Create Dedicated Solr User
sudo useradd -r -d /opt/solr -M solr
Purpose: Create system user for Solr
Explanation: This command creates a dedicated system user for running Solr with the home directory set to /opt/solr.
## Set Ownership Permissions to solr directory
sudo chown -R solr:solr /opt/solr
Purpose: Set Solr directory ownership
Explanation: This command changes ownership of the Solr directory to the solr user, ensuring proper permissions for operation.
## Create Systemd Service
sudo nano /etc/systemd/system/solr.service
Purpose: Create Solr service file
Explanation: This command creates a systemd service file to manage Solr as a system service.
Paste the below content and save the file
[Unit]
Description=Apache Solr for DSpace
After=network.target

[Service]
User=solr
Group=solr
WorkingDirectory=/opt/solr
Environment="SOLR_OPTS=-Dsolr.config.lib.enabled=true -Djava.security.manager=allow"
Environment="SOLR_JETTY_HOST=0.0.0.0"
ExecStart=/opt/solr/bin/solr start -f
ExecStop=/opt/solr/bin/solr stop
Restart=on-failure
LimitNOFILE=65536
TimeoutSec=180

[Install]
WantedBy=multi-user.target
Purpose: Solr service configuration
Explanation: This systemd service configuration defines how Solr should run, including the user, environment variables, and execution commands.
## Reload systemd solr service and enable and start the solr:
sudo systemctl daemon-reload
Purpose: Reload systemd configuration
Explanation: This command reloads the systemd manager configuration to recognize the new Solr service.
sudo systemctl enable --now solr
Purpose: Enable and start Solr service
Explanation: This command enables Solr to start at boot and starts the service immediately.
sudo systemctl start solr
Purpose: Start Solr service
Explanation: This command starts the Solr service (redundant with --now flag but included for completeness).
## Verify Installation
sudo systemctl status solr
Purpose: Check Solr service status
Explanation: This command displays the current status of the Solr service to verify it's running properly.
## Secure Solr for Production (Localhost Only)

Once testing is complete and DSpace is fully integrated with Solr, you should restrict Solr to listen only on localhost. This is critical to protect the Solr admin panel and prevent unauthorized access.

sudo nano /etc/systemd/system/solr.service
Purpose: Edit Solr service for production
Explanation: This command opens the Solr service file to modify it for production security.
Paste the below content and save the file
[Unit]
Description=Apache Solr for DSpace
After=network.target

[Service]
User=solr
Group=solr
WorkingDirectory=/opt/solr
Environment="SOLR_OPTS=-Dsolr.config.lib.enabled=true -Djava.security.manager=allow"
Environment="SOLR_HOST=127.0.0.1"
Environment="SOLR_PORT=8983"
Environment="SOLR_HEAP=512m"
ExecStart=/opt/solr/bin/solr start -f
ExecStop=/opt/solr/bin/solr stop
Restart=on-failure
LimitNOFILE=65536
TimeoutSec=180

[Install]
WantedBy=multi-user.target
Purpose: Production Solr configuration
Explanation: This configuration restricts Solr to listen only on localhost (127.0.0.1) for security and sets memory limits.
## Reload systemd and restart Solr
sudo systemctl daemon-reload
Purpose: Reload systemd configuration
Explanation: This command reloads systemd to apply the modified Solr service configuration.
sudo systemctl restart solr
Purpose: Restart Solr with new configuration
Explanation: This command restarts Solr to apply the security changes (listening on localhost only).
## Verify Installation
sudo systemctl status solr
Purpose: Verify Solr is running
Explanation: This command checks that Solr is running properly with the new security configuration.

Step 5: Install Tomcat 10.x

sudo apt install tomcat10 -y
Purpose: Install Apache Tomcat
Explanation: This command installs Apache Tomcat 10, which will host the DSpace web applications.
## Once installed, you can check the service status:
sudo systemctl status tomcat10
Purpose: Check Tomcat status
Explanation: This command displays the status of the Tomcat service to verify it was installed correctly.
## Set File Permissions for Deployment
sudo chown -R tomcat:tomcat /dspace
Purpose: Set DSpace directory ownership
Explanation: This command changes ownership of the DSpace directory to the Tomcat user, allowing Tomcat to read and write to it.
## Configure Java Options (/etc/default/tomcat10)
sudo nano /etc/default/tomcat10
Purpose: Edit Tomcat environment settings
Explanation: This command opens the Tomcat environment configuration file to set Java options.
Change this line:
JAVA_OPTS="-Djava.awt.headless=true"
Purpose: Default Java options
Explanation: This is the default Java options setting that needs to be modified for DSpace.
To: Add/update:
JAVA_OPTS="-Xmx2G -Xms512M -Dfile.encoding=UTF-8 -Djava.awt.headless=true"
Purpose: Configure Java memory settings
Explanation: This sets Java heap memory to 2GB maximum, 512MB initial, with UTF-8 encoding for proper character handling.
## Update Systemd Service for Write Permissions (/lib/systemd/system/tomcat10.service)

Tomcat's systemd unit needs permission to write to certain paths.

sudo nano /lib/systemd/system/tomcat10.service
Purpose: Edit Tomcat service file
Explanation: This command opens the Tomcat systemd service file to add write permissions.
Add in the last under [Service] section:
ReadWritePaths=/dspace
Purpose: Add write permissions for DSpace
Explanation: This line grants Tomcat write access to the /dspace directory, which is needed for DSpace operations.
## Configure Tomcat to Use UTF-8 Encoding (Connector on Port 8080)

To ensure your web application can properly handle international characters, you need to configure Tomcat to use UTF-8 encoding on its main HTTP connector.

sudo nano /etc/tomcat10/server.xml
Purpose: Edit Tomcat server configuration
Explanation: This command opens the main Tomcat configuration file to modify the HTTP connector.
Locate the Connector Section around line 68:
<Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443"
           maxParameterCount="1000"
           />
Purpose: Default HTTP connector
Explanation: This is the default HTTP connector configuration that needs to be modified for UTF-8 support.
Comment out the existing block by wrapping it with <!-- -->:
<!-- <Connector port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443"
           maxParameterCount="1000"
           /> -->
Purpose: Comment out default connector
Explanation: This comments out the default HTTP connector to replace it with a customized version.
Add a customized connector block with UTF-8 encoding:
<Connector port="8080"
          minSpareThreads="25"
          enableLookups="false"
          redirectPort="8443"
          connectionTimeout="20000"
          disableUploadTimeout="true"
          URIEncoding="UTF-8"/>
Purpose: Configure UTF-8 HTTP connector
Explanation: This custom HTTP connector configuration enables UTF-8 encoding for proper international character support.
## Reload systemd and restart Tomcat
sudo systemctl daemon-reload
Purpose: Reload systemd configuration
Explanation: This command reloads systemd to apply the Tomcat service changes.
sudo systemctl restart tomcat10
Purpose: Restart Tomcat
Explanation: This command restarts Tomcat to apply all configuration changes.
## Verify tomcat10 service status
sudo systemctl status tomcat10
Purpose: Verify Tomcat is running
Explanation: This command checks that Tomcat is running properly with the new configuration.

Step 6: Create a dedicated DSpace User

For security reasons and installation directory of the DSpace

## Create a separate dspace user:
sudo useradd -m dspace
Purpose: Create DSpace system user
Explanation: This command creates a dedicated system user for DSpace operations with a home directory.
## Set a password
sudo passwd dspace
Purpose: Set password for DSpace user
Explanation: This command sets a password for the DSpace user (you'll be prompted to enter and confirm the password).
## Grant sudo access
sudo usermod -aG sudo dspace
Purpose: Add DSpace user to sudo group
Explanation: This command adds the DSpace user to the sudo group, granting administrative privileges.
## Create the DSpace installation directory
sudo mkdir /dspace
Purpose: Create DSpace installation directory
Explanation: This command creates the main directory where DSpace will be installed.
## Changes the ownership of the /dspace directory to the dspace user
sudo chown dspace /dspace
Purpose: Set DSpace directory ownership
Explanation: This command changes ownership of the /dspace directory to the dspace user.

Step 7: Download and Set Up DSpace Backend (v9.1)

In this step, we'll download the latest DSpace 9.x backend package (currently DSpace 9.1) and prepare it for configuration and build.

## Create a Temporary Build Directory
sudo mkdir /opt/build
Purpose: Create build directory
Explanation: This command creates a temporary directory for building DSpace.
## Download the Latest DSpace 9.1 Package
sudo wget https://github.com/DSpace/DSpace/archive/refs/tags/dspace-9.1.tar.gz -P /opt/build/
Purpose: Download DSpace source code
Explanation: This command downloads the DSpace 9.1 source code from GitHub to the build directory.
## Extract and Organize the Source Code
sudo tar xzf /opt/build/dspace-9.1.tar.gz -C /opt/build/
Purpose: Extract DSpace archive
Explanation: This command extracts the downloaded DSpace source code.
## Rename Directory (Cleanup)
sudo mv /opt/build/DSpace-dspace-9.1/ /opt/build/dspace-backend
Purpose: Rename DSpace directory
Explanation: This command renames the extracted directory for easier reference.
## Remove Downloaded Archive
sudo rm /opt/build/dspace-9.1.tar.gz
Purpose: Clean up downloaded file
Explanation: This command removes the downloaded archive file after extraction.
## Change the permission
sudo chmod 777 -R /opt/build
Purpose: Set permissions on build directory
Explanation: This command sets full permissions on the build directory to avoid permission issues during the build process.
## Configure DSpace Backend
Navigate to the DSpace config directory:
cd /opt/build/dspace-backend/dspace/config/
Purpose: Change to config directory
Explanation: This command navigates to the DSpace configuration directory.
Copy the local.cfg.example to local.cfg:
sudo cp local.cfg.EXAMPLE local.cfg
Purpose: Create local configuration
Explanation: This command creates the local configuration file from the example template.
Edit the file using a nano text editor:
sudo nano local.cfg
Purpose: Edit DSpace configuration
Explanation: This command opens the DSpace configuration file for editing.
Update key settings in local.cfg:
Replace localhost with your actual domain or IP address for public access.
# Backend REST server
dspace.server.url = http://localhost:8080/server
Purpose: Set backend URL
Explanation: This configuration sets the URL for the DSpace backend REST API.
# Angular frontend
dspace.ui.url = http://localhost:4000
Purpose: Set frontend URL
Explanation: This configuration sets the URL for the DSpace Angular frontend.
# Site name
dspace.name = DSpace at My University
Purpose: Set institution name
Explanation: This configuration sets the name of your DSpace repository.
# DB credentials
db.username = dspace
Purpose: Set database username
Explanation: This configuration sets the PostgreSQL database username for DSpace.
db.password = dspace
Purpose: Set database password
Explanation: This configuration sets the PostgreSQL database password for DSpace.
Default Local Assetstore Setup:
# Uncomment this line by deleting #:
assetstore.dir = ${dspace.dir}/assetstore
Purpose: Set assetstore directory
Explanation: This configuration sets the directory where DSpace will store uploaded files.
# Enable Solr by Uncomment this line by deleting #:
solr.server = http://localhost:8983/solr
Purpose: Set Solr server URL
Explanation: This configuration sets the URL for the Solr search server.
## Set Up Local Assetstore
sudo mkdir -p /dspace/assetstore
Purpose: Create assetstore directory
Explanation: This command creates the directory where DSpace will store uploaded files.
sudo chown -R tomcat:tomcat /dspace/assetstore
Purpose: Set assetstore permissions
Explanation: This command sets ownership of the assetstore directory to the Tomcat user.
## Build and Install the DSpace Backend
Switch to Root User:
sudo su
Purpose: Switch to root user
Explanation: This command switches to the root user for the build process.
Navigate to the Build Directory (DSpace installation source code)
cd /opt/build/dspace-backend/
Purpose: Change to build directory
Explanation: This command navigates to the DSpace source code directory.
Build the backend using Maven
mvn package
Purpose: Build DSpace with Maven
Explanation: This command compiles the DSpace source code and creates deployment packages using Maven.
Install Using Ant:
cd dspace/target/dspace-installer
Purpose: Change to installer directory
Explanation: This command navigates to the DSpace installer directory created by Maven.
ant fresh_install
Purpose: Install DSpace with Ant
Explanation: This command installs DSpace to the /dspace directory using Ant.
Exit root.
exit
Purpose: Exit root user
Explanation: This command exits the root user session and returns to the regular user.
## Deploy DSpace webapps to Tomcat and Solr
Copy DSpace backend webapps to Tomcat:
sudo cp -R /dspace/webapps/* /var/lib/tomcat10/webapps
Purpose: Deploy DSpace web applications
Explanation: This command copies the DSpace web applications to the Tomcat webapps directory.
Copy DSpace Solr cores to the Solr data directory:
sudo cp -R /dspace/solr/* /opt/solr/server/solr/
Purpose: Deploy Solr cores
Explanation: This command copies the DSpace Solr search cores to the Solr server directory.
sudo chown -R solr:solr /opt/solr/server/solr
Purpose: Set Solr core permissions
Explanation: This command sets ownership of the Solr cores to the Solr user.
sudo systemctl restart solr
Purpose: Restart Solr
Explanation: This command restarts Solr to load the DSpace cores.
## Initialize the Database
Run the migration to set up schema:
cd /dspace/bin/
Purpose: Change to DSpace bin directory
Explanation: This navigates to the DSpace binary directory where essential administrative commands are available.
sudo ./dspace database migrate
Purpose: Apply database migrations
Explanation: This command initializes or updates the database schema for DSpace by applying the latest migrations.
## Create DSpace Administrator Account
sudo ./dspace create-administrator
Purpose: Create a DSpace admin user
Explanation: This command starts a prompt to create the initial DSpace administrator, which is required to access the admin panel.
## Set Permissions Ownership and Restart Tomcat and Solr
sudo chown -R tomcat:tomcat /dspace/
Purpose: Set ownership of DSpace files
Explanation: This sets proper ownership so that the Tomcat process can access and manage DSpace files without permission errors.
sudo systemctl restart tomcat10
Purpose: Restart Tomcat server
Explanation: Restarts the Tomcat application server to load the deployed DSpace application and reflect recent changes.
sudo systemctl restart solr
Purpose: Restart Solr
Explanation: This command restarts Solr to ensure it's running with the DSpace cores.
## Verify Backend Installation.

Once the backend is deployed, you can verify it's running by accessing the following endpoints in your browser.

Note: Replace localhost with your actual server IP or domain name if accessing remotely.

REST API:
http://localhost:8080/server
Purpose: REST API endpoint
Explanation: This is the URL for the DSpace REST API, which should return a response if the backend is running correctly.
OAI-PMH:
http://localhost:8080/server/oai/request?verb=Identify
Purpose: OAI-PMH endpoint
Explanation: This is the URL for the OAI-PMH interface, which should return repository information if configured correctly.

How to Install DSpace 9 Angular Frontend (User Interface) on Ubuntu 24.04 LTS ?

Installing the DSpace Angular Frontend

This guide walks through the complete process of installing and configuring the DSpace Angular frontend for your DSpace repository.

Step 1: Install Node.js Using NVM

Official Documentation Reference: For complete and up-to-date instructions, please refer to the Official DSpace Installation Guide.

DSpace requires Node.js version v18.19+, v20.x, or v22.x for optimal performance and compatibility. For best compatibility and stability, Node.js v22.18.0 (LTS) is recommended.

For more details, visit the official Node.js download page. When selecting from the dropdown on the Node.js website, choose:

  • Version: v22.18.0 (LTS)
  • Operating System: Linux (if you're installing on Ubuntu or another Linux distro)
  • Installation method: nvm (Node Version Manager)
  • Package manager: npm (included with Node.js)
sudo su
Purpose: Switch to root user
Explanation: This command switches the current user to the root (superuser) account, giving you full administrative privileges. Use this when you need to perform multiple administrative commands without prefixing each one with "sudo".
sudo apt update
Purpose: Updates the package lists for upgrades and new packages
Explanation: This command refreshes your local package index with the latest changes made in repositories. It's good practice to run this before installing new software.
sudo curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
Purpose: Downloads and installs NVM (Node Version Manager)
Explanation: This command uses curl to download the NVM installation script from GitHub and immediately executes it with bash. NVM allows you to easily install and manage multiple Node.js versions.
. "$HOME/.nvm/nvm.sh"
Purpose: Loads NVM into your current shell session
Explanation: This command sources the nvm.sh script, making the nvm command available in your current terminal session. After installation, you may need to restart your terminal or run this command to start using NVM.
nvm install 22
Purpose: Installs Node.js version 22.x
Explanation: This command tells NVM to download and install the latest version of Node.js in the v22 series. DSpace requires this specific version for compatibility with its Angular frontend.
# Should output: v22.18.0 (or similar)
node -v
Purpose: Checks the installed Node.js version
Explanation: This command displays the currently active Node.js version. After installation, you should see version 22.18.0 or similar, confirming that Node.js was installed correctly.
# Should output the npm version bundled with Node.js (e.g., 10.8.2)
npm -v
Purpose: Checks the installed npm version
Explanation: This command displays the version of npm (Node Package Manager) that came bundled with your Node.js installation. npm is used to manage JavaScript packages and dependencies for your DSpace frontend.

Step 2: Install PM2 Globally

PM2 is a popular Node.js process manager that helps keep your frontend running smoothly in production.

npm install --global pm2
Purpose: Installs PM2 globally on your system
Explanation: This command installs the PM2 process manager globally, making it available system-wide. PM2 helps manage Node.js applications, ensuring they stay running and can restart automatically if they crash.

Verify the installation:

pm2 -v
Purpose: Checks the installed PM2 version
Explanation: This command displays the version of PM2 that was installed, confirming the installation was successful.

Step 3: Download and Build the DSpace Frontend

Navigate to your preferred directory and download the DSpace frontend source code:

cd /opt/
Purpose: Navigate to the /opt/ directory
Explanation: This command changes the current working directory to /opt/, which is a standard directory for installing optional software packages on Linux systems.
sudo wget https://github.com/DSpace/dspace-angular/archive/refs/tags/dspace-9.1.tar.gz
Purpose: Download the DSpace Angular frontend source code
Explanation: This command uses wget to download the compressed source code archive (tar.gz) for DSpace Angular version 9.1 from GitHub. The sudo command is used to ensure proper permissions.
sudo tar xzf dspace-9.1.tar.gz
Purpose: Extract the downloaded archive
Explanation: This command extracts the contents of the compressed tar.gz file. The options used are: x (extract), z (uncompress gzip), and f (file).
sudo mv dspace-angular-dspace-9.1/ dspace-angular
Purpose: Rename the extracted directory
Explanation: This command moves (renames) the extracted directory from "dspace-angular-dspace-9.1" to the simpler name "dspace-angular" for easier reference in subsequent commands.
sudo rm dspace-9.1.tar.gz
Purpose: Remove the downloaded archive file
Explanation: This command deletes the compressed archive file after extraction to free up disk space, as the extracted files are now available in the directory.

Change into the frontend directory, install dependencies, and build the production-ready code:

cd dspace-angular
Purpose: Navigate to the DSpace Angular directory
Explanation: This command changes the current working directory to the "dspace-angular" folder where the DSpace frontend source code was extracted in the previous step.
npm install
Purpose: Install project dependencies
Explanation: This command reads the package.json file and installs all the required Node.js dependencies and libraries needed to build and run the DSpace Angular frontend. This may take several minutes to complete.
npm run build:prod
Purpose: Build the production version of the frontend
Explanation: This command compiles and builds the DSpace Angular frontend optimized for production use. It creates minified JavaScript files, optimizes assets, and prepares the application for deployment in a production environment.

Step 4: Configure the Frontend

Change into the frontend directory

cd /opt/dspace-angular
Purpose: Navigate to the DSpace Angular directory
Explanation: This command changes the current working directory to the "dspace-angular" folder where the DSpace frontend source code was extracted.

Copy the example configuration file and modify it for your environment:

cd config
Purpose: Navigate to the config directory
Explanation: This command changes the current working directory to the "config" folder where the DSpace configuration files are located.
cp config.example.yml config.prod.yml
Purpose: Create production configuration file
Explanation: This command copies the example configuration file (config.example.yml) to create a production configuration file (config.prod.yml) that will be used for your specific environment.

Open config.prod.yml and update the REST API server settings:


ui:
  ssl: false
  host: localhost
  port: 4000
  nameSpace: /
  
rest:
  ssl: false
  host: localhost
  port: 8080
Purpose: Configures the connection to the DSpace backend REST API. update the rest: section part from true to false
Explanation: These settings configure how the frontend connects to the backend. "ssl: false" indicates no encryption, "host: localhost" means the backend is on the same server, and "port: 8080" specifies the port where the backend is running.

Step 5: Deploy the Frontend

Create a deployment directory and set proper permissions:

sudo mkdir -p /opt/dspace-ui
Purpose: Create deployment directory
Explanation: This command creates the directory "/opt/dspace-ui" where the DSpace frontend will be deployed. The "-p" flag ensures that parent directories are created if they don't exist.
sudo chown $tomcat:$tomcat /opt/dspace-ui
Purpose: Set directory ownership
Explanation: This command changes the ownership of the deployment directory to the Tomcat user and group. Replace "$tomcat" with your actual Tomcat username (typically "tomcat" or "dspace").

Change into the frontend directory

cd /opt/dspace-angular
Purpose: Navigate to the DSpace Angular directory
Explanation: This command changes the current working directory to the "dspace-angular" folder where the DSpace frontend source code was extracted.
cp -r dist /opt/dspace-ui/
Purpose: Copy built files to deployment directory
Explanation: This command copies the entire "dist" directory (which contains the built frontend files) to the deployment directory. The "-r" flag ensures recursive copying of all files and subdirectories.

Create a PM2 configuration file to manage the frontend process:

sudo nano /opt/dspace-ui/dspace-ui.json
Purpose: Creates a PM2 configuration file for the DSpace frontend
Explanation: This command opens the nano text editor to create a JSON configuration file for PM2. This file will tell PM2 how to run and manage the DSpace frontend process.

Add the following content:

{
  "apps": [
    {
      "name": "dspace-ui",
      "cwd": "/opt/dspace-ui",
      "script": "dist/server/main.js",
      "instances": "max",
      "exec_mode": "cluster",
      "env": {
        "NODE_ENV": "production"
      }
    }
  ]
}
Purpose: PM2 configuration for running the DSpace frontend
Explanation: This JSON configuration tells PM2 to run the DSpace UI application from the specified directory, using the cluster mode to maximize performance across CPU cores, with production environment settings.

Start the frontend using PM2:

cd /opt/dspace-ui
Purpose: Navigate to deployment directory
Explanation: This command changes the current working directory to "/opt/dspace-ui" where the DSpace frontend files are deployed and where the PM2 configuration file is located.
pm2 start dspace-ui.json
Purpose: Start DSpace UI with PM2
Explanation: This command starts the DSpace frontend application using PM2 and the configuration specified in the "dspace-ui.json" file. PM2 will manage the application process.
pm2 startup
Purpose: Configure PM2 to start on system boot
Explanation: This command generates and configures a startup script to automatically launch PM2 and its managed processes when the system boots up.
pm2 save
Purpose: Save current PM2 process list
Explanation: This command saves the current list of managed processes to PM2's persistent storage, ensuring that all running applications will be restored automatically after system reboot.

Step 6: Set Up Apache Reverse Proxy

To allow users to access the frontend via standard HTTP ports, set up an Apache reverse proxy:

sudo apt install apache2
Purpose: Install Apache web server
Explanation: This command installs the Apache HTTP server, which will act as a reverse proxy to forward requests to the DSpace frontend and backend services.
sudo a2enmod proxy
Purpose: Enable Apache proxy module
Explanation: This command enables the main proxy module for Apache, which provides the core functionality for forwarding requests to other servers (reverse proxy).
sudo a2enmod proxy_http
Purpose: Enable HTTP proxy module
Explanation: This command enables the HTTP proxy module, which extends the proxy functionality to handle HTTP and HTTPS requests specifically.
sudo a2enmod ssl
Purpose: Enable SSL module
Explanation: This command enables the SSL module, which provides support for HTTPS encrypted connections. This is necessary even if you're initially using HTTP, as it may be needed for future SSL configuration.

Create a new Apache site configuration:

sudo nano /etc/apache2/sites-available/dspace.conf
Purpose: Creates an Apache configuration file for DSpace
Explanation: This command opens the nano text editor to create a new Apache virtual host configuration file specifically for DSpace.

Paste this configuration:

<VirtualHost *:80>
    ServerName localhost

    ProxyPreserveHost On

    RequestHeader set X-Forwarded-Proto "http"
    RequestHeader set X-Forwarded-Port "80"

    ProxyPass / http://localhost:4000/
    ProxyPassReverse / http://localhost:4000/

    ProxyPass /server http://localhost:8080/server
    ProxyPassReverse /server http://localhost:8080/server

    ErrorLog ${APACHE_LOG_DIR}/dspace-error.log
    CustomLog ${APACHE_LOG_DIR}/dspace-access.log combined
</VirtualHost>
Purpose: Apache reverse proxy configuration for DSpace
Explanation: This Apache configuration sets up a reverse proxy that forwards requests to the appropriate services: frontend requests (/) to port 4000 (where the Angular app runs) and backend API requests (/server) to port 8080 (where the DSpace REST API runs).

Enable the site and restart Apache:

sudo a2dissite 000-default.conf
Purpose: Disable default Apache site
Explanation: This command disables the default Apache website that shows the "It works!" page, making way for the DSpace site to be the primary website served by Apache.
sudo a2ensite dspace
Purpose: Enable DSpace site configuration
Explanation: This command enables the DSpace site configuration that you created earlier. It creates a symbolic link from sites-available to sites-enabled, telling Apache to serve the DSpace application.
sudo systemctl restart apache2
Purpose: Restart Apache web server
Explanation: This command restarts the Apache service to apply all the configuration changes made, including enabling the DSpace site and disabling the default site.

Step 7: Verify the Frontend Installation

Check PM2 process status and logs:

pm2 status
Purpose: Check PM2 process status
Explanation: This command displays the status of all applications managed by PM2, showing whether the DSpace UI process is running, stopped, or experiencing issues.
pm2 logs dspace-ui
Purpose: View DSpace UI application logs
Explanation: This command displays the real-time logs for the DSpace UI application, which is useful for troubleshooting any errors or issues with the frontend.

Test the REST API connection:

cd /opt/dspace-angular
Purpose: Navigate to DSpace Angular directory
Explanation: This command changes to the DSpace Angular source directory where the test scripts are located.
npm run test:rest
Purpose: Test REST API connection
Explanation: This command runs a script that tests the connection between the DSpace frontend and backend REST API, verifying that they can communicate properly.

Note: Make sure your DSpace backend is running before testing the frontend. The frontend needs to connect to the REST API on port 8080.

Important: If you're installing on a production server, replace "localhost" with your actual domain name in the configuration files and Apache virtual host.

Tuesday, January 16, 2024

Installing VIVO 1.14 (Latest Version) on ubuntu 22.04 (LTS)

 Minimum Requirement to install VIVO in ubuntu 22.04 (LTS).

  1. Operating System (VIVO can be install in any operating system - UNIX-like  (eg, Linux, CentOS), macOS, Windows)
  2. Java 8 or 11
  3. Maven 3.6.1 or later
  4. Tomcat 8 or 9
  5. Solr 8.x
  6. Optional - MySQL / MariaDB 5.5 or later (or any other supported by Jena SDB)



==============Update and Upgrade ubuntu==============

Tuesday, July 11, 2023

How to Install SubjectPlus 4.6 on Ubuntu 22.04 LTS

What is SubjectsPlus?

It is the information, content creation, management and pathfinder Software that is free and Open Source created by Ithaca College Library, and presently, it is maintained by the University of Miami Libraries, this (SubjectsPlus) is based on web 2.0 library information sharing system tools to manage and organize resources effectively.

This software is mostly used by Librarians and subject experts in many ways such as 

  1. To create different guides
    • Subject Guide
    • Research Guide
    • Course Guide
    • Audio-Visual Guide
    • Subject-Expert Guide
  2. To create directories/bibliographies
    • Staff Directory
    • Customize bibliographies for the user
  3. To create the list of Subscribed and open-source resources/databases
    • A to Z list of library resources.
    • A to Z list of database.
  4. To create a content management system (CMS)

    Due to its nature, we can customise this according to the needs of our users and staff by providing an excellent graphical user interface (GUI).

    How to install it?

    Before installing the SubjectsPlus, first, you will need any one of the following stack:-

    LAMP

      • L - Linux (Operating System)
      • A - Apache (Web Server)
      • M - MySQL/ MariaDB (Relational Database Management System)
      • P - PHP (Hypertext Preprocessor)

    WAMP

      • W - Windows (Operating System)
      • A - Apache (Web Server)
      • M - MySQL/ MariaDB (Relational Database Management System)
      • P- PHP (Hypertext Preprocessor)

    MAMP

      • M - macOS (Operating System)
      • A - Apache (Web Server)
      • M - MySQL/ MariaDB (Relational Database Management System)
      • P - PHP (Hypertext Preprocessor)

    So, we will install the SubjectsPlus 4.6 version using the LAMP stack.


    Prerequisites (for version 4.6)

    Before diving into the installation process, make sure you have the following prerequisites in place:-
    • LAMP
      • L - Linux (Operating System)
        • Ubuntu 22.04
      • A - Apache (Web Server)
        • Apache2
      • M - MySQL/ MariaDB (Relational Database Management System)
        • MySQL 5.6/5.7 or
        • MariaDB 10.x
      • P - PHP (Hypertext Preprocessor)
        • PHP 7.4

    Step 1: Update and upgrade the Ubuntu OS

    sudo apt update && sudo apt upgrade -y

    Step 2: Installation of apache2 web server

    sudo apt install apache2

    Step 3: Install PHP and Required Extensions

    • Dependencies Installation
    Required few dependencies while installing in Ubuntu 22.04

    sudo apt install software-properties-common ca-certificates lsb-release apt-transport-https
    • Add Ondrej PPA to the sytem
    LC_ALL=C.UTF-8 sudo add-apt-repository ppa:ondrej/php

    • Update Package Manager Cache

    sudo apt update

    • Install PHP 7.4
    sudo apt install php7.4 php7.4-cli php7.4-fpm php7.4-mysql php7.4-json php7.4-curl php7.4-mbstring php7.4-xml php7.4-zip php7.4-gd php7.4-intl php7.4-gettext

    Step 4: Install and Configure MariaDB


    Install MariaDB and set up a database by executing these commands:

    This command install the MariaDB server package installs on your system
    sudo apt install mariadb-server
    This script will prompt you to perform actions such as setting the root password, removing anonymous users, disallowing remote root login, and removing test databases.
    sudo mysql_secure_installation


    This command opens MariaDB server console using the root user and prompts you for the root password. 
    After entering the password, you'll be in the MariaDB command-line interface.
    sudo mysql -u root -p

    This command creates a new database named subjectsplus.
    ***Replace subjectsplus with the actual database name you want to set for the installation of subjectsplus
    CREATE DATABASE subjectsplus;

    This command creates a new user named spuser who can connect from the localhost (the same machine) and specifies the user's password.
    ***Replace 'your_password', spuser and localhost with the actual user, host and password you want to set for this user.
    CREATE USER 'spuser'@'localhost' IDENTIFIED BY 'your_password';

    This command grants all privileges on the subjectsplus database to the spuser user, allowing them to perform various operations on the database.
    ***Replace subjectsplusspuser and localhost with the actual name of your installation that you mentioned earlier
    GRANT ALL PRIVILEGES ON subjectsplus.* TO 'spuser'@'localhost';

    This command reloads the privileges to apply the changes you've made.
    FLUSH PRIVILEGES;

    then exit the SQL console
    EXIT;


    Step 4: Download the required files from the GitHub page and Install SubjectsPlus

    cd /var/www/html
    sudo wget https://github.com/subjectsplus/SubjectsPlus/archive/refs/tags/v4.6.tar.gz
    sudo tar -xvf v4.6.tar.gz
    sudo mv SubjectsPlus-4.6 guide
    cd guide


    Step 5: Change Folder Ownership

    www-data: user and 
    :www-data group are often used by web servers to access and serve web content, including files and scripts.
    sudo chown -R www-data:www-data /var/www/html/guide

    Step 6: Folder permission

    • For /guide/control/includes/config-default.php:
    chmod 644 /var/www/html/guide/control/includes/config-default.php
    • For /guide/control/includes/ (and files within it):

    chmod 755 /var/www/html/guide/control/includes/

    • For /guide/subjects/.htaccess:

    chmod 664 /var/www/html/guide/subjects/.htaccess

    • For /guide/api/.htaccess:

    chmod 664 /var/www/html/guide/api/.htaccess

    • For /guide/assests/users/ (and files within it):

    chmod 755 /var/www/html/guide/assets/users/

    • For /guide/assests/cache/ 

    chmod 755 /var/www/html/guide/assets/cache/

    • For /guide/assets/images/video_thumbs

    chmod 755 /var/www/html/guide/assets/images/video_thumbs