Installation of DSpace 7 on ubuntu 22.04 LTS

DSpace-7  introduces an angular-based user interface that combines both JSPUI and XMLUI interfaces. DSpace-7 application is split into two parts front-end and back-end. The front end is the user interface and the back end is used for server API. We need to install both preferably on the same machine in order to make it fully functional. To run the frontend properly, we need to install the backend first.

dspace 7


  • Java JDK  
  • Apache Maven 3.3.x or above.
  • Apache Ant 1.8 or above.
  • PostgreSQL  
  • Apache Tomcat 8 or above version
  • Apache Solr 7.2.1 or above.  (New requirement for DSpace 7)

I have tested the following commands on ubuntu 22.04 LTS. You can follow the same steps on other Linux-based operating systems too. 

Open the terminal (CTRL + ALT + T)

Update  and upgrade the ubuntu system

sudo su 

sudo apt update -y

sudo apt upgrade -y

Install git (Supporting package for the DSpace installation)

sudo apt install git

Install Java development kit (JDK) 

sudo apt install default-jdk 

You can check the java version with the following command (JDK 11 and JDK 17 versions are fully supported to dsapce7)

java -version

Open the following file to activate the JAVA_HOME & JAVA_OPTS environment variable

sudo gedit /etc/environment

Add the following two lines to the file


JAVA_OPTS=”-Xmx512M –Xms64M –Dfile.encoding=UTF-8”

Save and close the file

Apply the following command

source /etc/environment

Check the status that the JAVA_HOME & JAVA_OPTS have been set successfully or not



Install Apache Maven and Apache Ant in the 'etc' directory

cd /etc

sudo apt install maven -y

sudo apt install ant -y

Install Postgresql Database and related packages

sudo apt install postgresql postgresql-client postgresql-contrib

Check the Postgres version

psql -V psql

(Note down the version number. The version numbers vary in Ubuntu 20.04, 22.04, and Debian-11, In my case, this is version 14. Replace the version number in the following command if your Linux distribution is other than Ubuntu 22.04)

sudo pg_ctlcluster 14 main start

Set the Password for Postgres

sudo passwd postgres

(Enter the password e.g. dspace)

Now Connect to the Postgres user 

su postgres

(Enter the password if the system asked)

Run the following commands to check whether UTF8 is enabled or not

cd /etc/postgresql/14/main

psql -c "SHOW SERVER_encoding"

Now, Exit from the Postgres user


Now, open the configure file of PostgreSQL (Change the Postgres version number if you are using other than Ubuntu 22.04)

sudo gedit /etc/postgresql/14/main/postgresql.conf

Uncomment the following line by removing ‘#’ under the connection settings option 

listen_addresses = 'localhost'

Save and Exit

Open the following file and add the line to host-based access on Postgres

sudo gedit /etc/postgresql/14/main/pg_hba.conf

Find the line “# Database administrative login by Unix domain socket” and add the following line above this line.

host dspace dspace md5

Add a line as the below screenshot

Restart the PostgreSQL

sudo systemctl restart postgresql

Solr Installation

Install Solr in the opt directory (Apply the following commands)

cd /opt

sudo wget

Extract the zip file


Delete the solr zip file as it is not required

sudo rm

Change the permission of the solr directory

sudo chown -R vijender:vijender solr-8.11.2

(Change the vijender:vijender with your user name in the above command)

Create the Directory in the root directory with the name dspace

cd / 

sudo mkdir /dspace

Change the permission of the newly created directory

sudo chown -R vijender:vijender /dspace

(Replace the 'vijender:vijender' with your root user name) 

Return to the home directory



Apply the following command from the home directory

gedit .profile

(Paste the following line in the file for auto-start Solr and save the file)

/opt/solr-8.11.2/bin/solr start

Now apply the following commands from the terminal to start the solr

/opt/solr-8.11.2/bin/solr start

Open the following URL in the browser and check whether the Solr admin dashboard is loaded.


Install Tomcat

sudo apt install tomcat9

Open the following file

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

Add the following line at the bottom under the Security


Save and close

Open the following file in the tomcat folder

sudo gedit /etc/tomcat9/server.xml

Find the following lines in the file

<Connector port="8080" protocol="HTTP/1.1"


                   redirectPort="8443" />

Replace the above lines with the following lines

 <Connector port="8080" protocol="HTTP/1.1"

Restart the Tomcat

sudo systemctl restart tomcat9.service

If you see the following warning message while restarting tomcat

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

Run the following command

sudo systemctl daemon-reload

Now-Again restart the Tomcat

sudo systemctl restart tomcat9.service

Backend Installation of Dspace

Download the DSpace-7.3 in the home folder with the following command.


Unzip the DSpace file


(It will unzip the folder named 'Dspace-dspace-7.3')

Remove the zip folder as it is not required

sudo rm

Change the directory and enter the Dspace-dspace-7.3

cd DSpace-dspace-7.3

Change the permission to dspace directory

sudo chown -R vijender:vijender /DSpace-dspace-7.3 

(Replace the vijender:vijender with your root user name)

Now set the database under the dspace

su postgres

(Enter the password if the system prompt to password)

Enter into the following directory (Change the Postgres version number accordingly)

cd /etc/postgresql/14/main

Create the username and the password for the new role

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

(Enter the password e.g dspace)

Create the new database 

createdb --username=postgres --owner=dspace --encoding=UNICODE space

Add pgcrypto extension

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

Exit from Postgres user


DSpace configuration (Enter the dspace configuration directory)

cd DSpace-dspace-7.3/dspace/config

Make a copy of file ‘local.cfg.EXAMPLE’ named ‘local.cfg’

cp local.cfg.EXAMPLE local.cfg

Open the configuration file

gedit local.cfg

Here you will find important lines and their purpose. Make the changes in the file wherever required

# Name of the site

(Change the name of your repository) = DSpace at My University   

# Database username and password

(Change the database username and password if there are any changes)

db.username = dspace

db.password = dspace  

Un-comment (delete the #) the following line

 solr.server = http://localhost:8983/solr         

Save and close the file

Return to the DSpace directory

cd DSpace-dspace-7.3

Build the Installation Package

mvn package

(It may take time to build the package 10 to 40 minutes depending on your internet speed and server response. After the successful installation your terminal screen will look similar to the following image)

Install DSpace Backend (Enter the dspace-installer directory)

 cd DSpace-dspace-7.3/dspace/target/dspace-installer/

Install the ant fresh

ant fresh_install

(It will look similar to the following image after built successfully)

Initialize the Database (Apply the following commands)

cd /dspace/bin

./dspace database migrate

Copy the dspace webapps directory to the Tomcat server

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

Now Copy Solr directory

cd /dspace/solr

cp -R /dspace/solr/* /opt/solr-8.11.2/server/solr/configsets

Now Restart the Solr

cd /opt/solr-8.11.2/bin

./solr restart

Create an Administrator Account

/dspace/bin/dspace create-administrator

(Enter the email address, first name, last name, password, etc.)

Change the permissions of dspace to Tomcat User

sudo chown -R tomcat:tomcat /dspace

Restart the Tomcat

sudo systemctl restart tomcat9.service

Now open the browser and locate the following URL to open the REST API interface


You will see the REST API interface as blow screenshot. Review the steps followed if not load screen like this.

Install Frontend of DSpace

Download Node Version Manager in the home directory


wget -qO- | bash

Restart the Terminal  (Close and Open Again)

Install the latest version of NVM

nvm install --lts

Installation of Yarn

npm install --global yarn

Installation of pm2

npm install --global pm2

Download DSpace Angular (Release7.3) in the home directory


Extract the zip file


Delete the  zip file as it is not required

sudo rm

Install yarn in the dspace angular directory

cd dspace-angular-dspace-7.3

yarn install

Copy and rename the production file 

cd config 

cp config.example.yml

Now open the renamed file


Now, make following changes under The REST API server settings in the file 

# The REST API server settings

# NOTE: these must be 'synced' with the 'dspace.server.url' setting in your backend's local.cfg.


ssl: false

host: localhost

port: 8080

Save and close the file

Build the User Interface 

yarn run build:prod

Go to the dspace-angular-dspace-7.3 directory

cd /home/vijender/dspace-angular-dspace-7.3

(Replace the vijender to your root user name to give the proper path)

Create pm2  dspace-angular.json file

gedit dspace-angular.json 

add the below lines to the file


    "apps": [


           "name": "dspace-angular",

           "cwd": "/home/vijender/dspace-angular-dspace-7.3",

           "script": "dist/server/main.js",

           "env": {

              "NODE_ENV": "production",

   "DSPACE_REST_SSL": "false",

   "DSPACE_REST_HOST": "localhost",

   "DSPACE_REST_PORT": "8080",






(In the above block, the "cwd" setting must correspond to your dspace-angular-dspace-7.3 directory path.)

Start the pm2  (You need to run this command from the same directory of the dspace-angular-dspace-7.3

pm2 start dspace-angular.json

Now open the browser and enter the following URL


Login in the admin panel with the admin user Email- ID and Password

Mr. D P Tripathi (Deputy Librarian at Dr. B R Ambedkar National Institute of Technology)

Post a Comment


  1. sudo chown -R vijender:vijender /DSpace-dspace-7.3
    I have changed the name but permission error chown: cannot access `...' : No such file or directory

    1. I have the same problem , in that step it starts to fail , I could not find the cause of the problem .

    2. Check the Dspace-dspace-7.3 directory, whether it is available in home directory

  2. Hi, have a error in maven-war-plugin 3.2.3