Tuesday, 9 June 2020

DSpace installation on Ubuntu 20.04

Installation of prerequisite applications
1. Java Development Kit (JDK)
2. PostgreSQL Database
3. DSpace Software
4. Apache Ant (Pure Java Build Tool)
5. Apache Maven (Apache Build Automation Tool for Java Projects)
6. Apache Tomcat (Web Server for hosting Dspace)
Open  Applications > Accessories > Terminal and execute following commands.sudo su
apt-get update
apt-get upgrade
apt-get install openjdk-8-jdk postgresql ant maven
 
Create the database user
sudo su postgres
createuser -U postgres -d -A -P dspace

Enter password for new role: [Enter a password e.g. dspace]

Shall the new role be allowed to create more new roles? (y/n) n

[Enter n and press enter button]

Type exit

Allow the database user (dspace) to connect to the database

[If the following command not open, check the postgresql version number and apply in the command]

sudo gedit /etc/postgresql/12/main/pg_hba.conf

Add this line to the configuration file at the end:

local all dspace md5
save and close the file

Restart PostgreSQL :

 
sudo su
/etc/init.d/postgresql restart

 

Create Dspace user

sudo useradd -m dspace
sudo passwd dspace
 [enter a password for the new user dspace]
sudo mkdir /dspace
sudo chown dspace /dspace

Create the PostgreSQL 'dspace' database

sudo -u dspace createdb -U dspace -E UNICODE dspace



Login to the database as a superuser, and enable the pgcrypto
extension on this database
sudo su postgres
psql --username=postgres dspace -c "CREATE EXTENSION pgcrypto;"


exit

sudo /etc/init.d/postgresql restart
Create Dspace directory
sudo mkdir /build
sudo chmod -R 777 /build
cd /build

Download Dsapce to /build directory
Copy paste following line in the terminal,
wget https://github.com/DSpace/DSpace/releases/download/dspace-6.3/dspace-6.3-src-release.tar.gz
You can find latest version from this page and copy the link to download latest version.
Extracting Dspace package
tar -zxf dspace-6.3-src-release.tar.gz
cd /build/dspace-6.3-src-release

Open the pom.xml file and remove the following code

sudo gedit /build/dspace-6.3-src-release/dspace-api/pom.xml

#Remove the following code

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions><execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>

#Save and exit

mvn -U package 

Enter into Dspace package folder to download packages.

cd /build/dspace-6.3-src-release/dspace/target/dspace-installer
sudo ant fresh_install

Installation of Tomcat
Download the and extract the Tomcat package,

cd /opt

wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.37/bin/apache-tomcat-8.0.37.tar.gz

tar xvzf apache-tomcat-8.0.37.tar.gz


Rename folder "apache-tomcat-8.0.37" to "tomcat"

mv apache-tomcat-8.0.37 tomcat

Delete the package file from /opt folder

rm apache-tomcat-8.0.37.tar.gz
Open following file, 

gedit /etc/profile
 
Setup environment variables

Environment variables to find JAVA.
Add following lines at the bottom of the file,

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export CATALINA_HOME=/opt/tomcat

Copy Dspace webapps files to Tomcat folder 

sudo cp -r /dspace/webapps/* /opt/tomcat/webapps

Running Tomcat automatically
You can set up to start the Tomcat server start automatically at the time of system turn on.

Open following file in a Terminal,

gedit /etc/init.d/tomcat

Add following lines in the file,

#!/bin/bash
### BEGIN INIT INFO
# Provides:        tomcat7
# Required-Start:  $network
# Required-Stop:   $network
# Default-Start:   2 3 4 5
# Default-Stop:    0 1 6
# Short-Description: Start/Stop Tomcat server
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin

start() {
 sh /opt/tomcat/bin/startup.sh
}

stop() {
 sh /opt/tomcat/bin/shutdown.sh
}

case $1 in
  start|stop) $1;;
  restart) stop; start;;
  *) echo "Run as $0 <start|stop|restart>"; exit 1;;
esac
save and close the file.
Apply following commands too;

chmod +x /etc/init.d/tomcat
update-rc.d tomcat defaults
Start Tomcat server,
service tomcat start
Now you can start and stop Tomcat server using following commands;
service tomcat start
service tomcat stop
service tomcat restart

Make an initial administrator account (an e-person) in DSpace:
Apply following command in a terminal,
sudo /dspace/bin/dspace create-administrator

It will ask to enter email address for user login.
Enter an email address (e.g. dspace@localhost).
Enter First name and surename (e.g. dspace)
Enter a password.


Inorder to avoid buil error during maven package running please follow 

may be the version of java will be openjdk-11.. you may pls change it. by executing following command.

update-alternatives --config javaand select openjdk-8 as default.probably 2nd one will be openjdk-8 then re-run maven. will be successful.

No comments:

Post a Comment