WCP知识共享平台部署
一、环境准备
操作系统:CentOS Linux release 7.5.1804 (Core)
Java:jdk-7u79-linux-x64.tar.gz
中间件:apache-tomcat-7.0.92.tar.gz
数据库:mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
WCP知识共享平台安装步骤 :
二、软件安装:
1.安装JDK程序
1.1.卸载系统自带的OpenJDK以及相关的java文件
1.1.1.检查Java版本信息
# java -version
openjdk version "1.8.0_161"
OpenJDK Runtime Environment (build 1.8.0_161-b14)
OpenJDK 64-Bit Server VM (build 25.161-b14, mixed mode)
1.1.2.查看系统自带Java相关文件
# rpm -qa | grep java
javamail-1.4.6-8.el7.noarch
python-javapackages-3.4.1-11.el7.noarch
tzdata-java-2018c-1.el7.noarch
java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64
javassist-3.16.1-10.el7.noarch
java-1.7.0-openjdk-1.7.0.171-2.6.13.2.el7.x86_64
java-1.7.0-openjdk-headless-1.7.0.171-2.6.13.2.el7.x86_64
java-1.8.0-openjdk-headless-1.8.0.161-2.b14.el7.x86_64
javapackages-tools-3.4.1-11.el7.noarch
1.1.3卸载系统自带的Openjdk版本(其他不用卸载)
# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64
# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.171-2.6.13.2.el7.x86_64
# rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.171-2.6.13.2.el7.x86_64
# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.161-2.b14.el7.x86_64
1.1.4.检查是否已经删除成功
# java -version
bash:java:未找到命令...
1.2.解压jdk-7u79-linux-x64
# tar -xzf jdk-7u79-linux-x64.tar.gz -C /usr/local/data/java/
# cd /usr/local/data/java/jdk1.7.0_79/
1.2.1.配置JDK环境变量
# vim /etc/profile
文本最后添加
#java environment
export JAVA_HOME=/usr/local/data/java/jdk1.7.0_79
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin
1.2.2.环境变量生效并检查是否安装成功
# source /etc/profile
# java -version
2.安装Tomcat中间件
2.1.解压缩apache-tomcat-7.0.92
# tar -xzf apache-tomcat-7.0.92.tar.gz -C /usr/local/data/
# cd /usr/local/data
# mv apache-tomcat-7.0.92 tomcat7
2.1.1.启动Tomcat7
# cd /usr/local/data/tomcat7/bin
# ./startup.sh
2.1.2.关闭Tomcat7
# cd /usr/local/data/tomcat7/bin
# ./ shutdown.sh
3.安装MySQL数据库
3.1.卸载系统自带的MySQL和Mariadb数据库
3.1.1.卸载系统自带的MySQL数据库
# rpm -qa | grep mysql
akonadi-mysql-1.9.2-4.el7.x86_64
qt-mysql-4.8.7-2.el7.x86_64
# rpm -e akonadi-mysql-1.9.2-4.el7.x86_64 --nodeps
# rpm -e qt-mysql-4.8.7-2.el7.x86_64 –nodeps
3.1.2.卸载系统自带的Mariadb数据库
# rpm -qa | grep mariadb
mariadb-server-5.5.56-2.el7.x86_64
mariadb-5.5.56-2.el7.x86_64
mariadb-libs-5.5.56-2.el7.x86_64
# rpm -e mariadb-server-5.5.56-2.el7.x86_64 --nodeps
# rpm -e mariadb-5.5.56-2.el7.x86_64 --nodeps
# rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps
3.2.解压缩MySQL-5.7.24-linux-glibc2.12-x86_64
tar -xzf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -C /usr/local/data
# cd /usr/local/data
# mv mysql-5.7.24-linux-glibc2.12-x86_64/ mysql
3.2.1.创建用户和组
# groupadd mysql
# useradd -r -g mysql mysql
3.2.2.修改MySQL目录权限
# cd /usr/local/data/mysql/
# chown -R mysql:mysql ./
3.2.3.添加MySQL服务
cp /usr/local/data/mysql/support-files/mysql.server /etc/init.d/mysql
vim /etc/init.d/mysql
basedir=/usr/local/data/mysql/
datadir=/usr/local/data/mysql/data
3.2.4.添加MySQL配置文件
vim /etc/my.cnf
# *** DO NOT EDIT THIS FILE. It's a template which will be copied to the
# *** default location during install, and will be replaced if you
# *** upgrade to a newer version of MySQL.
[client]
port = 3306
default-character-set=utf8
[mysqld]
# 一般配置选项
basedir = /usr/local/data/mysql
datadir = /usr/local/data/mysql/data
port = 3306
character-set-server=utf8
default_storage_engine=InnoDB
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
lower_case_table_names=1
3.3.初始化MySQL数据库
3.3.1.编译安装并初始MySQL数据库
cd /usr/local/mysql/bin/
./mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
3.3.2.自动生成默认密码在执行记录中,请复制保存
root@localhost: vL:hjwZq(7=p
3.3.3.启动MySQL-5.7.24-linux-glibc2.12-x86_64数据库
service mysql start
3.3.4.登录及远程配置MySQL-5.7.24-linux-glibc2.12-x86_64数据库
cd /usr/local/mysql/bin
./mysql -uroot –p
Enter password: vL:hjwZq(7=p (输入默认的临时密码)
3.3.5.修改MySQL-5.7.24-linux-glibc2.12-x86_64数据库登录密码(自定义密码)
mysql> set password=password('12345678');
3.3.6.设置MySQL-5.7.24-linux-glibc2.12-x86_64数据库远程访问
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Agree123';
mysql> flush privileges;
mysql> exit;
3.3.7.设置开机启动
chkconfig --list
chkconfig --add mysql
chkconfig mysql on
3.3.8.配置环境变量
vi /etc/profile
# Mysql environment
export MYSQL_HOME=/usr/local/mysql
export PATH=$PATH:$MYSQL_HOME/bin
source /etc/profile
4.安装Apache_OpenOffice办公套件
4.1.解压缩Apache_OpenOffice_4.1.6
tar -xzf Apache_OpenOffice_4.1.6_Linux_x86-64_install-rpm_zh-CN.tar.gz -C /usr/local/data/
cd /usr/local/data/zh-CN/RPMS/
4.1.1.安装RPM文件
rpm -ivh *.rpm
cd desktop-integration
rpm -ivh openoffice4.1.6-redhat-menus-4.1.6-9790.noarch.rpm
4.1.2.启动OpenOffice进程
临时启动:
/opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
后台启动:
nohup /opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &
4.1.3.停止OpenOffice进程
ps -ef | grep soffice | grep -v grep | awk '{print $2}' | xargs kill -9
5.安装WCP知识共享库
5.1.创建相应目录
# mkdir -p /data/file/doc
# mkdir -p /data/file/import
# mkdir -p /data/file/export
# mkdir -p /data/file/index
5.2.程序文件上传Tomcat下的webapps目录
[root@localhost webapps]# cd /usr/local/data/tomcat7/webapps/
ROOT/ *知识库主项目*
wda/ *附件预览功能*
wcp.v4.2.0.sql *数据库脚本*
5.3.登录MySQL数据库
[root@localhost webapps]# mysql -uroot -p
mysql> create database wcp4;
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ekca |
| mysql |
| performance_schema |
| sys |
| wcp4 |
+--------------------+
6 rows in set (0.05 sec)
mysql> use wcp4
mysql> source /usr/local/data/tomcat7/webapps/wcp.v4.2.0.sql;
mysql> exit
5.4.修改ROOT主项目系统配置参数
5.4.1.修改jdbc.properties文件下的用户密码和库名称
[root@localhost ~]# vim /ROOT/WEB-INF/classes/jdbc.properties
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc\:mysql\://127.0.0.1\:3306/wcp4?useUnicode=true&characterEncoding=utf-8
jdbc.username=root
jdbc.password=********
5.4.2.修改WcpWebConfig.xml文件下的相关路径
[root@localhost ~]# vim /ROOT/WEB-INF/classes/WcpWebConfig.xml
<!-- 界面展示 -->
<group describe="文字标记/通用配置" name="webshow">
<parameter name="config.sys.title">
<val>**知识分享平台</val>
<describe>系统标题</describe>
</parameter>
<parameter name="config.sys.foot">
<val>**知识分享平台</val>
<describe>系统页面最下方显示</describe>
</parameter>
<!--文件上传 -->
<group describe="文件" name="document.properties">
<parameter name="config.doc.dir">
<val>/data/file/doc</val>
<describe>附件文件夹地址,
1. 使用相对路径[WEBROOT]表示部署路径的根目录比如:
(WEBROOT/files=E:\server\wcp-tomcat-6.0.16\webapps\wcp\files)
2.或者使用绝对路径如:[D:\wcp3server\resource\file]
</describe>
</parameter>
<parameter name="config.doc.file.import">
<val>/data/file/import</val>
<describe>本地知识导入目录</describe>
</parameter>
<parameter name="config.doc.file.export">
<val>/data/file/export</val>
<describe>本地知识导出目录</describe>
</parameter>
<!-- 索引文件,全文检索 -->
<group describe="全文检索" name="indexConfig.properties">
<parameter name="config.file.luncene_index_dir">
<val>/data/file/index</val>
<describe>索引文件夹地址,
1.使用相对路径[WEBROOT]表示部署路径的根目录比如:
(WEBROOT/indexfiles=E:\server\wcp-tomcat-6.0.16\webapps\wcp\indexfiles)
2.或者使用绝对路径如:[D:\wcp3server\resource\index]
</describe>
</parameter>
5.5.修改wda附件预览系统配置参数
5.5.1.修改config.properties文件
[root@localhost webapps]# vim wda/WEB-INF/classes/config.properties
修改WDA的openoffice进程结束路径
config.server.openoffice.kill.cmd=ps -ef | grep soffice | grep -v grep | awk '{print $2}' | xargs kill -9
修改WDA的openoffice启动路径
config.server.openoffice.start.cmd=nohup /opt/openoffice4/program/soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard &
5.6.用户同步和logo修改
5.6.1.LDAP同步配置
[root@localhost webapps]# vim /ROOT/WEB-INF/classes/WcpInterConfig.xml
<!-- LDAP用户同步接口 -->
<group describe="LDAP用户同步接口" name="ldap">
<parameter name="config.wcp.ldap.state">
<val>true</val>
<describe>是否启用LDAP接口</describe>
</parameter>
<parameter name="config.wcp.ldap.url">
<val>ldap://192.168.*.*:389/</val>
<describe>ldap的服务地址,
如:ldap://123.113.98.18:539/</describe>
</parameter>
<parameter name="config.wcp.ldap.admin.name">
<val>cn=****,dc=****,dc=****</val>
<describe>查询用户名(CN)</describe>
</parameter>
<parameter name="config.wcp.ldap.admin.password">
<val>******</val>
<describe>查询用户密码</describe>
</parameter>
<parameter name="config.wcp.ldap.orgdn">
<val>ou=****,dc=****,dc=****</val>
<describe>组织机构的目录DN,只加载该节点的子节点</describe>
</parameter>
5.6.2.logo更换
[root@localhost webapps]# cd /ROOT/text/img/
*确保在黑色和白色背景下显示正常*
*尺寸要求“60*60”“140*90”
login-third-party.png
logo.png
5.7.使用浏览器验证
Web界面登录
Web服务界面
URL http://192.168.*.*:8080/wda
5.8.管理用户
username:sysadmin
password:********