Sunday, February 16, 2020

how to install dspace on ubuntu 18.04


How to install dspace on ubuntu
(important: before the installation of dspace we must install git software by using below command)
$ apt-get install git

  1. Log in:
    • $ ssh -i keypair2.pem ubuntu@3.80.31.85
  2. Update Ubuntu patches to latest packages:
    • $sudo apt update
    • $sudo apt upgrade (note: when upgrading, choose “install the package maintainer’s version” typically works well)
  3. Install required system applications: (openjdk-8, postgresql, ant, and maven)
    • $sudo apt install openjdk-8-jdk postgresql ant maven
  4. Create Ubuntu user “dspace” with directory “/dspace” and let user “dspace” owning directory “/dspace”
    • $sudo useradd -m dspace
    • $sudo passwd dspace
    • $sudo mkdir /dspace
    • $sudo chown dspace /dspace
  5. Become user “postgres” so that it can create postgreSQL database user
    • $sudo su postgres
  6. Create a new PostgreSQL user
    • $createuser -U postgres -d -A -P dspace
    • Enter password for new role: 
    • Enter it again:
    • $exit
  7. Ubuntu user “dspace” to create database “dspace”
    • $sudo -u dspace createdb -U dspace -E UNICODE dspace
  8. Be ubuntu user “postgres” and enable postgreSQL extension “pgcrypto” for hash function. (a regular Postgres extension. Install it once per database)
    • $sudo su postgres
    • $psql –username=postgres dspace -c “CREATE EXTENSION pgcrypto;”
  9. Exit to be user “ubuntu” again.
    • $exit
  10. Allow database user “dspace” to connect to PostgreSQL
    • $sudo nano /etc/postgresql/10/main/pg_hba.conf
    • go to the last line, add “local   all dspace                       md5“
    • save and close the file
  11. Restart postgreSQL (to make the change effecitve)
    • $sudo /etc/init.d/postgresql restart
  12. Create “/build” directory for compiling and installation
    • $sudo mkdir /build; sudo chmod -R 777 /build; cd /build
  13. Download Dspace to “/build” directory and extract DSpace tar file
    • $wget https://github.com/DSpace/DSpace/releases/download/dspace-6.3/dspace-6.3-src-release.tar.gz
    • $ tar -zxf dspace-6.3-src-release.tar.gz
    • $ cd /build/dspace-6.3-src-release
  14. Ensure appropriate Java version.
    • $sudo update-alternatives --config java (type 2)
    • Compile Dspace package
      1. $ mvn -U package
      2. Note: you shall see results like this
      3. If you see “BUILD FAILURE” like this, you need to update java version to use “openjdk-8”, Ubuntu 18.04 LTS carries java 11, which will fail the compile. Go to previous step to choose right java version and re-compile.
    • Install DSpace
      1. $ cd /build/dspace-6.3-src-release/dspace/target/dspace-installer
      2. $sudo ant fresh_install
    • Install Tomcat
      1. $sudo cd /opt; sudo wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.37/bin/apache-tomcat-8.0.37.tar.gz
      2. $sudo tar xvzf apache-tomcat-8.0.37.tar.gz
      3. $sudo ln -s apache-tomcat-8.0.37 tomcat
    • Set Tomcat environment variables
      1. $sudo nano /etc/profile
      2. copy/paste to the last line”
        export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
        export CATALINA_HOME=/opt/tomcat “
      3. save and close the file.
    • Copy DSpace webapps to Tomcat websapps (so that Tomcat will run DSpace webapps)
      1. $sudo cp -r /dspace/webapps/* /opt/tomcat/webapps
    • Run Tomcat
      1. $sudo /opt/tomcat/bin/startup.sh
      2. Open an browser, enter “ip:8080/xmlui” for XMLUI interface, you shall see this. This is nice.
Using DSpace
  1. Interfaces:
    • JSP: residing in /jspui/. To access: enter [IP}:8080/jspui/. Example: http://www.afghandata.org:8080/jspui/
    • XMLUI: residing in /xmlui/. To access: enter [IP}:8080/xmlui/. Example: http://www.afghandata.org:8080/xmlui/
  2. Create adminstrative account:
    • $sudo /dspace/bin/dspace create-administrator

No comments:

Post a Comment

Virtual Machine for Koha

download VM