Jeesite 4.4.0 本地部署

Jeesite 4.4.0 本地部署

准备工作

本地环境

Java SDK 1.8

IntelliJ IDEA 2019.3.2

Maven安装

首先官网下载Maven安装包,由于新Maven版本可能不适配旧版本Idea,需要选择与当前Idea版本兼容的Maven版本。下载完成后将安装包解压,并新建repository文件夹作为本地仓库。
在这里插入图片描述

打开apache-maven-x.x.x/conf/settings.xml文件,在<mirrors>标签下添加阿里云仓库。

<mirror>
	<id>alimaven</id>
	<name>aliyun maven</name>
	<url>https://maven.aliyun.com/repository/central</url>
	<mirrorOf>central</mirrorOf>
</mirror>
Idea中配置Maven

打开Idea,在File->Setting中配置Idea。
在这里插入图片描述

MySQL安装

下载并安装MySQL8.0以及MySQL Workbench8,完成环境变量配置。以管理员身份运行cmd,输入以下命令启动MySQL

net start MySQL服务器名称

导入Idea

在Idea中选择File->Open…,选择/root/pom.xml文件导入 。
在这里插入图片描述

初始化数据库

创建用户和授权

在数据库中执行以下SQL语句:

set global read_only=0;
set global optimizer_switch='derived_merge=off'; 
create user 'jeesite'@'%' identified by 'jeesite'; # 创建用户
create database jeesite DEFAULT CHARSET 'utf8' COLLATE 'utf8_general_ci';   # 创建数据库
grant all privileges on jeesite.* to 'jeesite'@'%' with grant option;  # 用户授权
# MySQL8.0之前授权语句为:
# grant all privileges on jeesite.* to 'jeesite'@'%' identified by 'jeesite';
flush privileges; # 应用权限设置

运行数据库初始化脚本jeesite_mysql_v5.0.1_2022-3-31.sql,完成数据库初始化
在这里插入图片描述

数据库配置

打开文件 /web/src/main/resources/config/application.yml 配置产品和项目名称及 JDBC 连接

# 产品或项目名称、软件开发公司名称
productName: JeeSite Demo
companyName: ThinkGem

# 产品版本、版权年份
productVersion: V4.4
copyrightYear: 2022

# 数据库连接
jdbc: 
    # Mysql 数据库配置
    type: mysql
    driver: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://127.0.0.1:3306/jeesite?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai
    username: jeesite
    password: jeesite
    testSql: SELECT 1
连接MySQL出现Public Key Retrieval is not allowed错误

启动应用后出现com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Public Key Retrieval is not allowed错误,查看官网文档的解释:

NameDefaultDescription
AllowPublicKeyRetrievalfalseIf the user account uses sha256_password authentication, the password must be protected during transmission; TLS is the preferred mechanism for this, but if it is not available then RSA public key encryption will be used. To specify the server’s RSA public key, use the ServerRSAPublicKeyFile connection string setting, or set AllowPublicKeyRetrieval=True to allow the client to automatically request the public key from the server. Note that AllowPublicKeyRetrieval=True could allow a malicious proxy to perform a MITM attack to get the plaintext password, so it is False by default and must be explicitly enabled.

这可能是MySQL的传输保护机制,可以将AllowPublicKeyRetrieval设置为true。

    url: jdbc:mysql://127.0.0.1:3306/jeesite?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai&AllowPublicKeyRetrieval=true

或者开启SSL连接,将JDBC url的useSSL修改为true。

    url: jdbc:mysql://127.0.0.1:3306/jeesite?useSSL=true&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=CONVERT_TO_NULL&serverTimezone=Asia/Shanghai

启动Tomcat服务

Spring Boot内部已经集成了Web容器,无需另外下载Tomcat进行部署,只需在/web/src/main/resources/config/application.yml文件中进行简单配置即可:

server:
  port: 8980
  servlet:
    context-path: /js
  tomcat:
    uri-encoding: UTF-8

接下来点击Idea右上角启动应用。
在这里插入图片描述

测试运行

浏览器访问 http://127.0.0.1:8980/js

默认最高管理员账号:system,密码:admin

 
 
参考JeeSite开发手册-快速开始、安装部署

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值