Install Dspace 7.2 on Ubuntu 22.04 LTS
Install Dspace 7.2 on Ubuntu 22.04 LTS
Install Dspace 7.2 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.2 – backend
viii) Dspace-angular 7.2 – frontend
ix) Node.js
x) Node Version Manager (NVM)
xi) Yarn
xii) gedit (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
Install gedit for text editing
sudo apt-get install gedit
Create a Dspace user with password
sudo useradd -m dspace
sudo passwd dspace
[Give password, for ex. “dspace”]
Install Java JDK
sudo apt install default-jdk
build-essential -y
Set the JAVA_HOME & JAVA_OPTS
Environment Variable
sudo gedit /etc/environment
Add the below two lines at the
bottom of the file.
|
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64" |
|
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
For better support of Dspace, run
the following command
apt-get install git
add-apt-repository ppa:git-core/ppa
apt update
apt install git
sudo apt install curl git -y
Install Maven and Ant
sudo apt install maven -y
sudo apt install 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 gedit
/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 gedit
/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 and save it to the opt folder in the operating system.
Enter into the /opt folder.
cd /opt
Download the Solr (version 8)
package using the following command line,
sudo wget https://www.apache.org/dyn/closer.lua/lucene/solr/8.11.1/solr-8.11.1.zip?action=download
Rename the Zip file,
sudo mv
solr-8.11.1.zip\?action\=download solr-8.11.1.zip
Unzip the package,
sudo unzip solr-8.11.1.zip
Rename Solr directory
sudo mv solr-8.11.1 solr
Downloaded Solr ZIP files not
required, delete it,
sudo rm solr-8.11.1.zip
Check Solr directory available at
/opt
ls
Change the folder (solr) permission
to Dspace user,
sudo chown -R dspace:dspace solr
Check whether the folder permission
changed or not.
ls -la
Login to the dspace user account to
start Solr
su dspace
Give your password set before
Start Solr by running the below
command,
/opt/solr/bin/solr start
Check solr status
Exit from current directory
exit
Browse the below URL for solr
running status
Download the DSpace package
Return to the home folder
cd
Download the DSpace package
wget https://github.com/DSpace/DSpace/archive/refs/tags/dspace-7.2.1.zip
Extract the package
sudo unzip dspace-7.2.1.zip
Rename the package to dspace
sudo mv DSpace-dspace-7.2.1 dspace
Move the package to the root folder
of the operating system
sudo mv dspace /
Change the dspace folder permission
to dspace user
sudo chown -R dspace:dspace /dspace
Install Tomcat
sudo apt install tomcat9 -y
sudo systemctl restart cron.service
Configure DSpace installation path
to Tomcat.
sudo gedit
/lib/systemd/system/tomcat9.service
Add the following line under
#Security
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 gedit /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 /dspace/dspace/config/
sudo cp local.cfg.EXAMPLE local.cfg
sudo gedit 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
source /etc/environment
echo $JAVA_HOME
echo $JAVA_OPTS
Build the Installation Package
su dspace
cd /dspace
mvn package
Install DSpace Backend
cd dspace/target/dspace-installer
ant fresh_install
cd /dspace/bin/
./dspace database migrate
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/server/solr/configsets/
sudo chown -R dspace:dspace /opt/solr/server/solr/configsets/
Create DSpace Administrator Account
sudo /dspace/bin/dspace
create-administrator
This process will ask questions,
Email Address: [Enter an email
address to login Dspace, e.g., dspace@dspace]
First Name: [Enter the name of the user, e.g. Dspace]
Last Name: [e.g. Admin]
Password: [Enter the password to log in to DSpace].
Again to confirm: [Once again enter the same password]
Is the above data correct? (y or n): y
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,
Try to open OAI-PMH Interface,
http://localhost:8080/server/oai/request?verb=Identify
Install the Front End
Return to the home folder
cd
curl
-fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt install nodejs -y
Install NVM
sudo su
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.39.1/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
Find the latest LTS version from the
list and install it.
nvm
install --lts
Install Yarn
npm
install --global yarn
npm
install --global pm2
Front end installation
cd /home/dspace
Download the dspace-angular package,
wget https://github.com/DSpace/dspace-angular/archive/refs/tags/dspace-7.2.zip
Extract the package,
unzip dspace-7.2.zip
rm dspace-7.2.zip
Enter into the dspace-angular
folder,
cd
/home/dspace/dspace-angular-dspace-7.2
yarn install
Enter into the
/dspace-angular/config folder,
cd config
Copy and rename the following file,
cp config.example.yml
config.prod.yml
Open the config file
gedit 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.
yarn run build:prod
exit
Startup
the User Interface
Create a PM2 JSON configuration
file.
Create the file,
sudo gedit
/home/dspace/dspace-angular-dspace-7.2/dspace-ui.json
Copy the following content into the
dspace-ui.jason file,
{
"apps": [
{
"name": "dspace-ui",
"cwd":
"/home/dspace/dspace-angular-dspace-7.2/",
"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.2/dspace-ui.json
Autostart the dspace-ui.json
sudo crontab -u dspace -e
Add the following lines to the
bottom of the editor.
#Solr autostart
@reboot /opt/solr/bin/solr start
Save and close the file.
Create a cronjob to start
dspace-ui.json
sudo su
crontab -e
Add the following line
#Auto start dspace-angular
@reboot
bash -ci 'pm2 start
/home/dspace/dspace-angular-dspace-7.2/dspace-ui.json'
Save and close the file.
Enter the below URL on the browser
to start the DSpace frontend,
You may also want to
install/configure pm2-logrotate to ensure that PM2’s log folder doesn’t fill up
over time.
pm2 install pm2-logrotate
pm2 set pm2-logrotate:max_size 1000K
pm2 set pm2-logrotate:compress true
pm2 set pm2-logrotate:rotateInterval 0 0 19 1 1 7
Enjoy DSpace7
If you encounter the 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]
/opt/solr/bin/solr start
exit
Start the application using PM2.
sudo su
pm2 start
/home/dspace/dspace-angular-dspace-7.2/dspace-ui.json
Now refresh the below URL and see
the changes.
Ref: https://subratiitk.wordpress.com/install-dspace-7-2-on-ubuntu-22-04-lts/
Comments
Post a Comment