DSpace 7.6.1 System Requirements
- Debian: Version 11
- JDK: Either JDK 11 or JDK 17 (JDK17 support was first available in DSpace 7.2. DSpace 7.1 and 7.0 only supported JDK 11.)
- Apache Maven: Version 3.5.4 or above (Java build tool)
- Apache Ant: Version 1.10.x or later (Java build tool)
- While Apache Ant recommends using v1.10.x for Java 11, we’ve also had some success with recent versions of 1.9.x (specifically v1.9.15 seems to work fine with Java 11). However, earlier versions of v1.9.x are not compatible with Java 11.
- Relational Database (PostgreSQL):
- PostgreSQL versions supported: 12.x, 13.x, 14.x, or 15.x (with pgcrypto installed)
- Apache Solr: Version 8.x (full-text index/search service)
- Solr 8.11.1 or above is recommended, as all prior 8.x releases are vulnerable to CVE-2021-44228 (log4j critical vulnerability). If you must use a prior version of 8.x, make sure to add -Dlog4j2.formatMsgNoLookups=true to your SOLR_OPTS environment variable.
- Servlet Engine:
- Supported options: Apache Tomcat 9, Jetty, Caucho Resin, or equivalent
- Note: Only Tomcat 9 is supported at this time. Tomcat 10 is incompatible with Tomcat 9 and will not be supported until DSpace 8.0 at the earliest.
DSpace 7.6.1 consists of a Java-based backend and an Angular-based frontend. Both the backend and frontend need to be installed independently
Installation Steps
System Update and Upgradesudo apt update && sudo apt upgrade -y
JDK installation and configurationsudo apt install default-jdk -y
Identify the Java Version Installedjava -version
Add Java Environment Variablecd /etc
sudo nano environment
Copy paste the bellow lines to the newly opened blank file. dont forgot to change the java version which i marked in red colour if it is different from mine
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
JAVA_OPTS="-Xmx2048M -Xms1024M -Dfile.encoding=UTF-8"
Save and close the file.
Configuration Explanation
- Increased heap size:
- -Xmx2048M: Maximum heap size is increased to 2GB.
- -Xms1024M: Initial heap size is increased to 1GB.
- This provides more memory for DSpace to operate, potentially improving performance, especially when handling large datasets or heavy loads.
Apply the following commands to check Java Home Environment is Configured successfullysource /etc/environment
echo $JAVA_HOME
echo $JAVA_OPTS
Maven & Ant Installationsudo apt install maven ant -y
Check the Version Details of ant (version should be 1.10.x or above) and maven (version should be 3.5.4 or above) ant -version
mvn -v
To install DSpace 7.6.1, you need PostgreSQL version 12.x, 13.x, 14.x, or 15.x with the pgcrypto extension installedsudo apt-get install postgresql postgresql-client postgresql-contrib libpostgresql-jdbc-java -y
Identify the version of Postgresql Installed ( in my case it is psql 13.xx)sudo -u postgres psql
exit from postgresql console\q
Start PostgreSQL (Don’t forgot to change the postgreSQL version as per your installation)sudo pg_ctlcluster 13 main start
Check the status of PostgreSQLsudo systemctl status postgresql
Set Password to PostgreSQL Usersudo passwd postgres
# I have given dspace as password for my installation.
Switch to postgres unix Usersu postgres
Execute the bellow command in postgres user to check whether it support UTFpsql -c "SHOW SERVER_ENCODING"
If it return UTF8 which means the UTF8 is Supported
Exit from postgres userexit
PostgreSQL Configurationcd /etc/postgresql/13/main
sudo nano postgresql.conf
The above command will open pgsql configuration file, in which UNCOMMENT (remove the # symbol From the First Portion) the line listen_addresses = ‘localhost’ under connection settings option. Save and exit
Postgres Security Tighten Commandsudo nano pg_hba.conf
it will open the Postgres configuration file in which Add a comment above the line “# Database administrative login by Unix domain socket”. Name the comment “# Dsapce Configuration”. Then, copy the line below the comment and save it
# Dspace Configuration host dspace dspace 127.0.0.1 255.255.255.255 md5
Restart postgressudo systemctl restart postgresql
Appache Solr Installation (Don’t forgot to change the solr version as per your installation)
apt install zip unzip -y
cd /opt
sudo wget https://downloads.apache.org/lucene/solr/8.11.3/solr-8.11.3.zip
sudo unzip solr-8.11.3.zip
rm solr-8.11.3.zip
Create a user named ‘dspace‘ and change ownership of the solr folder to dspacesudo useradd -m dspace
sudo passwd dspace
sudo chown -R dspace:dspace solr-8.11.3
# I Have given dspace as password for my installation
Now start the Solr service
Switch user to dspace unix usersu dspace
cd /opt/solr-8.11.3/bin/
/opt/solr-8.11.3/bin/solr start
Wait until Solr Starts
After the execution complete browse, the solr url
http://your-ip-address:8983 – It will show the solr page
create corn job for Solr to auto start on System Rebootcrontab -e -u dspace
Add the below line in the bottom of cron job opened
@reboot /opt/solr-8.11.3/bin/solr start
Save and exit
TOMCAT 9 Installation and configuration
Now open a new terminal with root user privilege please don’t close the existing terminal, We can call the existing dspace user tab as (dspace user terminal) and root user terminal as (root user terminal)
Commands to execute in sudo user terminal are listed bellow (in my case root is the sudo user)
su root
Install Tomcat9 (Only Tomcat 9 is supported at this time. Tomcat 10 is incompatible with Tomcat 9 and will not be supported until DSpace 8.0)
sudo apt install tomcat9 -y
Tomcat 9 Configurationcd /lib/systemd/system/
sudo nano tomcat9.service
It will open a file in which move to security section and add the bellow line as last option to security and then save the file and exit
ReadWritePaths=/dspace/
Create Required Dspace folder and provide Sufficient User privileges
cd /
sudo mkdir /dspace
sudo chown -R dspace:dspace /dspace
sudo systemctl daemon-reload
sudo systemctl restart tomcat9
Restart Cron Jobsudo systemctl restart cron.service
To test tomcat is working execute the URL in your browser with your IP address
http://your-ip-address:8080
Next modify tomcat configurationcd /etc/tomcat9
sudo nano /etc/tomcat9/server.xml
Locate the bellow mentioned line
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
Comment the line with <!— in the first line and –> in the last line
Add the bellow lines just above to the commented line and save the content and exit the console
<Connector port="8080" minSpareThreads="25" enableLookups="false" redirectPort="8443" connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="UTF-8"/>
Now Restart the Tompcat9 with the new configuration
sudo systemctl daemon-reload
sudo systemctl restart tomcat9.service
Dspace 7.6.1 Backend installation
sudo apt install git -y
Commands to execute In dspace user Terminal ……… Please note that this should not be executed with sudo privilege in terminal. By changing the Version number mentioned in red , you can install any 7.X versions
su dspace
cd
wget https://github.com/DSpace/DSpace/archive/refs/tags/dspace-7.6.1.zip
unzip dspace-7.6.1.zip
rm dspace-7.6.1.zip
cd DSpace-dspace-7.6.1
POSTGRES CONFIGURATION
Open a New Terminal and login as Postgres Usersu postgres
cd /etc/postgresql/13/main
Now we are going to create the user named dspace by executing the bellow command after executing the bellow command it will ask for a password remember the password that you have typed .. this is the connection password for dspace db
createuser --username=postgres --no-superuser --pwprompt dspace
# In my installation I have given dspace as password
Now we are going to create a Db named Dspace and going to make the dspace user which we have created in the previous step as the owner for dspace db
createdb --username=postgres --owner=dspace --encoding=UNICODE dspace
Enable PgCrypto Extension
psql dspace -c "CREATE EXTENSION pgcrypto;"
Apply the following command to exit from postgres user.exit
Commands to execute In dspace user Terminal ……… Please note that this should not be executed with root terminal or postgres terminal
su dspace
cd /home/dspace/DSpace-dspace-7.6.1/dspace/config
cp local.cfg.EXAMPLE local.cfg
nano local.cfg
It will open a file in which change the details marked in red colour to your server details and save the file
dspace.server.url = http://your-ip-address:8080/server dspace.ui.url = http://your-ip-address:4000 dspace.name = Your Repository Name
Uncomment Solr.server line and change the line as below
solr.server = http://your-ip-address:8983/solr
Under Database configuration provide the actual db.username and db.password set by you.
db.username = dspace db.password = dspace
Make sure you are executing the bellow commands as dspace unix usersu dspace
cd /home/dspace/DSpace-dspace-7.6.1
mvn package
The above command will take 10 to 30 minutes sometimes more than that which depends up on your internet speed and server responses. If everything done well you will get a BUILD SUCCESS Message in the end
Now Execute the bellow steps to initiate a fresh installsu dspace
cd /home/dspace/DSpace-dspace-7.6.1/dspace/target/dspace-installer
ant fresh_install
If everything done well you will get a BUILD SUCCESS Message in the end. Now the backend installation completed
Now we need to do the database initialisationcd /dspace/bin
./dspace database migrate
The Above command will take more time to complete. Once its complete you will get a done message.
Run the bellow command as sudo user terminal since the tomcat folder owned by root
su root
sudo cp -R /dspace/webapps/* /var/lib/tomcat9/webapps/ROOT/
sudo cp -R /dspace/webapps/* /var/lib/tomcat9/webapps/
Check whether server folder in rooot & webapps copied using the bellow command
ls -la /var/lib/tomcat9/webapps/ROOT/
ls -la /var/lib/tomcat9/webapps/
There you can see the server folder with root as owner
Now run the commands in dspace unix user terminal
su dspace
cp -R /dspace/solr/* /opt/solr-8.11.3/server/solr/configsets
chown -R dspace:dspace /opt/solr-8.11.3/server/solr/configsets
cd /opt/solr-8.11.3/bin
./solr restart
Now open browser and browse http://your-ip-address:8983 and test that you are able to see the core selector dropdown menu in the left pane
Now create dspace administrator account
/dspace/bin/dspace create-administrator
Provide answer for the Queries prompted in the screen
Run the bellow command as sudo user terminal since the tomcat folder owned by root
su root
sudo chown -R tomcat:tomcat /dspace
sudo systemctl daemon-reload
sudo systemctl restart tomcat9.service
Now Open a Browser and test the bellow pages are displaying
http://your-ip-address:8080/server/#/server/api
http://your-ip-address:8080/server/oai/request?verb=Identify
Dspace 7.6.1 Angular – Frontend Installation
Node Installation
Run The Commands in sudo user Terminalsu root
Install node version managercurl -o- https://raw.githubusercontent.com/creationix/nvm/v0.39.1/install.sh | bash
Reboot Serverreboot
Load NVM to the terminal sessionsource ~/.nvm/nvm.sh
Install npmsudo apt install npm -y
Install yarnsudo npm install -g yarn
Install node 14 / 16 / 17 / 18 / 19 versions ( “node Expected version “^14 || ^16 || ^17 || ^18 || ^19” for our Yarn Installation)
sudo npm install -g n
List the Latest Stable Version
n ls-remote --stable
Presently the Stable Version is 20.11.1 but in Our Dspace Scenario we need to install 14 or 16 or 17 or 18 or 19 versions only ( in my case I installed 18.10.0 while preparing the document)
sudo n 18.10.0
Install pm2 (node.js process manager)sudo npm install -g pm2
Install required angular dependenciessudo npm install -g yarn
Angular Frontend Installation
cd /home/dspace/
wget https://github.com/DSpace/dspace-angular/archive/refs/tags/dspace-7.6.1.zip
unzip dspace-7.6.1.zip
rm dspace-7.6.1.zip
cd /home/dspace/dspace-angular-dspace-7.6.1
yarn install
Now Edit the Angular Configuration File
cd /home/dspace/dspace-angular-dspace-7.6.1/config
cp config.example.yml config.prod.yml
nano config.prod.yml
The above command will open a file in which Edit the contents marked in red to your ip address and save the file
ui: ssl: false host: your-ip-address port: 4000 If we don’t have ssl then make the bellow changes rest: ssl: false host: your-ip-address port: 8080
The bellow command will check whether the connections work well or not
yarn test:rest
Frontend building Command
yarn build:prod
The above command may take 10 to 30 minutes to complete the build generation. Wait for it. After completion you will get a Done message
Create Production Json File
cd /home/dspace/dspace-angular-dspace-7.6.1/
nano dspace-ui.json
the above command will open a blank file , Copy paste bellow lines to the file and change the red marked content to your actual path and version. then save the file
{ "apps": [ { "name": "dspace-ui", "cwd": "/home/dspace/dspace-angular-dspace-7.6.1", "script": "dist/server/main.js", "instances": "max", "exec_mode": "cluster", "env": { "NODE_ENV": "production", "NODE_OPTIONS": "--max-old-space-size=4096" }, "max_memory_restart": "500M" } ] }
Special Note About the above Configuration
1. Setting “exec_mode” to “cluster” will enable cluster mode , which allows networked applications (HTTP(s)/TCP/UDP servers) to be scaled across all available CPUs without any code modifications
2. The “instances” setting allows you to customize how many CPUs are available to PM2 (“max” = all CPUs. But you also can specify a number like “4” = 4 CPUs. )
3. The “max_memory_restart” setting is optional but tells PM2 how much memory to allow per instance. The example above has a maximum of 500MB. If the number of ‘instances’ is 8, that would mean PM2 could use up to 4 x 500MB = 2GB of memory. Therefore, you may wish to modify the values of “instances” and/or “max_memory_restart” to better control the memory available to PM2. Adjust the value according to your server’s available memory and requirements.
4. The "NODE_OPTIONS" On machines with >2GB of memory available, Node will only use a maximum of 2GB of memory by default (see https://github.com/nodejs/node/issues/28202). This 2GB of memory should be enough to build & run the User Interface, but it’s possible that highly active sites may require 4GB or more.
# In this example, my config is named “dspace-ui.json”
Start the Json File using pm2 Commandpm2 start dspace-ui.json
Now if the configurations are ok then you will get a screen where the status are online, open a browser and check the frontend is working
To Start the service on every restart pl add the code in cronjob of the sudo user
su root
crontab -e
Add the below line in the bottom of cronjob opened and save the file
@reboot pm2 start /home/dspace/dspace-angular-dspace-7.6.1/dspace-ui.json
Restart crontabsudo systemctl restart cron.service
As an additional mechanism To start a PM2 service using the .profile option in Debian 11, you can add the PM2 startup command to your .profile file, which is executed each time you log in.
su root
Open your .profile file located in your home directory with a text editor.nano ~/.profile
Add the following line at the end of the .profile file: and save it
pm2 start /home/dspace/dspace-angular-dspace-7.6.1/dspace-ui.json
To apply the changes without logging out and back in, you can source the .profile file:source ~/.profile
For managing the PM2 process and ensuring it restarts on system reboot, you can set up a PM2 startup script with systemd. This is done by running the following command:pm2 startup systemd
systemctl enable pm2-root
pm2 save
Yes! We have completed the installation process. 🎉😊
Browse the Bellow URL and Test Everything Working Well
http://your-ip-address:4000