Difference between revisions of "DSpace/C2/Getting-ready-for-DSpace-Installation-on-Ubuntu-Linux-OS/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
(No difference)

Latest revision as of 14:21, 7 January 2021

Script: Getting ready for DSpace Installation


Author : Pankaj Patil


Keywords : DSpace Installation, Tomcat Installation, postgresql installation, Configure tomcat server, Create DSpace database


Visual Cue Narration
Slide : Title Welcome to this spoken tutorial on Getting ready for DSpace Installation.
Slide : Learning Objectives Slide In this tutorial we will learn to
  • Install Java, Tomcat 8, Postgresql 10, Ant, Maven and git
  • Configure Tomcat 8 server and
  • Create dspace database in Postgresql 10
Slide : System requirements This tutorial is recorded using
  • Ubuntu Linux OS 18.04 and
  • gedit text editor

However you may use any other text editor of your choice.

Slide : Pre-requisites To practice this tutorial,
  • You need an internet connection to install the necessary packages and
  • You should be familiar with basic Linux commands.
Slide : Pre-requisites If not then please go through the prerequisite Linux tutorials on this website.
Slide : Hardware requirements The minimum hardware requirements for DSpace installation is
  • i3 processor or above
  • 100GB hard disk or more
  • 4GB RAM or above and
  • A network facility
Slide : Code files The commands used in this tutorial are available in the Code Files link on this tutorial page.


Please download and extract the file before practicing.

Switch to gedit text editor and open the file I have opened the code file in the gedit text editor on my machine.


And I will use the same file to copy-paste the commands during the demonstration.


Shortcut to paste on the terminal is Shift, Ctrl and V keys.

Narration only Let us begin.
Press Ctrl+Alt+T keys Open the terminal by pressing Ctrl,Alt and T keys simultaneously on the keyboard.


Ensure that you have root permissions to run the commands.

[Terminal] Type:

sudo adduser dspace

First let us create a new user account and name it as dspace.


To do so, type the command sudo adduser dspace and press Enter.

[Terminal] Type:

admin password

Immediately, we are prompted to type the admin password.


So, type the admin password and press Enter.


The process of creating a new user has begun.

Only Narration Here onwards please remember to press the Enter key after typing each command.
Enter new UNIX password


Type password as dupass

The terminal will now prompt a message, “Enter new UNIX password”.


Here we have to set the password for the user dspace.


I will set the password as dupass.


You can give any password of your choice.

Retype password as dupass Type the same password in Retype new UNIX password.
Full Name: DSpace


Fill the rest of the details as shown here.

We have now successfully created the user dspace.

[Terminal] Type:


sudo adduser dspace sudo

Next let us add this new user dspace to the sudoers group.


By doing this, the user dspace will have full control of the system.


In the terminal, type sudo adduser dspace sudo

[Terminal] Type:


sudo su - dspace

Now, let us login as user dspace.


Type sudo su - dspace


If prompted, type the password of user dspace to login.

[Terminal] Type:


sudo apt-get update

Before proceeding further, let us update our system.


To do this, type sudo apt-get update


If prompted, type the password of user dspace to proceed further.

Narration only The updating process may take some time depending upon your internet speed.
[Terminal] Type:

sudo dpkg --configure -a

To avoid dpkg interruption errors during installation, type the following command

sudo dpkg --configure -a

[Terminal] Type:


sudo apt-get install openjdk-8-jdk -y

Next, let us install Java Development Kit.


To do so, type the following command in the terminal.


The installation may take some time depending upon your internet speed.

Narration only We have now successfully installed JDK.
[Terminal] Type:

java -version

Next, we will verify the installed JDK version.

To do so, type java -version

Highlight openjdk version “1.8.0_242” In the terminal , we can see openjdk version “1.8.0_242”


0_242 in the openjdk version is the release number, which may be different in your case.

Slide : JDK version


sudo apt-get remove openjdk-11-jre-headless

  • If the JDK version other than 8 is installed, then remove it.
  • For example, if JDK version 11 is installed then type the command as shown.

Switch to the terminal.

[Terminal] Type:

sudo apt-get install git -y

DSpace resource packages have to be pulled from the git repository using the git tool.


So let us install the git tool.


To do so, type the command as shown here.

[Terminal] Type:

sudo apt-get install maven -y

Now, let us install an Apache Maven, which is used to build DSpace source code.


To do so, type the command as shown here.

[Terminal] Type:

sudo apt-get install ant ant-optional -y

Next, we will install an Apache Ant tool, which is used to install DSpace.


To do so, type the command as shown.

[Terminal] Type:


sudo apt-get install tomcat8 -y

Next, let us install Tomcat 8.


To install Tomcat, type the command as shown here.

[Terminal] Type:


sudo gedit /etc/tomcat8/policy.d/05dspace.policy

Next we have to create a DSpace security policy.


This will provide all Java security permissions to DSpace.


Type the command as shown, to open a new policy file in gedit text editor.


You can do this in your editor, as well.

[Terminal] Type:


grant codeBase "file:/home/dspace/-" {

permission java.security.AllPermission;

};

grant codeBase "file:/tmp/-" {

permission java.security.AllPermission;

};

A new file opens in the text editor.


Type DSpace security policy as shown here.


You can copy-paste this piece of code from the Code File, as demonstrated here.

Press Ctrl+S >> close the file Now save and close the file.
[Terminal] We’re back on the terminal.
[Terminal] Type:


sudo chown root.tomcat8 /etc/tomcat8/policy.d/05dspace.policy

To provide ownership of DSpace security policy to Tomcat, type the command as shown.
[Terminal] Type:


sudo adduser tomcat8 dspace

To permit access of DSpace to Tomcat 8 , we have to add the Tomcat8 user to DSpace user group.


To do so, type the command as shown here.

[Terminal] Type:


sudo adduser dspace tomcat8

To permit access of Tomcat 8 to DSpace , we have to add the DSpace user to Tomcat8 group.


To do so, type the command as shown here.

[Terminal] Type:


sudo service tomcat8 restart

Now, restart tomcat server to update the changes.


To do so, type the command as shown here.

[Terminal] Type:

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

Next, we’ll install Postgresql, which is used as a database for DSpace.


Type the command as shown in the terminal to install postgresql.

Change database permissions to trust Next, we have to restrict the database to be accessed by trust method only.


To do that, we have to change peer, md5 and ident to trust.

[Terminal] Type:


sudo sed -i 's/peer/trust/' /etc/postgresql/10/main/pg_hba.conf

To change database permissions from peer to trust, type the command as shown.
[Terminal] Type:


sudo sed -i 's/md5/trust/' /etc/postgresql/10/main/pg_hba.conf

To change database permissions from md5 to trust, type the command as shown here.
[Terminal] Type:


sudo sed -i 's/ident/trust/' /etc/postgresql/10/main/pg_hba.conf

To change database permissions from ident to trust, type the command as shown.
[Terminal] Type:


sudo service postgresql restart

We have to restart postgresql to update the changes we just made.


To do so, type the command as shown here.

Narration only Now, we will create a dspace user in postgresql database.
[Terminal] Type:


createuser -U postgres -d -A -P dspace

Type this command as shown in the terminal.

Type the password as dbuserpass

Set a password for the user dspace for the database.


I will set the password as dbuserpass.


You can give any password of your choice.

Type the password as dbuserpass Retype the same password once again.
Type n


If prompted, respond ‘n’ to the question ‘ Shall the new role be allowed to create more new roles? (y/n)’.


We have successfully created the user dspace in postgresql.

[Terminal] Type:


sudo su - postgres

Let us login as user postgres.


To do so type the command as shown.

[Terminal] Type:


createdb -E UNICODE dspace

Next, we have to create a database named ‘dspace’.


To do so, type the following command.

[Terminal] Type:

psql -U postgres -d dspace

Type psql -U postgres -d dspace to connect to the database.
[Terminal] Type:


ALTER DATABASE dspace OWNER TO dspace;

Next, we have to provide dspace database ownership to user dspace.


To do so, type the following command.

[Terminal] Type:


GRANT ALL PRIVILEGES ON DATABASE dspace TO dspace;

To grant privileges to user dspace , type the command as shown.
[Terminal] Type:


CREATE EXTENSION pgcrypto;


pgcrypto extension allows DSpace to create universally unique identifiers for all objects in DSpace.


We will now add crypto extension to DSpace database.


So type the command as shown here.

[Terminal] Type: \q Type backslash q in the terminal to quit the database shell.
[Terminal] Type: exit Type exit in the terminal and press Enter, to switch back to DSpace user .
Narration only Now, we have to allow the database user dspace to connect to the database.


To do so, we will require root permissions.

[Terminal] Type: sudo -i Type sudo -i in the terminal.


Enter the root user password if prompted.

[Terminal] Type:

sudo echo "host dspace dspace 127.0.0.1/32 md5" >> /etc/postgresql/10/main/pg_hba.conf

Next, type the following command in the terminal.
[Terminal] Type: exit Type exit in the terminal to switch to the dspace account.
[Terminal] Type:

sudo service postgresql restart

Lastly, we have to restart the postgresql server once again.


To do so, type the command as shown here.

[Terminal] Type:


sudo gedit $HOME/.bashrc

Now, we will set up file creation permissions for DSpace.


To do so, type sudo gedit $HOME/.bashrc


You can open this file in any text editor of your choice.


bashrc file opens in the text editor.

[Gedit] Type


umask 002

Scroll to the end of the file.


Type umask 002


umask 002 sets default directory permissions to 775 and default file permissions to 664.

Save and close the file Now save and close the file.
[Terminal] Type:

sudo reboot

Finally restart the system, to flush umask 002 type permissions.


To do so, type sudo reboot in the terminal.


This will restart your computer.

Only narration With this we have successfully configured the database and tomcat server to install DSpace.


Let us summarize.

Slide : Summary


In this tutorial we learnt to-
  • Install Java, Tomcat8, Postgresql 10, Ant, Maven, and git
  • Configure Tomcat8 server and
  • Create dspace database in Postgresql 10
Slide : About Spoken Tutorial project The video at the following link summarises the Spoken Tutorial project.


Please download and watch it.

Slide: Spoken Tutorial workshops The Spoken Tutorial Project team conducts workshops and gives certificates.


For more details, please write to us.

Slide: Answers for THIS Spoken Tutorial


  • Do you have questions in THIS Spoken Tutorial? Please visit this site.
  • Choose the minute and second where you have the question.
  • Explain your question briefly.
  • The Spoken Tutorial project will ensure an answer.
  • You will have to register to ask questions.
Slide : Forum for specific questions
  • The Spoken Tutorial forum is for specific questions on this tutorial.
  • Please do not post unrelated and general questions on them.
  • This will help reduce the clutter.
  • With less clutter, we can use these discussions as instructional material.
Slide: Acknowledgement -I Spoken Tutorial project is funded by MHRD, Government of India.
Slide: Acknowledgement -II


DSpace spoken tutorial series is funded by the National Virtual Library of India, Ministry of Culture, Government of India.
Narration only This script and video for this tutorial was contributed by Pankaj Patil from IIT Bombay.


And this is Nancy Varkey signing off. Thanks for joining.

Contributors and Content Editors

Nancyvarkey, Pankajpatil694