Dspace 6 installation on Debian 9 Stretch

add this to  /etc/apt/sources.list

 deb http://ftp.ua.debian.org/debian/ stretch main contrib non-free
 deb-src http://ftp.ua.debian.org/debian/ stretch main contrib non-free
  deb http://security.debian.org/ stretch / updates contrib main
 deb-src http://security.debian.org/ stretch / updates contrib main
  deb http://ftp.ua.debian.org/debian/ stretch-updates contrib main non-free
 deb-src http://ftp.ua.debian.org/debian/ stretch-updates contrib main non-free
run
sudo apt-get update
 sudo apt-get upgrade

Installing Java OpenJDK 8

  sudo apt-get install openjdk-8-jdk

installing Tomcat, Maven, Ant

sudo apt-get install tomcat8 maven ant git

Installing the postgresql database

 sudo apt-get install postgresql postgresql-contrib libpg-java

Setting up PostgreSQL

In the file /etc/postgresql/9.6/main/postgresql.conf uncomment the line

 listen_addresses = 'localhost'

Setting up the maximum number of client connections for the PostgreSQL server

Edit postgresql configuration file:

  sudo nano /etc/postgresql/9.6/main/postgresql.conf

change the number of “max_connections” to 300

and

  shared_buffers = 1024MB 

Restart PostgreSQL server

  sudo service postgresql restart

Configuring PostgreSQL Permissions on a Host Server

In the file /etc/postgresql/9.6/main/pg_hba.conf replace

  local all postgres peer

with

  local all postgres trust

and

  local all all peer

wuth

  local all all md5

Restart the database server

  sudo service postgresql restart

Creating the user “dspace” and the DBs “dspace” PostgreSQL

Creates a DB user (dspace) and a DSpace database (dspace)

 sudo -u postgres psql
postgres=# create database dspace;
postgres=# create user dspace with encrypted password 'mypass';
postgres=# grant all privileges on database dspace to dspace;
  service postgresql restart

Setting the password, owner and privileges of the DB “dspace” and user “dspace”

We connect to the PostgreSQL database server and enter the PostgreSQL shell.

  psql -U postgres -d dspace

Set password for user “dspace” (specify your option):

  ALTER ROLE dspace WITH PASSWORD 'XXXXXX';

Let the user “dspace” be the owner of the database “dspace”

  ALTER DATABASE dspace OWNER TO dspace;

Give all privileges to the “dspace” database to “dspace”

  GRANT ALL PRIVILEGES ON DATABASE dspace TO dspace;

Add the “crypto” extension to the “dspace” database.

  CREATE EXTENSION pgcrypto;

Exit the shell of the database.

  \q

Optionally install phppgadmin

Edit /etc/apache2/conf-available/phppgadmin.conf to add access from other IPs:

commented on

  #Require local

and add

allow from all

Restart Apache Web Server:

  sudo /etc/init.d/apache2 restart

Verify access from selected IPs

http: //localhost/phppgadmin

Create a DSpace user

sudo useradd -m dspace
 sudo passwd dspace

Creating a [dspace] folder to host the DSpace executable code

sudo mkdir /dspace
sudo chown dspace:dspace  /dspace

Download, compile, and install the DSpace release

Download the latest stable version

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

Unpacking

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

Compilation

  cd ~/dspace-6.1-src-release/
 mvn -U package
For Mirage2 use command 
mvn package -Dmirage2.on=true

now in

~/dspace-6.1-src-release/dspace/target/dspace-installer/config/dspace.cfg

change the dspace dir and database information

# Database username and password
 db.username = dspace
 db.password = MYPASSWORD

Install DSpace and initialize the database

su dspace

cd /home/dspace/source/dspace-6.1-src-release/dspace/target/dspace-installer

ant fresh_install

Connecting to the DSpace-web’s webapps to Tomcat

First create 2 files

  /etc/tomcat8/Catalina/localhost/xmlui.xml
 /etc/tomcat8/Catalina/localhost/ROOT.xml

with identical content

  <?xml version = '1.0'?>
 <Context
  docBase = "/dspace/webapps/xmlui"
  debug = "0"
  reloadable = "true"
  cachingAllowed = "false"
  allowLinking = "true" />

Create file

  /etc/tomcat8/Catalina/localhost/jspui.xml

with content

  <?xml version = '1.0'?>
 <Context
  docBase = "/dspace/webapps/jspui"
  debug = "0"
  reloadable = "true"
  cachingAllowed = "false"
  allowLinking = "true" /> 

Create file

  /etc/tomcat8/Catalina/localhost/solr.xml

with content

  <?xml version = '1.0'?>
 <Context
  docBase = "/dspace/webapps/solr"
  debug = "0"
  reloadable = "true"
  cachingAllowed = "false"
  allowLinking = "true" />

Create file

  /etc/tomcat8/Catalina/localhost/oai.xml

with content

  <?xml version = '1.0'?>
 <Context
  docBase = "/dspace/webapps/oai"
  debug = "0"
  reloadable = "true"
  cachingAllowed = "false"
  allowLinking = "true" />

Create file

  /etc/tomcat8/Catalina/localhost/rdf.xml

with content

  <?xml version = '1.0'?>
 <Context
  docBase = "/dspace/webapps/rdf"
  debug = "0"
  reloadable = "true"
  cachingAllowed = "false"
  allowLinking = "true" />

Create file

  /etc/tomcat8/Catalina/localhost/rest.xml

with content

  <?xml version = '1.0'?>
 <Context
  docBase = "/dspace/webapps/rest"
  debug = "0"
  reloadable = "true"
  cachingAllowed = "false"
  allowLinking = "true" />

Create file

  /etc/tomcat8/Catalina/localhost/sword.xml

with content

  <?xml version = '1.0'?>
 <Context
  docBase = "/dspace/webapps/sword"
  debug = "0"
  reloadable = "true"
  cachingAllowed = "false"
  allowLinking = "true" />

Create file

  /etc/tomcat8/Catalina/localhost/sword2.xml

with content

  <?xml version = '1.0'?>
 <Context
  docBase = "/dspace/webapps/sword2"
  debug = "0"
  reloadable = "true"
  cachingAllowed = "false"
  allowLinking = "true" />

Restart Tomcat

  sudo service tomcat8 restart

The first DSpace administrator account

/dspace/bin/dspace create-administrator

DSpace Database Initialization  

/dspace/bin/dspace database migrate

Install the Tomcat server user rights in the DSpace folder

sudo chown tomcat8:tomcat8 /dspace -R

sudo /etc/init.d/tomcat8 restart

Now you can run Dspace in your browser

http://localhost:8080

http://localhost:8080/xmlui

http://localhost:8080/jspui

http://localhost:8080/oai/request?verb=Identify