操作系统:CentOS7.9 / Ubuntu22.04,硬件配置:4核8G内存、100G以上云硬盘(存储电子档案),开放安全组端口:80(web访问)、3306(MySQL)、6379(Redis)、9200(ElasticSearch)
所有命令均使用root账号执行,如需普通账号请加sudo前缀
1.2.1 安装JDK1.8
```shell yum install -y java-1.8.0-openjdk-devel 验证安装 java -version 输出openjdk version "1.8.0_xxx"即为成功 ```1.2.2 安装MySQL8.0
```shell 配置MySQL源 rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm yum install -y mysql-community-server 启动并设置开机自启 systemctl start mysqld systemctl enable mysqld 获取初始密码 grep 'temporary password' /var/log/mysqld.log 登录MySQL修改密码,替换下方的自定义密码 mysql -uroot -p初始密码 ALTER USER 'root'@'localhost' IDENTIFIED BY 'Gjj@darchive2024'; 创建系统专用库 CREATE DATABASE gjj_darchive DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; 授权远程访问 GRANT ALL ON gjj_darchive. TO 'root'@'%' IDENTIFIED BY 'Gjj@darchive2024'; FLUSH PRIVILEGES; exit ```1.2.3 安装Redis6.x
```shell yum install -y epel-release yum install -y redis 修改配置:设置密码、允许远程访问 sed -i 's/^bind 127.0.0.1/bind 0.0.0.0/' /etc/redis.conf sed -i 's/ requirepass foobared/requirepass GjjRedis@2024/' /etc/redis.conf 启动并开机自启 systemctl start redis systemctl enable redis ```1.2.4 安装ElasticSearch7.17(用于全文检索)
```shell rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch cat > /etc/yum.repos.d/elasticsearch.repo << EOF [elasticsearch] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=0 autorefresh=1 type=rpm-md EOF yum install -y --enablerepo=elasticsearch elasticsearch-7.17.10 修改配置 sed -i 's/network.host: 192.168.0.1/network.host: 0.0.0.0/' /etc/elasticsearch/elasticsearch.yml sed -i 's/http.port: 9200/http.port: 9200/' /etc/elasticsearch/elasticsearch.yml echo "http.cors.enabled: true" >> /etc/elasticsearch/elasticsearch.yml echo "http.cors.allow-origin: \"\"" >> /etc/elasticsearch/elasticsearch.yml sed -i 's/-Xms1g/-Xms2g/' /etc/elasticsearch/jvm.options sed -i 's/-Xmx1g/-Xmx2g/' /etc/elasticsearch/jvm.options 启动并开机自启 systemctl start elasticsearch systemctl enable elasticsearch ```直接下载官方稳定版安装包:
```shell mkdir -p /usr/local/gjj-darchive cd /usr/local/gjj-darchive wget https://gitee.com/opensource-gjj/gjj-darchive/releases/download/v1.2.0/gjj-darchive-v1.2.0.jar ```
在安装目录下创建application.yml配置文件,直接复制下方内容,仅需替换192.168.0.100为你自己的服务器公网IP即可:
```yaml server: port: 80 spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://192.168.0.100:3306/gjj_darchive?useUnicode=true&characterEncoding=utf8mb4&useSSL=false&serverTimezone=Asia/Shanghai username: root password: Gjj@darchive2024 redis: host: 192.168.0.100 port: 6379 password: GjjRedis@2024 servlet: multipart: max-file-size: 50MB max-request-size: 100MB elasticsearch: host: 192.168.0.100 port: 9200 file: storage-path: /usr/local/gjj-darchive/files/ ```必须提前创建文件存储目录,否则启动会报错:
```shell mkdir -p /usr/local/gjj-darchive/files chmod 777 /usr/local/gjj-darchive/files ```浏览器访问服务器公网IP,默认管理员账号:admin,默认密码:Admin@123456,首次登录必须修改密码,密码要求8位以上包含大小写、数字、特殊字符。
进入【系统设置】-【元数据管理】,确认已默认配置以下必填字段,缺失的手动添加:
进入【系统设置】-【OCR配置】,填入百度智能云通用文字识别的API Key和Secret Key,可直接在百度智能云官网(https://ai.baidu.com/tech/ocr/general)申请免费额度,配置后上传登记证扫描件即可自动识别填充所有元数据字段,无需手动录入。
进入【档案管理】-【归档规则设置】,按以下规则配置:
按以下步骤验证所有功能是否正常: