Dspace 7.5 Latest Installation on Ubuntu 20.04 LTS
Dspace 7.5 Installation
We use Debian 11 (Bull Eye) Ubuntu 20.04 LTS and 22.04 LTS to install DSpace 7.
Update the operating system.
Apply the following commands one by one to receive new updates. It makes the system new.
Apply the following commands one by one to receive new updates. It makes the system new.
sudo apt update && sudo apt upgrade -y
Create a DSpace user from the terminal after the installation. Here are the commands to create the DSpace user;
sudo useradd -m dspace
sudo passwd dspace
[enter a password for the new user dspace]
Add dspace user to sudoers group
sudo passwd dspace
[enter a password for the new user 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 mousepad zip unzip -y
Install Open JDK
The JDK is a development environment for building applications, applets, and components using the Java programming language. JDK prepares an environment to run Java-based applications on the machine.
sudo apt install openjdk-11-jdk -y
Set the JAVA_HOME Environment Variable
DSpace requires the Java installation location. Open the following file to add the java environment variable,
sudo mousepad /etc/environment
Add the following two lines to the file,
JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"
JAVA_OPTS="-Xmx512M -Xms64M -Dfile.encoding=UTF-8"
Save and close the file.
Apply the following commands one by one to check Java Home is successfully saved,
source /etc/environment
echo $JAVA_HOME
echo $JAVA_OPTS
Install Maven and Ant
Apache Maven requires for the build process during the Dspace installation. Maven helps to download the dependencies. Maven is used to build the installer. Ant used to install/deploy DSpace to the installation directory
sudo apt install maven ant -y
Install PostgreSQL
PostgreSQL, also known as Postgres, is a free and open-source relational database management system. Dspace makes use of PostgreSQL as a Relational Database System. Apply the following command to install PostreSQL and related packages;
sudo apt-get install postgresql postgresql-client postgresql-contrib libpostgresql-jdbc-java -y
Apply the following command to check the PostgreSQL version number.
psql -V psql
The version number of PostgreSQL varies in Ubuntu 22.04 and Debian 11. PostgreSQL 14 is available with Ubuntu 22.04, and PostgreSQL 13 is available with Debian 11. Check whether the installation of PostgreSQL is successful or not,
For Ubuntu 22.04 LTS users
sudo pg_ctlcluster 14 main start
sudo systemctl status postgresql
For Debian 11 users
sudo pg_ctlcluster 13 main start
sudo systemctl status postgresql
Apply the key, CTRL + C, to exit from the screen.
Create a password for PostgreSQL.
sudo passwd postgres
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. apply the following command to exit from there,
exit
Open the following file,
For Ubuntu 22.04 LTS users
sudo mousepad /etc/postgresql/14/main/postgresql.conf
For Debian 11 users
sudo mousepad /etc/postgresql/13/main/postgresql.conf
Uncomment the line (remove #) listen_addresses = 'localhost' under the connection settings option.
Save and exit
We need to tighten the security of PostgreSQL. Open the following file,
For Ubuntu 22.04 LTS users
sudo mousepad /etc/postgresql/14/main/pg_hba.conf
For Debian 11 users
sudo mousepad /etc/postgresql/13/main/pg_hba.conf
Find the line, # Database administrative login by Unix domain socket.
Add the below lines above the line,
#DSpace configuration
host dspace dspace 127.0.0.1 255.255.255.255 md5
Restart Postresql
sudo systemctl restart postgresql
Solr Installation
Solr is an open-source search platform, written in Java. Its major features include full-text search, hit highlighting, faceted search, real-time indexing, dynamic clustering, database integration, NoSQL features, and rich document handling.
Download the Solr software package from the website and save it to the opt folder in the operating system.
Enter into the home folder. Apply the following command,
cd
Download the Solr (version 8) package using the following command line, Please ensure the solr version if above 8.11.3 to change it to 8._._.
sudo wget https://dlcdn.apache.org/lucene/solr/8.11.3/solr-8.11.3.zip
Unzip the package,
sudo unzip solr-8.11.3.zip
Apply the following command to install Solr,
sudo bash solr-8.11.3/bin/install_solr_service.sh solr-8.11.3.zip
After successful installation, exit from the process. Apply the key combination,
Ctl + C
Apply the following commands one by one to start automatically upon system boot.
sudo systemctl enable solr
sudo systemctl start solr
sudo systemctl status solr
Apply CTRL + C key combination to exit from Solr status in Terminal.
Add the URL on a browser to open the Solr interface,
Download the DSpace package
Create a temporary folder with the name build in the root folder (/)to store the DSpace package,
sudo mkdir /build
Download the DSpace package. Enter into the /build directory.
cd /build
Download the dspace package into /build folder.
sudo wget https://github.com/DSpace/DSpace/archive/refs/tags/dspace-7.5.zip
Extract the package,
sudo unzip dspace-7.5.zip
Change the permission of the /build folder.
sudo chmod 777 -R /build
Install Tomcat
Tomcat provides a "pure Java" HTTP web server environment where Java code can run.
sudo apt install tomcat9 -y
Specify the DSpace installation path to Tomcat. Open the following file,
sudo mousepad /lib/systemd/system/tomcat9.service
Find the category, #Security,
Add the following line at the last portion,
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 mousepad /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 look like this after commented out,
<!-- <Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" /> -->
Add the 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
Create a DSpace user. Apply the following commands one by one,
Login into the Postgres terminal,
sudo su postgres
Enter the following directory. If there are any changes in the version number, add them.
Ubuntu users apply the following command,
cd /etc/postgresql/14/main
Debian users apply the following command,
cd /etc/postgresql/13/main
Create the user named dspace. Enter the password when it asks. This is the connection password for the DSpace database; note it down.
createuser --username=postgres --no-superuser --pwprompt dspace
This command will create the database with the name dspace. The database owner is dspace, the user created in the previous command.
createdb --username=postgres --owner=dspace --encoding=UNICODE dspace
Enable pgcrypto extension.
The pgcrypto module provides cryptographic functions for PostgreSQL. It secures data from the security breach.
psql --username=postgres dspace -c "CREATE EXTENSION pgcrypto;"
Exit from the Postgres terminal,
exit
Create a new DSpace configuration fil.
Enter into the folder,
cd /build/DSpace-dspace-7.5/dspace/config
Make a copy of the local.cfg file,
sudo cp local.cfg.EXAMPLE local.cfg
Open the local.cfg file,
sudo mousepad local.cfg
See 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 them here.
# Database username and password
db.username = dspace
db.password = dspace
Uncomment the following line in the local.cfg file,
solr.server = http://localhost:8983/solr
Save and close the file.
Installation of DSpace backend
Login as the Root user,
sudo su
Enter into the DSpace package downloaded in /build folder.
cd /build/DSpace-dspace-7.5
Download the dependencies and the required packages to build DSpace,
mvn package
The package-building process depends on the Internet speed and server responses and it may take 10 to 20 minutes to finish.
Install DSpace Backend
Enter into the folder where DSpace installer located and install,
cd dspace/target/dspace-installer
Install the DSpace package,
ant fresh_install
After successful install, 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 DSpace Solr folders into the default home of Solr (/var/solr/data),
sudo cp -R /dspace/solr/* /var/solr/data
Change the permission of the folder.
sudo chown -R solr:solr /var/solr/data
Restart Solr
sudo systemctl restart solr
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.
Enter into the below mentioned folder and apply the migration command.
cd /dspace/bin/
sudo ./dspace database migrate
Create a DSpace Administrator Account
sudo /dspace/bin/dspace create-administrator
This process will ask questions,
Creating an initial administrator account
E-mail address: e.g. dspace@localhost
First name: e.g. LIS
Last name: e.g. Marimuthu
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 test whether the below pages are displaying correctly or not.
Open the REST API Interface at,
Install the Front End
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
Node Version Manager (NVM) is a tool used to manage multiple active Node. js versions. Apply the commands one by one.
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 the following commands to install the Node.js.
sudo su
nvm install 16.18.1
Install Yarn
Yarn is a software packaging system.
npm install --global yarn
npm install --global pm2
Front end installation
DSpace user interfaces build on Angular. Angular is a TypeScript-based free and open-source web application framework. Follow the steps to install Dspace-Angular.
We are going to place the dspace-angular package into dspace home folder. Enter it into the folder;
cd /home/dspace
Download the dspace-angular package,
sudo wget https://github.com/DSpace/dspace-angular/archive/refs/tags/dspace-7.5.zip
Extract the package,
unzip dspace-7.5.zip
Remove the dspace zip package,
rm dspace-7.5.zip
Enter into the dspace-angular folder,
cd /home/dspace/dspace-angular-dspace-7.5
Install all dependencies,
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
mousepad config.prod.yml
Find the block of information and find the lines. Make changes like this,
ssl: true -> false
host: api7.dspace.org -> localhost
Port: Change to 8080
# 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
host: localhost
port: 8080
Save and close the file.
Run the command,
yarn run build:prod
exit
Startup the User Interface
Create a PM2 JSON configuration file.
Create the file,
sudo mousepad /home/dspace/dspace-angular-dspace-7.5/dspace-ui.json
Copy the following content into the dspace-ui.jason file,
{
"apps": [
{
"name": "dspace-ui",
"cwd": "/home/dspace/dspace-angular-dspace-7.5/",
"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.5/dspace-ui.json
Create a cronjob entry at the ROOT user to autostart dspace-ui.json. Login as a ROOT user. Apply the following commands,
crontab -e
Add the following line
#Auto start dspace-angular
@reboot bash -ci 'pm2 start /home/dspace/dspace-angular-dspace-7.5/dspace-ui.json'
To save the file, apply CTRL + O key combination. Exit from the editor and apply CTRL + X.
Enter the below URL on the browser to start the DSpace front end,
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
Build directory no longer required after the installation of DSpace; remove it. Apply the following command;
sudo rm -rf /build
Restart the computer and check the Solr, Tomcat, and DSpace works.
Comments
Post a Comment