Install Dspace 7.6 on Ubuntu 22.04 LTS
Prerequisite software:
i) Java JDK
ii) Apache Maven
iii) Apache Ant
iv) Apache Tomcat
v) PostgreSQL
vi) Solr
vii) Dspace 7.6 – backend
viii) Dspace-angular 7.6 – frontend
ix) Node.js
x) Node Version Manager (NVM)
xi) Yarn
xii) nano (text editor software)
Note: It is highly recommended to install Dspace7 on fresh installed Linux-based operating system. It may not be compatible with the Virtual box platform.
(Note the red mark lines are the commands that need to be executed on the terminal)
Open the terminal by pressing (Ctrl+Alt+T) or go to Applications > Accessories > Terminal and select it for executing the below command.
First update and upgrade your package system
sudo apt update && sudo apt upgrade -y
Create a Dspace user with password
sudo useradd -m dspace
sudo passwd dspace [Give password, for ex. “dspace”]
Add dspace user to sudoers group
sudo usermod -aG sudo dspace
Create the directory for the DSpace installation.
sudo mkdir /dspace
Change the dspace folder permission to the dspace user.
sudo chown dspace /dspace
Build the Installation Package
Install packages to support the Dspace installation.
sudo apt install wget curl git build-essential nano zip unzip -y
Install Open JDK
sudo apt install openjdk-11-jdk -y
Set the JAVA_HOME & JAVA_OPTS Environment Variable
sudo nano /etc/environment
Add the below two lines at the bottom of the file.
1JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"1JAVA_OPTS="-Xmx512M -Xms64M -Dfile.encoding=UTF-8"Save and close the file.
Run the following commands to check the status of Java Home & Java OPTS
source /etc/environment
echo $JAVA_HOME
echo $JAVA_OPTS
It should display like this
Install Maven and Ant
sudo apt install maven ant -y
Install PostgreSQL
sudo apt-get install postgresql postgresql-client postgresql-contrib libpostgresql-jdbc-java -y
Check the PostgreSQL version number by running the below command
psql -V psql
Version numbers vary in Ubuntu 20.04, 22.04 and Debian 11. Note down it. PostgreSQL 14 is available with Ubuntu 22.04. Check whether the installation of PostgreSQL is successful or not
sudo pg_ctlcluster 14 main start
sudo systemctl status postgresql
Apply the key, Ctrol+C to exit from the screen.
Create a password for PostgreSQL
sudo passwd postgres [Give a password. for ex. “dspace”]
Try to login into PostgreSQL using the password created.
su postgres
The command prompt looks like this postgres@user: if you could log in successfully.
Exit from the current path
exit
Open the following file,
sudo nano /etc/postgresql/14/main/postgresql.conf
Change the version number if you are using Ubuntu 20.04 or Debian 11 users in the above-mentioned command and apply the command on the terminal.
Comment out the line (remove #) listen_addresses = ‘localhost’ under connection settings option.
Save and exit
We have to encrypt the security of PostgreSQL. Change the PostgreSQL version no. if required. Open the following file.
sudo nano /etc/postgresql/14/main/pg_hba.conf
Add the following above the line, # Database administrative login by Unix domain socket.
#DSpace configurationhost dspace dspace 127.0.0.1 255.255.255.255 md5
Restart Postresql
sudo systemctl restart postgresql
Solr Installation
Download the Solr software package from the website.
Enter into the OPT folder.
cd /opt
Download the Solr (version 8) package using the following command line,
sudo wget https://downloads.apache.org/lucene/solr/8.11.3/solr-8.11.3.zip
Unzip the package,
sudo unzip solr-8.11.3.zip
Change Solr permission
ls -la
You can see the permission for solr is only for root user. Change the user name, in my case it is subrat.
sudo chown -R user:user solr-8.11.3
ls -la (Now you can see the user has been changed)
It is not recommended to run solr as a root user, so we have to deploy solr in .profile to run solr. Come back to home folder and apply the commands.
cd
nano .profile
Add the below line in between #umask 022 and # if running bash and save the file
/opt/solr-8.11.2/bin/solr start
To start, stop and restart solr execute the command below
cd /opt/solr-8.11.2/bin
./solr start
./solr stop
./solr restart
./solr status
Browse the below URL for solr running status
http://localhost:8983/solr
Download the DSpace package
Create a temporary folder with the name build in the root folder (/)to store the DSpace package,
sudo mkdir /build
cd /build
Download the DSpace package
sudo wget https://github.com/DSpace/DSpace/archive/refs/tags/dspace-7.6.tar.gz
Extract the package
sudo tar zxvf dspace-7.6.tar.gz
Change the permission of the /build folder.
sudo chmod 777 -R /build
Install Tomcat
sudo apt install tomcat9 -y
Configure DSpace installation path to Tomcat.
sudo nano /lib/systemd/system/tomcat9.service
Add the following line under #Security at the last line
ReadWritePaths=/dspace
Save and close the file.
Alter Tomcat’s default configuration to support searching and browsing of multi-byte UTF-8.
Open the following file
sudo nano /etc/tomcat9/server.xml
Find the below mentioned lines in the file, and comment out. Add <!– in the first line and –> in the last line,
<Connector port="8080" protocol="HTTP/1.1"connectionTimeout="20000"redirectPort="8443" />It will looks like after commented out,
<!-- <Connector port="8080" protocol="HTTP/1.1"connectionTimeout="20000"redirectPort="8443" /> -->Add following lines below the commented out lines,
<Connector port="8080" protocol="HTTP/1.1"minSpareThreads="25"enableLookups="false"redirectPort="8443"connectionTimeout="20000"disableUploadTimeout="true"URIEncoding="UTF-8"/>Save and close the file.Restart Tomcat
sudo systemctl restart tomcat9.service
If it shows the following message,
Warning: The unit file, source configuration file or drop-ins of tomcat9.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.
Apply the following command,
sudo systemctl daemon-reload
Again try to restart the Tomcat,
sudo systemctl restart tomcat9.service
Database setup
sudo su postgres
cd /etc/postgresql/14/main
Create a user named dspace. Enter the password when it asks.
createuser --username=postgres --no-superuser --pwprompt dspacecreatedb --username=postgres --owner=dspace --encoding=UNICODE dspaceEnable pgcrypto extension.
psql --username=postgres dspace -c "CREATE EXTENSION pgcrypto;"exit
Create a new DSpace configuration file.
cd /build/DSpace-dspace-7.6/dspace/config
i) Java JDK
ii) Apache Maven
iii) Apache Ant
iv) Apache Tomcat
v) PostgreSQL
vi) Solr
vii) Dspace 7.6 – backend
viii) Dspace-angular 7.6 – frontend
ix) Node.js
x) Node Version Manager (NVM)
xi) Yarn
xii) nano (text editor software)
Note: It is highly recommended to install Dspace7 on fresh installed Linux-based operating system. It may not be compatible with the Virtual box platform.
(Note the red mark lines are the commands that need to be executed on the terminal)
Open the terminal by pressing (Ctrl+Alt+T) or go to Applications > Accessories > Terminal and select it for executing the below command.
First update and upgrade your package system
sudo apt update && sudo apt upgrade -y
Create a Dspace user with password
sudo useradd -m dspace
sudo passwd dspace [Give password, for ex. “dspace”]
Add dspace user to sudoers group
sudo usermod -aG sudo dspace
Create the directory for the DSpace installation.
sudo mkdir /dspace
Change the dspace folder permission to the dspace user.
sudo chown dspace /dspace
Build the Installation Package
Install packages to support the Dspace installation.
sudo apt install wget curl git build-essential nano zip unzip -y
Install Open JDK
sudo apt install openjdk-11-jdk -y
Set the JAVA_HOME & JAVA_OPTS Environment Variable
sudo nano /etc/environment
Add the below two lines at the bottom of the file.
1
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
1
JAVA_OPTS="-Xmx512M -Xms64M -Dfile.encoding=UTF-8"
Save and close the file.
Run the following commands to check the status of Java Home & Java OPTS
source /etc/environment
echo $JAVA_HOME
echo $JAVA_OPTS
It should display like this
Install Maven and Ant
sudo apt install maven ant -y
Install PostgreSQL
sudo apt-get install postgresql postgresql-client postgresql-contrib libpostgresql-jdbc-java -y
Check the PostgreSQL version number by running the below command
psql -V psql
Version numbers vary in Ubuntu 20.04, 22.04 and Debian 11. Note down it. PostgreSQL 14 is available with Ubuntu 22.04. Check whether the installation of PostgreSQL is successful or not
sudo pg_ctlcluster 14 main start
sudo systemctl status postgresql
Apply the key, Ctrol+C to exit from the screen.
Create a password for PostgreSQL
sudo passwd postgres [Give a password. for ex. “dspace”]
Try to login into PostgreSQL using the password created.
su postgres
The command prompt looks like this postgres@user: if you could log in successfully.
Exit from the current path
exit
Open the following file,
sudo nano /etc/postgresql/14/main/postgresql.conf
Change the version number if you are using Ubuntu 20.04 or Debian 11 users in the above-mentioned command and apply the command on the terminal.
Comment out the line (remove #) listen_addresses = ‘localhost’ under connection settings option.
Save and exit
We have to encrypt the security of PostgreSQL. Change the PostgreSQL version no. if required. Open the following file.
sudo nano /etc/postgresql/14/main/pg_hba.conf
Add the following above the line, # Database administrative login by Unix domain socket.
#DSpace configuration
host dspace dspace 127.0.0.1 255.255.255.255 md5
Restart Postresql
sudo systemctl restart postgresql
Solr Installation
Download the Solr software package from the website.
Enter into the OPT folder.
cd /opt
Download the Solr (version 8) package using the following command line,
sudo wget https://downloads.apache.org/lucene/solr/8.11.3/solr-8.11.3.zip
Unzip the package,
sudo unzip solr-8.11.3.zip
Change Solr permission
ls -la
You can see the permission for solr is only for root user. Change the user name, in my case it is subrat.
sudo chown -R user:user solr-8.11.3
ls -la (Now you can see the user has been changed)
It is not recommended to run solr as a root user, so we have to deploy solr in .profile to run solr. Come back to home folder and apply the commands.
cd
nano .profile
Add the below line in between #umask 022 and # if running bash and save the file
/opt/solr-8.11.2/bin/solr start
To start, stop and restart solr execute the command below
cd /opt/solr-8.11.2/bin
./solr start
./solr stop
./solr restart
./solr status
Browse the below URL for solr running status
http://localhost:8983/solr
Download the DSpace package
Create a temporary folder with the name build in the root folder (/)to store the DSpace package,
sudo mkdir /build
cd /build
Download the DSpace package
sudo wget https://github.com/DSpace/DSpace/archive/refs/tags/dspace-7.6.tar.gz
Extract the package
sudo tar zxvf dspace-7.6.tar.gz
Change the permission of the /build folder.
sudo chmod 777 -R /build
Install Tomcat
sudo apt install tomcat9 -y
Configure DSpace installation path to Tomcat.
sudo nano /lib/systemd/system/tomcat9.service
Add the following line under #Security at the last line
ReadWritePaths=/dspace
Save and close the file.
Alter Tomcat’s default configuration to support searching and browsing of multi-byte UTF-8.
Open the following file
sudo nano /etc/tomcat9/server.xml
Find the below mentioned lines in the file, and comment out. Add <!– in the first line and –> in the last line,
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
It will looks like after commented out,
<!-- <Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" /> -->
Add following lines below the commented out lines,
<Connector port="8080" protocol="HTTP/1.1"
minSpareThreads="25"
enableLookups="false"
redirectPort="8443"
connectionTimeout="20000"
disableUploadTimeout="true"
URIEncoding="UTF-8"/>
Save and close the file.
Restart Tomcat
sudo systemctl restart tomcat9.service
If it shows the following message,
Warning: The unit file, source configuration file or drop-ins of tomcat9.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.
Apply the following command,
sudo systemctl daemon-reload
Again try to restart the Tomcat,
sudo systemctl restart tomcat9.service
Database setup
sudo su postgres
cd /etc/postgresql/14/main
Create a user named dspace. Enter the password when it asks.
createuser --username=postgres --no-superuser --pwprompt dspace
createdb --username=postgres --owner=dspace --encoding=UNICODE dspace
Enable pgcrypto extension.
psql --username=postgres dspace -c "CREATE EXTENSION pgcrypto;"
exit
Create a new DSpace configuration file.
cd /build/DSpace-dspace-7.6/dspace/config
sudo cp local.cfg.EXAMPLE local.cfg
sudo nano local.cfg
Check the important lines in the file and their purpose,
DSpace server URLdspace.server.url = http://localhost:8080/server
DSpace frontend URLdspace.ui.url = http://localhost:4000
# Name of the sitedspace.name = DSpace at My University
If any changes in the DSpace database username / password, mention here.
# Database username and passworddb.username = dspacedb.password = dspace
Uncomment following line in the local.cfg file, (remove #)
solr.server = http://localhost:8983/solr
Save and close the file.
Installation of DSpace backend
sudo su
cd /build/DSpace-dspace-7.6
Build the Installation Package
mvn package
Install DSpace Backend
cd dspace/target/dspace-installerant fresh_install
After successful installation, exit from sudo user, apply the following command,
exit
Copy the DSpace web apps folder to the Tomcat server
sudo cp -R /dspace/webapps/* /var/lib/tomcat9/webapps
Copy Solr folders and change permission
sudo cp -R /dspace/solr/* /opt/solr-8.11.3/server/solr/configsetssudo chown -R user:user /opt/solr-8.11.3/server/solr/configsets
Restart Solr
cd /opt/solr-8.11.3/bin
./solr restart
Open the Solr on the browser using the URL, http://localhost:8983 and check the Core Selector is available on the Left side of the screen.
Initialize the Database.
cd /dspace/bin/
sudo ./dspace database migrate
Create DSpace Administrator Account
sudo /dspace/bin/dspace create-administrator
This process will ask questions,
E-mail address: e.g. dspace@localhostFirst name: e.g. AdminLast name: e.g. DspaceIs the above data correct? (y or n): yPassword will not display on screen.Password: Enter the password to login DSpace.Again to confirm: Confirm the password again.Administrator account created
Change permission of DSpace to Tomcat user
sudo chown -R tomcat:tomcat /dspace/sudo systemctl restart tomcat9.service
Now Open a Browser and check whether the below pages are working correctly or not.Open the REST API Interface at,
http://localhost:8080/server
Try to open OAI-PMH Interface,
http://localhost:8080/server/oai/request?verb=Identify
Install the Front End
Return to the home folder
cd
To install the front required to install Node.js, Yarn, and DSpace-Angular packages.
Install Node.js
Node.js is an open-source, cross-platform, back-end JavaScript runtime environment.
sudo apt install nodejs npm -y
Install NVM
sudo su
curl -o- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bashexport NVM_DIR="$HOME/.nvm"[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"Close the current terminal and open a new one and apply the following commands,
sudo su
nvm list-remote
Check the latest version and install the version with below command
nvm install 18
Install Yarn & PM2
npm install --global yarnnpm install --global pm2Front end installation
cd /home/dspace
Download the dspace-angular package,
sudo wget https://github.com/DSpace/dspace-angular/archive/refs/tags/dspace-7.6.tar.gz
Extract the package,
tar zxvf dspace-7.6.tar.gzrm dspace-7.6.tar.gz
Enter into the dspace-angular folder,
cd /home/dspace/dspace-angular-dspace-7.6
yarn install
To run the user interface we can use two ways: 1) Production mode, 2) Developer mode. In production mode we can’t customize the User Interface but in developer mode it is possible. Follow the below steps to run the UI.
Enter into the /dspace-angular/config folder,
cd config
Copy and rename the following file for production mode
cp config.example.yml config.prod.yml
Open the config file
nano config.prod.yml
Find the block of information in listed in the file and make changes like this,
# The REST API server settings# NOTE: these must be ‘synced’ with the ‘dspace.server.url’ setting in your backend’s local.cfg.rest:ssl: falsehost: localhostport: 8080
Save and close the file.
Run the command,
For developer mode
cd /home/dspace/dspace-angular-dspace-7.6/src
yarn run start:dev
Note: If you face below error, then run the command and try again to start yarn.
export NODE_OPTIONS=–max_old_space_size=8192
yarn run start:dev
After compiled successfully, go to your browser and type http://localhost:4000
Note: If you want to close the server just type ctl+c to shut down your server for user interface.
For production mode
cd /home/dspace/dspace-angular-dspace-7.6/config
yarn run build:prod
exit
Startup the User Interface through PM2
Create a PM2 JSON configuration file.
sudo nano /home/dspace/dspace-angular-dspace-7.6/dspace-ui.json
Copy the following content into the dspace-ui.jason file,
Explicar{ "apps": [ { "name": "dspace-ui", "cwd": "/home/dspace/dspace-angular-dspace-7.6/", "script": "dist/server/main.js", "env": { "NODE_ENV": "production", "DSPACE_REST_SSL": "false", "DSPACE_REST_HOST": "localhost", "DSPACE_REST_PORT": "8080", "DSPACE_REST_NAMESPACE": "/server" } } ]}Start the application using PM2. Apply the following command to start the service,
sudo su
pm2 start /home/dspace/dspace-angular-dspace-7.6/dspace-ui.json
to stop pm2 type below command
pm2 stop /home/dspace/dspace-angular-dspace-7.6/dspace-ui.json
Enter the below URL on the browser to start the DSpace frontend,
http://localhost:4000
Enjoy DSpace7
If you encounter the following error on your DSpace home page.
It happens because of Solr deactivation. Start the Solr and then try again. Run the following command.
su dspace [Give password for your dspace user]
sudo systemctl start solr
exit
Now refresh the below URL and see the changes.
http://localhost:4000
sudo cp local.cfg.EXAMPLE local.cfg
sudo nano local.cfg
Check the important lines in the file and their purpose,
DSpace server URL
dspace.server.url = http://localhost:8080/server
DSpace frontend URL
dspace.ui.url = http://localhost:4000
# Name of the site
dspace.name = DSpace at My University
If any changes in the DSpace database username / password, mention here.
# Database username and password
db.username = dspace
db.password = dspace
Uncomment following line in the local.cfg file, (remove #)
solr.server = http://localhost:8983/solr
Save and close the file.
Installation of DSpace backend
sudo su
cd /build/DSpace-dspace-7.6
Build the Installation Package
mvn package
Install DSpace Backend
cd dspace/target/dspace-installer
ant fresh_install
After successful installation, exit from sudo user, apply the following command,
exit
Copy the DSpace web apps folder to the Tomcat server
sudo cp -R /dspace/webapps/* /var/lib/tomcat9/webapps
Copy Solr folders and change permission
sudo cp -R /dspace/solr/* /opt/solr-8.11.3/server/solr/configsets
sudo chown -R user:user /opt/solr-8.11.3/server/solr/configsets
Restart Solr
cd /opt/solr-8.11.3/bin
./solr restart
Open the Solr on the browser using the URL, http://localhost:8983 and check the Core Selector is available on the Left side of the screen.
Initialize the Database.
cd /dspace/bin/
sudo ./dspace database migrate
Create DSpace Administrator Account
sudo /dspace/bin/dspace create-administrator
This process will ask questions,
E-mail address: e.g. dspace@localhost
First name: e.g. Admin
Last name: e.g. Dspace
Is the above data correct? (y or n): y
Password will not display on screen.
Password: Enter the password to login DSpace.
Again to confirm: Confirm the password again.
Administrator account created
Change permission of DSpace to Tomcat user
sudo chown -R tomcat:tomcat /dspace/
sudo systemctl restart tomcat9.service
Now Open a Browser and check whether the below pages are working correctly or not.
Open the REST API Interface at,
http://localhost:8080/server
Try to open OAI-PMH Interface,
http://localhost:8080/server/oai/request?verb=Identify
Install the Front End
Return to the home folder
cd
To install the front required to install Node.js, Yarn, and DSpace-Angular packages.
Install Node.js
Node.js is an open-source, cross-platform, back-end JavaScript runtime environment.
sudo apt install nodejs npm -y
Install NVM
sudo su
curl -o- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
Close the current terminal and open a new one and apply the following commands,
sudo su
nvm list-remote
Check the latest version and install the version with below command
nvm install 18
Install Yarn & PM2
npm install --global yarn
npm install --global pm2
Front end installation
cd /home/dspace
Download the dspace-angular package,
sudo wget https://github.com/DSpace/dspace-angular/archive/refs/tags/dspace-7.6.tar.gz
Extract the package,
tar zxvf dspace-7.6.tar.gz
rm dspace-7.6.tar.gz
Enter into the dspace-angular folder,
cd /home/dspace/dspace-angular-dspace-7.6
yarn install
To run the user interface we can use two ways: 1) Production mode, 2) Developer mode. In production mode we can’t customize the User Interface but in developer mode it is possible. Follow the below steps to run the UI.
Enter into the /dspace-angular/config folder,
cd config
Copy and rename the following file for production mode
cp config.example.yml config.prod.yml
Open the config file
nano config.prod.yml
Find the block of information in listed in the file and make changes like this,
# The REST API server settings
# NOTE: these must be ‘synced’ with the ‘dspace.server.url’ setting in your backend’s local.cfg.
rest:
ssl: false
host: localhost
port: 8080
Save and close the file.
Run the command,
For developer mode
cd /home/dspace/dspace-angular-dspace-7.6/src
yarn run start:dev
Note: If you face below error, then run the command and try again to start yarn.
export NODE_OPTIONS=–max_old_space_size=8192
yarn run start:dev
After compiled successfully, go to your browser and type http://localhost:4000
Note: If you want to close the server just type ctl+c to shut down your server for user interface.
For production mode
cd /home/dspace/dspace-angular-dspace-7.6/config
yarn run build:prod
exit
Startup the User Interface through PM2
Create a PM2 JSON configuration file.
sudo nano /home/dspace/dspace-angular-dspace-7.6/dspace-ui.json
Copy the following content into the dspace-ui.jason file,
Explicar
{
"apps": [
{
"name": "dspace-ui",
"cwd": "/home/dspace/dspace-angular-dspace-7.6/",
"script": "dist/server/main.js",
"env": {
"NODE_ENV": "production",
"DSPACE_REST_SSL": "false",
"DSPACE_REST_HOST": "localhost",
"DSPACE_REST_PORT": "8080",
"DSPACE_REST_NAMESPACE": "/server"
}
}
]
}
Start the application using PM2. Apply the following command to start the service,
sudo su
pm2 start /home/dspace/dspace-angular-dspace-7.6/dspace-ui.json
to stop pm2 type below command
pm2 stop /home/dspace/dspace-angular-dspace-7.6/dspace-ui.json
Enter the below URL on the browser to start the DSpace frontend,
http://localhost:4000
Enjoy DSpace7
If you encounter the following error on your DSpace home page.
It happens because of Solr deactivation. Start the Solr and then try again. Run the following command.
su dspace [Give password for your dspace user]
sudo systemctl start solr
exit
Now refresh the below URL and see the changes.
http://localhost:4000
Comentarios
Publicar un comentario