若依管理系统部署
jdk、maven、node、mysql、redis准备
mysql准备
#安装mysql
apt install mysql-server
修改mysql配置
vim /etc/mysql/mysql.conf.d/mysqld.cnf
#注释这两条
#bind-address = x.x.x.x
#mysqlx-bind-address = x.x.x.x
启动mysql
systemctl start mysql.service
mysql创建库、用户及授权
create database ry;
create user 'dongzhi'@'%' identified with mysql_native_password by '123456';
grant all privileges on *.* to 'dongzhi'@'%';
flush privileges;
redis准备
#安装redis
apt install redis-server
修改redis配置
vim /etc/redis/redis.conf
#修改以下配置
bind 0.0.0.0
启动redis
systemctl start redis-server.service
jdk准备
cd /opt
tar xf jdk-8u212-linux-x64.tar.gz
ln -s jdk1.8.0_212 jdk
maven准备
cd /opt
tar xf apache-maven-3.8.8-bin.tar.gz
ln -s apache-maven-3.8.8 maven
maven配置
在</mirrors>标签中配置
vim maven/conf/settings.xml
...
<mirror>
<id>aliyunmaven</id>
<mirrorOf>*</mirrorOf>
<name>阿里云公共仓库</name>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
...
node准备
cd /opt
tar xf node-v16.19.0-linux-x64.tar.gz
ln -s node-v16.19.0-linux-x64 node
配置环境变量
vim /etc/profile
export JAVA_HOME=/opt/jdk
export MAVEN_HOME=/opt/maven
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
export PATH="$JAVA_HOME/bin:$MAVEN_HOME/bin:/opt/node/bin:$PATH"
加载环境变量配置文件
source /etc/profile
若依部署
下载若依源码
git clone https://gitee.com/y_project/RuoYi-Vue.git
cd RuoYi-Vue-master
导入以下sql
ls sql/*
sql/quartz.sql sql/ry_20240629.sql
修改若依后端配置文件
vim ruoyi-admin/src/main/resources/application-druid.yml
...
# 数据源配置
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.0.129:3306/ry?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: dongzhi
password: 123456
...
vim ruoyi-admin/src/main/resources/application.yml
...
# redis 配置
redis:
# 地址
host: 192.168.0.129
# 端口,默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password:
...
后端打包
#打包
mvn clean package -Dmaven.test.skip=true
#启动
cd ruoyi-admin/target/
java -jar ruoyi-admin.jar
前端打包
cd ruoyi-ui
#安装依赖
npm install --registry=https://registry.npmmirror.com
# 打包
npm run build:prod
nginx准备
安装nginx
apt install nginx
配置nginx
cd /etc/nginx/conf.d
vim ruoyi.conf
server {
listen 80;
server_name localhost;
charset utf-8;
location / {
root /opt/RuoYi-Vue-master/ruoyi-ui/dist;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /prod-api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
启动nginx
systemctl start nginx.service
部署成功结果
原文地址:https://blog.csdn.net/wuxingge/article/details/143661237
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!