安装环境

首先安装java、maven、git和ant

[root@vm-06 ~]# yum install java-1.8.0 maven ant git

安装完后,修改maven的配置文件,修改镜像源避免maven下载过慢,这里自行修改。

安装数据库

接下来安装postgresql12

# 安装postgresql的RPM仓库:
[root@vm-06 ~]# yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# 安装 PostgreSQL和contrib:
[root@vm-06 ~]# yum install -y postgresql12-server postgresql12-contrib

# 初始化数据库:
[root@vm-06 ~]# /usr/pgsql-12/bin/postgresql-12-setup initdb
# 设置开机启动
[root@vm-06 ~]# systemctl enable postgresql-12
# 启动数据库
[root@vm-06 ~]# systemctl start postgresql-12

再去修改默认的poostgres用户密码

[root@vm-06 ~]# su - postgres psql

然后执行修改语句

# 修改超级用户密码
postgres=# ALTER USER postgres WITH PASSWORD 'postgres';

# 安装加密扩展
postgres=# CREATE EXTENSION pgcrypto;

# 再输入\q退出
postgres=# \q

修改配置文件开启远程链接

#修改配置文件
[root@vm-06 ~]# vi /var/lib/pgsql/12/data/postgresql.conf

#将监听地址修改为 *
#默认listen_addresses配置是注释掉的,所以可以直接在配置文件开头加入该行
listen_addresses='*'

#修改配置文件
[root@vm-06 ~]#vi /var/lib/pgsql/12/data/pg_hba.conf

#在文件尾部加入
host  all  all 0.0.0.0/0 md5

# 修改 host 127.0.0.1/32那行为下面的内容
host    all             all             127.0.0.1/0             md5

然后重启数据库

# 启动数据库
[root@vm-06 ~]# systemctl start postgresql-12

创建用户

需要单独创建一个用户来运行dspace

# 创建用户
[root@vm-06 ~]# useradd dspace

# 设置用户密码 需要连续输入两次
[root@vm-06 ~]# passwd dspace

# 切换到当前用户
[root@vm-06 ~]# su dspace

# 切换到当前用户目录
[dspace@vm-06 ~]# su dspace

下载安装dspace6.3

下载

从github下载6.3的源码,dspace6.3 地址 https://github.com/DSpace/DSpace/releases/tag/dspace-6.3

# 下载源码
[dspace@vm-06 ~]# wget https://github.com/DSpace/DSpace/releases/download/dspace-6.3/dspace-6.3-release.tar.gz

#解压源码
[dspace@vm-06 ~]# tar -xvf dspace-6.3-release.tar.gz

修改配置

接着修改配置文件,文件路径 /home/dspace/dspace-6.3/dspace/config/local.cfg
默认安装目录为 /dspace ,建议不要动这个,如需要修改请修改 dspace.dir=/dspace,安装目录这个要和配置文件的保持一致

由于配置文件中的安装目录为 /dspace,则需要创建dspace的安装目录,并指定用户所有者

[dspace@vm-06 ~]# mkdir /dspace

# 我指定的用户为dspace 目录为/dspace
[dspace@vm-06 ~]# chown dspace  /dspace

还有要先修改链接数据库的账号密码,账号密码为前面你设置的

# 修改连接地址 localhost 为127.0.0.1 便于使用 md5 认证连接,不然后面打包会失败
db.url = jdbc:postgresql://127.0.0.1:5432/postgres
# 修改账号密码为 postgres 密码要和你设置的对应 我设置的密码为 postgres
db.username = postgres
db.password = postgres

编译

保存后,接下来进入源码目录编译源码

[dspace@vm-06 ~]# cd /home/dspace/dspace-6.3
[dspace@vm-06 dspace-6.3]# mvn package

打包过程很慢,需要下载很多依赖,可能会出现权限不足的情况,如果出现权限问题,给予源码目录777权限即可

[dspace@vm-06 ~]# chmod -R 777 /home/dspace/dspace-6.3

安装

打包完成后 进入到编译号的产物目录中执行安装操作

# 进入目录
[dspace@vm-06 ~]# cd /home/dspace/dspace-6.3/dspace/target/dspace-installer

#安装DSpace 到 `/dspace`中去 安装过程会刷一堆类似下面的日志
 [dspace@vm-06 dspace-installer]$ ant fresh_install
 
Buildfile: /home/dspace/dspace-6.3/dspace/target/dspace-installer/build.xml

init_installation:

prepare_configs:
    [mkdir] Created dir: /home/dspace/dspace-6.3/dspace/target/dspace-installer/config-temp
     [copy] Copying 159 files to /home/dspace/dspace-6.3/dspace/target/dspace-installer/config-temp
     [copy] Copying 1 file to /home/dspace/dspace-6.3/dspace/target/dspace-installer/config-temp
     [copy] Copying 16 files to /home/dspace/dspace-6.3/dspace/target/dspace-installer/config-temp

init_configs:
     [copy] Copying 1 file to /dspace/config
   [delete] Deleting directory /home/dspace/dspace-6.3/dspace/target/dspace-installer/config-temp

test_database:
     [java] 2020-09-15 11:02:43,789 WARN  org.dspace.services.email.EmailServiceImpl @ Couldn't get an email session from environment:  Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
     [java] 
     [java] Attempting to connect to database
     [java] Connected successfully!
     [java] 
     [java] Database Type: postgres
     [java] Database URL: jdbc:postgresql://127.0.0.1:5432/postgres
     [java] Database Schema: public
     [java] Database Username: postgres
     [java] Database Software: PostgreSQL version 12.4
     [java] Database Driver: PostgreSQL JDBC Driver version 42.2.1
     [java] PostgreSQL 'pgcrypto' extension installed/up-to-date? true (version=1.3)
     [java] 2020-09-15 11:02:44,723 WARN  org.dspace.services.sessions.SessionRequestServiceImpl @ Request interceptor (org.dspace.services.events.SystemEventService$EventRequestInterceptor@cd46c1) failed to execute on end (request-337-1600138964365): null

install_code:
     [copy] Copying 8 files to /dspace/bin
     [copy] Copying 180 files to /dspace/lib
     [copy] Copying 5 files to /dspace/etc
     [copy] Copying 52 files to /dspace/solr
     [echo] 
     [echo] ====================================================================
     [echo]  The DSpace code has been installed.
     [echo] ====================================================================
     [echo]         

fresh_install:

copy_webapps:
     [copy] Copying 3024 files to /dspace/webapps
     [copy] Copied 302 empty directories to 1 empty directory under /dspace/webapps
     [copy] Copying 10 files to /dspace/webapps

build_webapps_wars:

check_geolite:

init_geolite:

update_geolite:
     [echo] Downloading: http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
      [get] Getting: http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
      [get] To: /dspace/config/GeoLite2-City.tar.gz
      [get] Error getting http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz to /dspace/config/GeoLite2-City.tar.gz
     [echo] 
     [echo] ====================================================================
     [echo] WARNING : FAILED TO DOWNLOAD GEOLITE DATABASE FILE
     [echo]           (Used for DSpace Solr Usage Statistics)
     [echo] 
     [echo] Underlying Error: java.net.UnknownHostException: geolite.maxmind.com
     [echo] 
     [echo] In order to use DSpace Solr Usage Statistics, you will need to
     [echo] manually re-run:
     [echo] 
     [echo] ant update_geolite
     [echo] 
     [echo] OR
     [echo] 
     [echo] You may manually install this file by following these steps:
     [echo] (1) Download the latest database archive from http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
     [echo] (2) Unpack it.'
     [echo] (3) Copy the file 'GeoLite2-City.mmdb' to '${usage-statistics.dbfile}'.
     [echo] 
     [echo] ====================================================================
     [echo]                 
     [echo] 
     [echo] ====================================================================
     [echo]  The DSpace code has been installed.
     [echo] 
     [echo]  To complete installation, you should do the following:
     [echo] 
     [echo]  * Setup your Web servlet container (e.g. Tomcat) to look for your
     [echo]    DSpace web applications in: /dspace/webapps/
     [echo] 
     [echo]    OR, copy any web applications from /dspace/webapps/ to
     [echo]    the appropriate place for your servlet container.
     [echo]    (e.g. '$CATALINA_HOME/webapps' for Tomcat)
     [echo] 
     [echo]  * Start up your servlet container (e.g. Tomcat). DSpace now will
     [echo]    initialize the database on the first startup.
     [echo] 
     [echo]  * Make an initial administrator account (an e-person) in DSpace:
     [echo] 
     [echo]    /dspace/bin/dspace create-administrator
     [echo] 
     [echo]  You should then be able to access your DSpace's 'home page':
     [echo] 
     [echo]    http://localhost:8080/xmlui
     [echo] 
     [echo] ====================================================================
     [echo]         

BUILD SUCCESSFUL
Total time: 25 seconds

部署

到这里就该进行部署了,这里需要先下载tomcat进行部署

# 下载源码
[dspace@vm-06 ~]# wget https://downloads.apache.org/tomcat/tomcat-8/v8.5.57/bin/apache-tomcat-8.5.57.tar.gz

# 解压
[dspace@vm-06 ~]# tar -xvf apache-tomcat-8.5.57.tar.gz

#拷贝文件到tomcat目录中去
[dspace@vm-06 ~]# cp -r /dspace/webapps/* /home/dspace/apache-tomcat-8.5.57/webapps

到这里就差启动和创建登录用户了,如果你要指定运行端口的话,修改 tomcat的配置文件 server.xml,我这里使用默认的8080端口,接下来启动

# 启动tomcat
[dspace@vm-06 ~]# /home/dspace/apache-tomcat-8.5.57/startup.sh

# 关闭tomcat 如果需要关闭的时候在执行这个
[dspace@vm-06 ~]# /home/dspace/apache-tomcat-8.5.57/shutdown.sh

# 初始化dspace用户
[dspace@vm-06 ~]# /dspace/bin/dspace create-administrator

执行初始化管理员账户后,后面会先让你输入邮箱,两次密码,两次名字,再然后输入y确认就可以了,等待tomcat启动后,切到root用户,防火墙放行8080端口

[root@vm-06 ~]# sudo firewall-cmd --add-port=8080/tcp --permanent
[root@vm-06 ~]# sudo firewall-cmd --reload

后面就可以访问了
JSP 用户界面 http://SERVER_IP:8080/jspui
XML 用户界面 http://SERVER_IP:8080/xmlui
OAI-PMH接口 http://SERVER_IP:8080/oai/request?verb=Identify

最后修改:2020 年 09 月 15 日 12 : 56 PM
如果觉得我的文章对你有用,请随意赞赏