NTU Scholars 安裝 設定ntur.lib.ntu.edu.tw/retrieve/225015/8.安裝客製程式...NTUScholars...
Transcript of NTU Scholars 安裝 設定ntur.lib.ntu.edu.tw/retrieve/225015/8.安裝客製程式...NTUScholars...
2018/9/17 1
林柏源臺大圖書館系統資訊組
NTU Scholars安裝/設定
簡報綱要
2018/9/17 2
• 安裝• 設定• 備份• 障礙排除
NTUScholars安裝
2018/9/17 3
• 硬體建議• 軟體環境• 系統安裝
NTUScholars安裝 (硬體建議)
2018/9/17 4
Minimal DSpace Production system requirements
• This minimal system should be able to support DSpace sites of roughly 20,000 items or less.
• 6 GB of Ram• 2 GB for APP
• 1GB for Tomcat• 1GB for Database
• 4 GB for OS
• 20 GB of Storage
NTUScholars安裝 (硬體建議)
2018/9/17 5
Mid-range DSpace Production system
• This mid-range system may be necessary for DSpace sites which either have a larger number of items (roughly 50,000 or more) or a larger amount of activity (searches, accesses, downloads, etc) within the system.
• 10 GB of Ram• 4 GB for APP
• ~2GB for Tomcat• ~2GB for Database
• 6 GB for OS
• 200 GB of Storage
NTUScholars安裝 (硬體建議)
2018/9/17 6
High End DSpace Production system requirements:
• The high-end system should only be necessary for extremely large (500,000 or more items) or extremely active DSpace sites.
• 20 GB of Ram• 10 GB for APP
• ~4-6GB for Tomcat• ~2-4GB for Database
• 10 GB for OS
• 1TB of Storage
• 參考: Hardware Recommendations
NTUScholars安裝 (硬體建議)
2018/9/17 7
資料量(全文) RAM HD
Minimal 20,000↓ 6GB 100GB ↑
Mid-range 50,000↑ 10GB 300GB↑
High End 500,000↑ 20GB 2TB ↑
NTUScholars安裝 (軟體環境)
2018/9/17 8
• OS• APP
• Ant (僅安裝使用)• Java• Tomcat• PostgreSQL
NTUScholars安裝 (軟體環境)
2018/9/17 9
• OS• UNIX-like OS (Linux, HP/UX, Mac OSX, etc.)• Microsoft Windows Server
• For all path separators use forward slashes (e.g. "/"). For example: "C:/dspace" is a valid Windows path. But, be warned that "C:\dspace" IS INVALID and will cause errors.
NTUScholars安裝 (軟體環境)
2018/9/17 10
• Ant• Apache Ant 1.8.0 or later• 安裝
• 設定
# cd /opt/source# wget http://apache.stu.edu.tw//ant/binaries/apache-ant-1.10.5-bin.tar.gz# tar xzvf apache-ant-1.10.5-bin.tar.gz# mv apache-ant-1.10.5 /opt/apache-ant
# vim /etc/profile.d/exportPath.shexport PATH=$PATH:/opt/apache-ant/bin
NTUScholars安裝 (軟體環境)
2018/9/17 11
• Java• Oracle Java JDK8 or OpenJDK8 (官方建議JDK7)• 安裝:
# cd /opt/source# wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz# tar xzvf jdk-8u181-linux-x64.tar.gz# mv jdk1.8.0_181 /opt/jdk8
NTUScholars安裝 (軟體環境)
2018/9/17 12
• Java• 設定
# cd /opt/jdk8/# alternatives --install /usr/bin/java java /opt/jdk8/bin/java 2# alternatives --config java (選擇/opt/jdk8/bin/java)# alternatives --install /usr/bin/jar jar /opt/jdk8/bin/jar 2# alternatives --install /usr/bin/javac javac /opt/jdk8/bin/javac 2# alternatives --set jar /opt/jdk8/bin/jar# alternatives --set javac /opt/jdk8/bin/javac# java –version
# vim /etc/profile.d/exportPath.shexport JAVA_HOME=/opt/jdk8export JRE_HOME=/opt/jdk8/jre/export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
NTUScholars安裝 (軟體環境)
2018/9/17 13
• Tomcat• Tomcat 8 (官方建議Tomcat 7)• 安裝
• 設定 Port 80 及支援 UTF-8
# cd /opt/source# wget http://ftp.tc.edu.tw/pub/Apache/tomcat/tomcat-8/v8.5.30/bin/apache-tomcat-8.5.30.tar.gz [^]# tar xzvf apache-tomcat-8.5.30.tar.gz# mv apache-tomcat-8.5.30 /opt/tomcat
路徑: /opt/tomcat/conf/server.xml<Connector port="80" protocol="HTTP/1.1”
URI-encoding="UTF-8”…
NTUScholars安裝 (軟體環境)
2018/9/17 14
• Tomcat• CentOS 7 設定使用Port 80
• 新增tomcat使用者及修改目錄權
# setcap cap_net_bind_service+ep /opt/jdk8/bin/java # echo /opt/jdk8/lib/amd64/jli/ > /etc/ld.so.conf.d/java.conf# ldconfig# reboot
# useradd -m tomcat# chown -R tomcat:tomcat /opt/tomcat/
NTUScholars安裝 (軟體環境)
2018/9/17 15
• Tomcat• 設定 tomcat.service
# vim /etc/systemd/system/tomcat.service
# Systemd unit file for tomcat…Environment='CATALINA_OPTS=-Xms512M -Xmx8192M -XX:MaxPermSize=512M -server -XX:+UseParallelGC -Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true'…
# systemctl daemon-reload# systemctl enable tomcat# systemctl start tomcat
NTUScholars安裝 (軟體環境)
2018/9/17 16
• PostgreSQL• PostgreSQL 9.0 or later• 安裝
• 設定密碼
# yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-3.noarch.rpm [^]# yum install postgresql96-server postgresql96-contrib# /usr/pgsql-9.6/bin/postgresql96-setup initdb# systemctl enable postgresql-9.6# systemctl start postgresql-9.6
# su - postgres# psql -U postgrespostgres=# \password (修改密碼)postgres-# \q (離開)
NTUScholars安裝 (軟體環境)
2018/9/17 17
• PostgreSQL• 設定
• 設定檔位置:/var/lib/pgsql/9.6/data/postgresql.conf• In postgresql.conf: uncomment the line
starting: listen_addresses = 'localhost'.
NTUScholars安裝 (軟體環境)
2018/9/17 18
• PostgreSQL• 設定
• 設定檔位置:/var/lib/pgsql/9.6/data/pg_hba.conf
• 說明:• 用 SQL 語法修改密碼,METHOD要設為 trust• 用 \password 指令修改密碼,METHOD要設為 md5
NTUScholars安裝 (軟體環境)
2018/9/17 19
• PostgreSQL• 建立dspace使用者
# createuser -U postgres -d -A -P dspace# createdb -U dspace -E UNICODE dspace# psql -U postgres dspace -c "CREATE EXTENSION pgcrypto;"
NTUScholars安裝 (系統安裝)
2018/9/17 20
• 下載 dspace-installer 安裝包Install Cris
cd $DSPACE_INSTALL_DIRant fresh_install
Change [dspace] and all subfolders to be owned by tomcat (預設安裝路徑:$DSPACE_DIR = /opt/dspace)chown -R tomcat:tomcat $DSPACE_DIR
Create administrator$DSPACE_DIR/bin/dspace create-administrator
Load cris configuration$DSPACE_DIR/bin/dspace load-cris-configuration -f $DSPACE_DIR/etc/configuration-tool-demo.xls$DSPACE_DIR/bin/dspace load-cris-configuration -f $DSPACE_DIR/etc/configuration-tool-demo.xls
Registry loader$DSPACE_DIR/bin/dspace registry-loader -metadata $DSPACE_DIR/config/registries/item-types.xml
Restart tomcatsystemctl restart tomcat
NTUScholars設定
2018/9/17 21
• Basic Setting• METRICS Setting• ORCID Setting• Tomcat Setting• Cron Job Setting• UI Setting• Facet Setting• Search Filters Setting
NTUScholars設定(Basic Setting)
2018/9/17 22
$DSPACE_INSTALL_DIR/config/dspace.cfg# DSpace installation directorydspace.dir = /opt/dspace
# DSpace base host URL. Include port number etc.dspace.baseUrl = http://localhost
# DSpace base URL. Include port number etc., but NOT trailing slashdspace.url = http://localhost(預設為http://localhost/jspui)
NTUScholars設定(Basic Setting)$DSPACE_INSTALL_DIR/config/dspace.cfg
# Name of the sitedspace.name = DSpace-CRIS at My University
# Database username and passworddb.username = dspacedb.password = dspace
# Configuration settings for ORCID based authority control (預設為localhost,不建議修改)solr.authority.server=http://localhost/solr/authority
2018/9/17 23
NTUScholars設定(Basic Setting)$DSPACE_INSTALL_DIR/config/dspace.cfg
# SMTP mail server (其它相關設定請尋找mail 字開頭的參數設定)mail.server = smtp.example.com
# Canonical Handle URL prefixhandle.canonical.prefix = http://localhost/handle/
# 預設語系 (英文:en)default.locale = zh_TW
2018/9/17 24
NTUScholars設定(Basic Setting)$DSPACE_INSTALL_DIR/config/dspace.cfg
#For Scopussubmission.lookup.scopus.apikey=
# For WOSsubmission.lookup.webofknowledge.ip.authentication = true
# orsubmission.lookup.webofknowledge.user = submission.lookup.webofknowledge.password =
2018/9/17 25
NTUScholars設定(Basic Setting)
2018/9/17 26
$DSPACE_INSTALL_DIR/config/dspace.cfg# Google Analytics jspui.google.analytics.key=
# Google Mapkey.googleapi.maps =
NTUScholars設定(Basic Setting)
2018/9/17 27
$DSPACE_INSTALL_DIR/config/dspace.cfg# Settings to display the fulltext count of collection and communitywebui.strengths.show.fulltext = truewebui.strengths.show = true (必需為true)
NTUScholars設定(Basic Setting)
2018/9/17 28
$DSPACE_INSTALL_DIR/config/dspace.cfg# 列表顯示全文/檔案連結欄位webui.itemlist.columns = bitstreamformat
NTUScholars設定(Basic Setting)
2018/9/17 29
$DSPACE_INSTALL_DIR/config/dspace.cfg# 列表顯示crismetrics_scopus, crismetrics_wos欄位webui.itemlist.columns = crismetrics_scopus, crismetrics_wos
NTUScholars設定(Basic Setting)
2018/9/17 30
$DSPACE_INSTALL_DIR/config/dspace.cfg# 顯示相關文章webui.item.relateditems.show = true
NTUScholars設定(METRICS Setting)$DSPACE_INSTALL_DIR/config/modules/cris.cfg
# SCOPUSametrics.elsevier.scopus.enabled = true ametrics.elsevier.scopus.apikey =
# WOSametrics.thomsonreuters.wos.enabled= true
# GOOGLE SCHOLARametrics.google.scholar.enabled = true
# ALTMETRICametrics.altmetric.enabled = true
2018/9/17 31
NTUScholars設定(ORCID Setting)$DSPACE_INSTALL_DIR/config/modules/authentication-oauth.cfg
# Allow DSpace-CRIS to retrieve the handle identifier in the dialog with Orcid Registry to extract the putcodeapplication-client-name=
# The client id value <client-id> from ORCID client application registrationapplication-client-id=
# The client secret value <client-secret> from ORCID client application registrationapplication-client-secret=
# The URL where you will return the user when the authorization is complete. application-redirect-uri=http://localhost/oauth-login
autoregister=truechoice-page=falseorcid-embedded-login=true
2018/9/17 32
NTUScholars設定(ORCID Setting)$DSPACE_INSTALL_DIR/config/modules/authentication-oauth.cfg
# ORCID Authority Control use. orcid-api-url=https://api.orcid.org/v2.0
# Allows an ORCID member client to exchange an OAuth Authorization Code for an OAuth Access Token for a specific access scope.application-token-url=https://orcid.org/oauth/token
# Authorize URL for 3-Legged OAuth Authorization Stepapplication-authorize-url=http://orcid.org/oauth/authorize
# If you have only PUBLIC APIauthentication-oauth.application-client-scope =/authenticate
# if you have MEMBER API #authentication-oauth.application-client-scope =/authenticate /read-limited /person/update /activities/update
2018/9/17 33
參考:https://wiki.duraspace.org/display/DSPACECRIS/ORCID+Integration
NTUScholars設定(Tomcat Setting)
2018/9/17 34
$TOMCAT_DIR/conf/server.xml# 直接指定 dspace目錄下的webapps<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"><Context path="/" docBase="/opt/dspace/webapps/jspui" debug="0" reloadable="true" /><Context path="/solr" docBase="/opt/dspace/webapps/solr" debug="0" reloadable="true" /><Context path="/oai" docBase="/opt/dspace/webapps/oai" debug="0" reloadable="true" /><Context path="/rest" docBase="/opt/dspace/webapps/rest" debug="0" reloadable="true" />
NTUScholars設定(Tomcat Setting)
2018/9/17 35
• $TOMCAT_DIR/conf/server.xml# Solr開放遠端IP存取<Context path="solr" docBase="/opt/dspace/webapps/solr" debug="0" reloadable="true">
<Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="127\.0\.0\.1|192\.168\.1\.\d+"/>
<Parameter name="LocalHostRestrictionFilter.localhost" value="false" override="false" />
NTUScholars設定(Cron Job Setting)
2018/9/17 36
• Dspace Cron Job• # HOURLY TASKS
• ./dspace generate-sitemaps > /dev/null• # DAILY TASKS
• ./dspace oai import > /dev/null• ./dspace index-discovery > /dev/null• ./dspace stats-util –I• ./dspace sub-daily• ./dspace filter-media• ./dspace curate -q admin_ui
• # WEEKLY TASKS• ./dspace checker -l –p
• # MONTHLY TASKS• ./dspace cleanup > /dev/null
• # YEARLY TASKS• ./bin/dspace stats-util –s
NTUScholars設定(Cron Job Setting)
2018/9/17 37
• Dspace-Cris Cron Job • Metrics and Indicators
• # Daily Jobs• Scopus: ./scopus-retrieve• Web of Knowledge: ./wos-retrieve• PMC: ./pubmed-retrieve-citation-second• Usage statistics: ./view-and-download-retrieve
• # Weekly Jobs• ./period-weekly-retrieve (compute the weekly variation of all the
previous metrics)• # Monthly Jobs
• ./period-monthly-retrieve (compute the monthly variation of all the previous metrics)
NTUScholars設定(Cron Job Setting)
2018/9/17 38
• Dspace-Cris Cron Job • Send subscription
• # Daily Jobs• ./subscribe-daily• Send notification about
• new content (dspace items) in subscribed communities and collections• new content (dspace items) linked to subscribed cris objects• daily and total views and downloads statistics
• # Weekly Jobs• ./subscribe-weekly• Send notification about weekly and total views and downloads statistics
• # Monthly Jobs• ./subscribe-monthly• Send notification about monthly and total views and downloads statistics
NTUScholars設定(Cron Job Setting)
2018/9/17 39
• Dspace-Cris Cron Job • Build the network visualization
• # Daily Jobs• ./network-builder
• ORCID Syncronization• # Daily Jobs
• ./dspace dsrun org.dspace.app.cris.batch.ScriptPushOrcid
NTUScholars設定(UI Setting)
2018/9/17 40
• Menu順序• 機構典藏
• 修改$DSPACE_INSTALL_DIR/webapps/jspui/layout/navbar-default.jsp
• 單位、研究人員、研究成果檢索• 修改$DSPACE_INSTALL_DIR/config/modules/cris.cfg
• CSS 修改• $DSPACE_INSTALL_DIR/webapps/jspui/custom.css
NTUScholars設定(Facet Setting)• $DSPACE_INSTALL_DIR/config/dspace.
cfg
2018/9/17 41
NTUScholars設定(Facet Setting)
2018/9/17 42
• $DSPACE_INSTALL_DIR/config/spring/api/discovery.xml• 設定檔名稱參照
NTUScholars設定(Facet Setting)
2018/9/17 43
• 預設版面修改• $DSPACE_INSTALL_DIR/webapps/
jspui/discovery/static-sidebar-facet-statistics.jsp
• 客製版面修改• $DSPACE_INSTALL_DIR/webapps/
jspui/discovery/static-globalsearch-component-facet-statistics.jsp
NTUScholars設定(Facet Setting)
2018/9/17 44
首頁設定 預設設定
NTUScholars設定(Search Filters Setting)
2018/9/17 45
NTUScholars備份
2018/9/17 46
• PostgreSQL備份&還原• Bitstream備份&還原• Cris設定檔備份&還原
NTUScholars備份
2018/9/17 47
• PostgreSQL 備份• 語法:pg_dump [資料庫名稱] -U [帳號] -f [備份檔案名稱.backup.sql]
• # pg_dump dspace -U postgres -f dspace-db.backup.sql
• PostgreSQL還原 (先清空DB)• 語法:psql -f [備份檔案名稱.backup.sql] [資料庫] [帳號]• # psql -f dspace-db.backup.sql dspace postgres
• 還原後需Reset the primary key generation sequences• # psql -U dspace -f /opt/dspace/etc/postgres/update-
sequences.sql
NTUScholars備份
2018/9/17 48
• Bitstream 備份• # tar -zpcv -f dspace_bitstream.tar.gz /opt/dspace/assetstore
• Bitstream還原• # cd /opt/dspace• # tar -zxv -f dspace_bitstream.tar.gz
NTUScholars備份
2018/9/17 49
• Cris設定檔備份• # /opt/dspace/bin/dspace export-cris-configuration -f
/opt/dspace/etc/configuration-tool-demo.xls
• Cris設定檔還原• # /opt/dspace/bin/dspace load-cris-configuration -f
$DSPACE_DIR/etc/configuration-tool-demo.xls
障礙排除
2018/9/17 50
障礙排除
2018/9/17 51
• 無法建立Administrator Account1. Stop Tomcat2. Clean the database3. Create the Administrator account (./dspace create-administrator)4. Then restart Tomcat
障礙排除
2018/9/17 52
• 查看log• 網頁無法正常啟用
• /opt/tomcat/log/catalina.out• 功能異常
• /opt/dspace/log/dspace.log
• 設定log模式為debug模式• 修改/opt/dspace/config/log4j.properties• 把INFO改為DEBUG
The End
2018/9/17 53