Thursday, July 28, 2022

Install DSpace 6.3 on Ubuntu 20.04

We use Xubuntu 20.04 LTS for the installation of DSpace 6. ISO file of the operating system can be downloaded from the Xubuntu website, https://xubuntu.org/release/20-04. No problem using other Ubuntu flavors (e.g. Ubuntu with GNOME, KDE, Lubuntu) for the installation. Either burn the ISO file to a pen drive or DVD. Install the Xubuntu on the machine. Create a user account during the installation (e.g. mgu). Create the user with the name dspace after the installation of Linux based operating system. If you have already run on Ubuntu/Debian (e.g. for Koha), create a dspace user.

Prepare the system for Dspace installation.

DSpace builds on the Java platform and it requires a set of software packages like Tomcat, Solr, Maven, Ant, etc. Install the prerequisites for the Dspace software. 

Update Xubuntu

Apply the following commands one by one to receive new Xubuntu updates. It makes the Xubuntu 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]

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-8-jdk git -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-8-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 building 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 PostgreSQL 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

Version numbers vary in Ubuntu 20.04, 22.04 and Debian 11. PostgreSQL 14 is available with Ubuntu 22.04. Check whether the installation of PostgreSQL is successful or not,

sudo pg_ctlcluster 12 main start
sudo systemctl status postgresql

Apply the key, Ctrol+C, to exit from the screen.

Create a password for PostgreSQL. Note down the password, need it later.

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,

sudo mousepad /etc/postgresql/12/main/postgresql.conf

Uncomment the line (remove #) listen_addresses = 'localhost' under connection settings option.

Save the file and close.

We need to tighten the security of PostgreSQL. Here also, change the PostgreSQL number. Open the following file,

sudo mousepad /etc/postgresql/12/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 Postgresql

sudo systemctl restart postgresql

Create DSpace database

Create a DSpace user. Apply the following commands one by one,
Login into the Postgres terminal,

sudo su postgres

Enter into the following directory. If there are any changes in the version number, add them.

cd /etc/postgresql/12/main

Create the user named dspace. Enter the password (e.g. dspace) when it asks. This is the connection password for the DSpace database, note down it. 

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

This command will create the database with the name dspace. The database owner is dspace, the same 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

Restart Postgres
sudo systemctl restart postgresql

Build DSpace

Create a folder to put Dspace files.

sudo mkdir /dspace
sudo chown dspace /dspace

Create a build folder for building DSpace.

sudo mkdir /build
sudo chmod -R 777 /build
cd /build

Download DSpace into /build directory

Copy-paste the following line in the terminal,

wget https://github.com/DSpace/DSpace/releases/download/dspace-6.3/dspace-6.3-src-release.tar.gz

Extracting Dspace package

tar -zxf dspace-6.3-src-release.tar.gz

Enter into the dspace-6.3-src-release folder.

cd dspace-6.3-src-release

Copy and rename the local.cfg file.

sudo cp dspace/config/local.cfg.EXAMPLE dspace/config/local.cfg

Compile and install the DSpace

sudo mvn -U package 
cd dspace/target/dspace-installer
sudo ant fresh_install

Install Tomcat

Tomcat provides a "pure Java" HTTP web server environment in which Java code can run. 

sudo apt install tomcat9 -y
sudo systemctl restart cron.service

Specify the DSpace installation path to Tomcat. Open the following file,

sudo mousepad /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 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 after commenting 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

Copy the DSpace web apps folder to the Tomcat server

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

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/

Restart the Tomcat
sudo systemctl restart tomcat9.service

Delete the build folder, not required after the installation.

sudo rm -rf /build

Open DSpace in your browser
DSpace has two interfaces; xmlui and jspui. You can load either one Dspace interface in a browser.

http://localhost:8080/xmlui
http://localhost:8080/jspui

Login using the administrative username and password.

DSpace 6 configuration file located at /dspace/config/dspace.cfg
If you would like to make changes in the file apply the following command,

sudo mousepad /dspace/config/dspace.cfg

No comments:

Post a Comment