Install Openssh
sudo apt-get install openssh-server
sudo service ssh status
1. sudo apt-get install openjdk-8-jdk
if you found this problem
...E:Could not get lock /var/lib/dpkg/lock’
please try this steps to fix it
a. ps aux | grep -i apt
b. sudo kill -9 processid (look at sudo apt update)
c. Then kill all process about '..apt..'
or more details
How to Fix 'E:Could not get lock /var/lib/dpkg/lock’ Error in Ubuntu
Ref: https://itsfoss.com/could-not-get-lock-error/
2. set JAVA_HOME
sudo vi ~/.bashrc or
sudo nano ~/.bashrc
[add the next two lines below]
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
export PATH=$PATH:$JAVA_HOME
3. Install maven
sudo apt-get install maven
4. Install postgresql
sudo apt-get install postgresql
5. Download tomcat
wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.5.24/bin/apache-tomcat-8.5.24.tar.gz
6. Extracting tomcat
tar -xvzf apache-tomcat-8.5.24.tar.gz
7. Changing to directory /opt
sudo mv apache-tomcat-8.5.24 /opt
8. Change directory name to 'tomcat'
sudo mv /opt/apache-tomcat-8.5.24 /opt/tomcat
9. Add group name of 'tomcat'
sudo groupadd tomcat
10. Increase user name 'tomcat'
sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
* -s /bin/false ==> set shell to be 'false' to prevent using 'tomcat' login name
* -g tomcat ==> set this user name to be group of 'tomcat'
* -d /opt/tomcat ==> set home directory to be '/opt/tomcat'
11. Changing group owner of path '/opt/tomcat' to be group of 'tomcat'
sudo chgrp -R tomcat /opt/tomcat/
12. Setting group owner to be read and execute path of '/opt/tomcat/conf '
(&& is use for running with more than one command at the same time)
sudo chmod -R g+r /opt/tomcat/conf && sudo chmod g+x /opt/tomcat/conf
13. Changing user owner path of webapps/ work/ temp/ logs/ to be user of tomcat
cd /opt/tomcat
sudo chown -R tomcat webapps/ work/ temp/ logs/
14. Creating service name 'tomcat'
sudo vi /etc/systemd/system/tomcat.service or
sudo nano /etc/systemd/system/tomcat.service
Add some lines below into 'tomcat.service'
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'
ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh
User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
15.Reloading systemd daemon
sudo systemctl daemon-reload
16.starting tomcat service and check the working status
sudo systemctl start tomcat
sudo systemctl status tomcat
17.Let's service tomcat always start up after restarting
sudo systemctl enable tomcat
18.To be config tomcat (For Thai language)
sudo /opt/tomcat/conf/server.xml or
sudo nano /opt/tomcat/conf/server.xml
by adding property -> URIEncoding="UTF-8" to tag Connector
Then it became
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8"/>
19.Setting authentication of postgresql to be 'trust' for allowing to create database to 'dspace'
sudo vi /etc/postgresql/9.5/main/pg_hba.conf or
sudo nano /etc/postgresql/9.5/main/pg_hba.conf
by changing the line below
local all postgres peer
..and change to be..
local all postgres trust
Then restart service postgresql with command 'sudo service postgresql restart'
20.download DSpace Installer with command
wget https://github.com/DSpace/DSpace/releases/download/dspace-5.7/dspace-5.7-release.zip
21. Copying DSpace Installer to directory name '/srv'
sudo cp dspace-5.7-release.zip /srv
22. Unzip Dspace Installer
cd /srv
sudo unzip /srv/dspace-5.7-release.zip
* Requirement to install unzip package by using command 'sudo apt-get install zip'
23. Create user name is 'dspace'
sudo useradd -m dspace
24. Next, create database user
sudo su - postgres
createuser --username=postgres --no-superuser --pwprompt dspace
(type password 'dspace' )
* --username=postgres ==> Login user name for logging into database to create new database user
* --no-superuser ==> Setting new created user without 'superuser'
* --pwprompt ==> Setting new password of user
* dspace ==> Name of user will be creating
25.Create new Database name is 'dspace' by using 'postgres' user
and assign owner to user 'dspace'
sudo su - postgres
createdb --username=postgres --owner=dspace --encoding=UNICODE dspace
* --username=postgres ==> Login user name for logging into database to create new database name
* --owner=dspace ==> Setting database owner
* --encoding=UNICODE ==> Setting encoding to be UNICODE
* dspace ==> Name of database will be creating
26. Creating folder name 'dspace' in directory '/srv'
sudo mkdir /srv/dspace
27. Changing owner of folder '/srv/dspace' to be dspace user
sudo chown dspace /srv/dspace
28. Changing configuration in 'build.properties' of installer
sudo vi /srv/dspace-5.7-release/build.properties or
sudo nano /srv/dspace-5.7-release/build.properties
[Changing some lines below]
dspace.install.dir = /srv/dspace
dspace.ui = jspui
dspace.name = Name of Institutional Repository
db.url=jdbc:postgresql://localhost:5432/dspace
db.username=user1
db.password=user1
mail.server = smtp.example.com
mail.server.username=
mail.server.password=
mail.from.address = dspace-noreply@myu.edu
mail.feedback.recipient = dspace-help@myu.edu
mail.admin = dspace-help@myu.edu
handle.canonical.prefix = ${dspace.url}/handle/
handle.prefix = 123456789
29. To build DSpace Installer
cd /srv/dspace-5.7-release
mvn package
*Wating for 20-40 Minutes (Based on speed of each internet networking)
30.Installing DSpace
cd /srv/dspace-5.7-release/dspace/target/dspace-installer
ant fresh_install
31. Setting user for managing 'tomcat' through UI
sudo vi /opt/tomcat/conf/tomcat-users.xml or
sudo nano /opt/tomcat/conf/tomcat-users.xml
under tag of 'tomcat-users' add below message to the last line
so it will be
.........
<user username="admin" password="xxxxx" roles="manager-gui,admin-gui"/>
</tomcat-users>
32.To allow tomcat from any client can be remoting
Edit at the directory of ....../manager/......
sudo vi /opt/tomcat/webapps/manager/META-INF/context.xml or
sudo nano /opt/tomcat/webapps/manager/META-INF/context.xml
and Edit at the directory of ....../host-manager/......
sudo vi /opt/tomcat/webapps/host-manager/META-INF/context.xml or
sudo nano /opt/tomcat/webapps/host-manager/META-INF/context.xml
comment or remark the next line below of both file the above
so it will change from
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
to be
<!-- <Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" /> -->
33. Then restart service tomcat with command 'sudo systemctl restart tomcat'
34.Creating web app. through UI by logging into 'http://[host]:8080/manager'
example:
http://dspaceweb.com:8080/manager or
http://9.9.9.9:8080/manager
(if found error 403 Access Denied, please go back to check no.32 again !!)
Context Path (required) ==> select path on web site such as: /solr
WAR or Directory URL ==> path of project such as: /srv/dspace/webapps/solr
35. Otherwise, creating web app. into '/opt/tomcat/conf/server.xml'
sudo nano /opt/tomcat/conf/server.xml
by adding next line below
<Context path="" docBase=""></Context> within tag Host </Host> !!
For example,
<Context path="/jspui" docBase="/srv/dspace/webapps/jspui"></Context>
<Context path="/oai" docBase="/srv/dspace/webapps/oai"></Context>
<Context path="/rdf" docBase="/srv/dspace/webapps/rdf"></Context>
<Context path="/rest" docBase="/srv/dspace/webapps/rest"></Context>
<Context path="/solr" docBase="/srv/dspace/webapps/solr"></Context>
<Context path="/sword" docBase="/srv/dspace/webapps/sword"></Context>
<Context path="/sword2" docBase="/srv/dspace/webapps/sword2"></Context>
<Context path="/xmlui" docBase="/srv/dspace/webapps/xmlui"></Context>
36. Creating Administrator account to manage Dspace system
/srv/dspace/bin/dspace create-administrator
37. Opening REST API Service
by setting web app point to '/srv/dspace/webapps/rest'
So, it should be
<Context path="/rest" docBase="/srv/dspace/webapps/rest"></Context>
* In case of using REST API with common http,
it need to be comment out in '/srv/dspace/webapps/rest/WEB-INF/web.xml'
nano /srv/dspace/webapps/rest/WEB-INF/web.xml
* by comment out at '<security-constraint>'
change from
<security-constraint> .......................................
........................................................................
</security-constraint>
to be
<!-- <security-constraint> .......................................
........................................................................
</security-constraint> -->
38. Changing jsp file
* For any changed of 'home.jsp', you need to be copy 'home.jsp' into folder '/srv/dspace-5.7-release/dspace/modules/jspui/src/main/webapp'
* Then run command 'mvn package' in path of /srv/dspace-5.7-release/dspace
*and next run command 'ant -Dconfig=/srv/dspace/config/dspace.cfg'
in the directory of '/srv/dspace-5.7-release/dspace/target/dspace-installer'
* Then restart service tomcat with command 'sudo systemctl restart tomcat'
39. Before to be continue the next step, please try to do backup /ROOT in
/opt/tomcat/webapps by using this command
sudo cp -avr /opt/tomcat/webapps/ROOT /opt/tomcat/webapps/ROOT-backup
Next, In case of using jspui, you need to be copy file from directory '/srv/dspace/webapps/jspui'
to replace into '/opt/tomcat/webapps/ROOT'
by using this command
cp -avr /srv/dspace/webapps/jspui/* /opt/tomcat/webapps/ROOT
chown -R tomcat:tomcat /opt/tomcat/webapps/ROOT
and for solr,
need to be copy file from directory '/srv/dspace/webapps/solr' to replace into
/opt/tomcat/webapps/solr