若依系统安装部署-前后端分离版
1 依赖环境
依赖环境如下:
1、JDK 1.8+
2、MySQL
3、Redis,本示例中版本为:Redis-x64-5.0.14.1.msi
下载地址:https://github.com/tporadowski/redis/releases/download/v5.0.14.1/Redis-x64-5.0.14.1.msi
4、Maven
5、Vue
JDK、MySQL、Maven安装方法在下面链接里面
https://www.cnblogs.com/snow2021/p/17441138.html
2 配置
2.1 redis数据库
1、修改配置文件。原因是不修改的话经常报错,错误如下:
主界面报错如下:
Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.
所以修改redis安装目录下面redis.windows.conf配置文件。记得创建一下此目录。
# Note that you must specify a directory here, not a file name.
dir 'F:/redis_database'
2、启动redis数据库
C:\Program Files\Redis>redis-server.exe redis.windows.conf [87200] 12 Jun 14:04:53.886 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo [87200] 12 Jun 14:04:53.886 # Redis version=5.0.14.1, bits=64, commit=ec77f72d, modified=0, pid=87200, just started [87200] 12 Jun 14:04:53.886 # Configuration loaded _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 5.0.14.1 (ec77f72d/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 87200 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' [87200] 12 Jun 14:04:53.891 # Server initialized [87200] 12 Jun 14:04:53.892 * Ready to accept connections
如果启动失败的话就从客户端启动。
C:\Program Files\Redis>redis-cli.exe 127.0.0.1:6379> shutdown not connected> exit C:\Program Files\Redis>redis-server.exe redis.windows.conf _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 3.0.504 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 53648 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' [53648] 12 Jun 10:05:49.051 # Server started, Redis version 3.0.504
2.2 配置mysql数据库
1、设置mysql账号密码
路径:\RuoYi-Vue-master\ruoyi-admin\src\main\resources\application-druid.yml,添加mysql账号密码。
username: root
password: root
3 启动
3.1 后台启动
直接执行:\RuoYi-Vue-master\ruoyi-admin\src\main\java\com\ruoyi\RuoYiApplication.java
访问浏览器后台地址:http://localhost:8080/
出现上述界面代码启动成功
3.2 前台启动
使用cmd打开:\code\RuoYi-Vue-master\ruoyi-ui
# 进入项目目录
cd ruoyi-ui
# 安装依赖
npm install
# 建议不要直接使用 cnpm 安装依赖,会有各种诡异的 bug。可以通过如下操作解决 npm 下载速度慢的问题
npm install --registry=https://registry.npmmirror.com
# 启动服务
npm run dev
浏览器访问 http://localhost:80
出现登录界面代码成功:注意要有验证码图片代表前后台连接成功。
如果启动失败的话,报下面错误:
可以输入下面代码:
$env:NODE_OPTIONS="--openssl-legacy-provider"
参考:
https://blog.csdn.net/chenxy_bwave/article/details/121924829