室内设计网站案例,本手机原有微信网站,餐饮众筹模板网站建设,服务器维护是什么意思简介#xff1a; 学之思开源考试系统是一款 java vue 的前后端分离的考试系统。主要优点是开发、部署简单快捷、界面设计友好、代码结构清晰。支持web端和微信小程序#xff0c;能覆盖到pc机和手机等设备。 支持多种部署方式#xff1a;集成部署、前后端分离部署、docker部…简介 学之思开源考试系统是一款 java vue 的前后端分离的考试系统。主要优点是开发、部署简单快捷、界面设计友好、代码结构清晰。支持web端和微信小程序能覆盖到pc机和手机等设备。 支持多种部署方式集成部署、前后端分离部署、docker部署。 集成部署
环境版本下载地址NodeJs16https://nodejs.org/download/release/latest-v16.x/Jdk1.8https://www.oracle.com/java/technologies/downloads/Mysql8.0/5.7https://dev.mysql.com/downloads/ 数据库脚本下载地址https://www.mindskip.net:999创建表初始化数据数据库名称为xzs 代码下载 mysql版本配合相应的数据库使用 安装mysql 导入xzs-mysql.sql脚本 学生端默认账号student / 123456 管理端默认账号admin / 123456 实操
所有操作都在一台服务器实施前后端不分离
安装打包工具
安装jdk
[rootweb-nginx ~]# tar xzvf jdk-8u221-linux-x64.tar.gz -C /usr/local/
[rootweb-nginx ~]# mv /usr/local/jdk1.8.0_221/ /usr/local/java配置环境变量
[rootweb-nginx ~]# vim /etc/profile
JAVA_HOME/usr/local/java
PATH$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH重载环境变量
[rootweb-nginx ~]# source /etc/profile查看java是否安装成功
[rootweb-nginx ~]# java -version
java version 1.8.0_211
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
安装maven
[rootweb-nginx ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz解压并改名
[rootweb-nginx ~]# tar xzvf apache-maven-3.8.8-bin.tar.gz -C /usr/local/
[rootweb-nginx ~]# mv /usr/local/apache-maven-3.8.8/ /usr/local/maven设置环境变量
[rootweb-nginx ~]# vim /etc/profile
MAVEN_HOME/usr/local/maven
PATH$PATH:$MAVEN_HOME/bin
export MAVEN_HOME PATH重载环境变量
[rootweb-nginx ~]# source /etc/profile检测maven是否安装成功
[rootweb-nginx ~]# mvn -version
Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Maven home: /usr/local/maven
Java version: 1.8.0_211, vendor: Oracle Corporation, runtime: /usr/local/java/jre
Default locale: en_US, platform encoding: UTF-8
OS name: linux, version: 3.10.0-1160.el7.x86_64, arch: amd64, family: unix
安装node.js前端打包工具命令npm
[rootweb-nginx ~]# wget https://nodejs.org/download/release/latest-v16.x/node-v16.20.2-linux-x64.tar.xz
[rootweb-nginx ~]# tar xf node-v16.20.2-linux-x64.tar.xz -C /usr/local/
[rootweb-nginx ~]# cd /usr/local/
[rootweb-nginx local]# mv node-v16.20.2-linux-x64/ node配置环境变量
[rootweb-nginx ~]# vim /etc/profile
NODE_HOME/usr/local/node
PATH$NODE_HOME/bin:$PATH
export NODE_HOME PATH重载环境变量
[rootweb-nginx ~]# source /etc/profile查看是否安装成功查看版本
[rootweb-nginx ~]# node --version
v16.20.2
获取源代码
安装Git命令获取源代码
[rootweb-nginx ~]# yum install -y git
获取clone代码
[rootweb-nginx ~]# git clone https://gitee.com/hyunze/xzs-mysql.git
安装mysql5.7
[rootweb-nginx ~]# wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
[rootweb-nginx ~]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm
[rootweb-nginx ~]# vim /etc/yum.repos.d/mysql-community.repo
将mysql8.0关闭将mysql5.7开启
enabled1
gpgcheck0
[rootweb-nginx ~]# yum install -y mysql-community-server启动mysql
[rootweb-nginx ~]# systemctl start mysqld过滤第一次登录所需的密码
[rootweb-nginx ~]# grep pass /var/log/mysqld.log 改密码
[rootweb-nginx ~]# mysqladmin -uroot -pHdV.fIr8;h password QianFeng123!
[rootweb-nginx ~]# mysql -uroot -pQianFeng123!
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.31 MySQL Community Server (GPL)
...创建数据库xzs
mysql create database xzs character set utf8 collate utf8_general_ci;
Query OK, 1 row affected (0.00 sec)设置root允许远程登录
mysql update mysql.user set host % where user root;
Query OK, 1 row affected (0.10 sec)
Rows matched: 1 Changed: 1 Warnings: 0刷新权限
mysql flush privileges;mysql \q
Bye
配置mysql环境
修改mysql
[rootweb-nginx ~]# vim xzs-mysql/source/xzs/src/main/resources/application-prod.yml
logging:path: /usr/log/xzs/spring:datasource:url: jdbc:mysql://192.168.1.101:3306/xzs?useSSLfalseuseUnicodetrueserverTimezoneAsia/ShanghaicharacterEncodingutf8zeroDateTimeBehaviorconvertToNullallowPublicKeyRetrievaltrueallowMultiQueriestrueusername: rootpassword: QianFeng123!driver-class-name: com.mysql.cj.jdbc.Driver#####url那一行 ip改为自己做实验服务器的ip/ 的名字改为自己之前创建数据库的名字。password改为远程登录MySQL数据库的密码
导入初始化mysql
[rootweb-nginx ~]# mysql -uroot -pQianFeng123! xzs xzs-mysql/sql/xzs-mysql.sql
前端打包
学生端
[rootweb-nginx ~]# cd xzs-mysql/source/vue/xzs-student/打包
[rootweb-nginx xzs-student]# npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
[rootweb-nginx xzs-student]# npm install --registry https://registry.npm.taobao.org
[rootweb-nginx xzs-student]# npm run build
[rootweb-nginx xzs-student]# cp -r student xzs-mysql/source/xzs/src/main/resources/static
管理端
[rootweb-nginx ~]# cd xzs-mysql/source/vue/xzs-admin/打包
[rootweb-nginx xzs-admin]# npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
[rootweb-nginx xzs-admin]# npm install --registry https://registry.npm.taobao.org
[rootweb-nginx xzs-admin]# npm run build
[rootweb-nginx xzs-admin]# cp -r admin xzs-mysql/source/xzs/src/main/resources/static
将java程序打包成jar包
这时候进行打包所使用的镜像源是国外的源因此会导致打包时间巨长打包超时打包失败为了杜绝这种现象我们可以采用阿里云的镜像源
打开 maven镜像_maven下载地址_maven安装教程-阿里巴巴开源镜像站 (aliyun.com)https://developer.aliyun.com/mirror/maven?spma2c6h.13651102.0.0.3e221b11gh5cgw 配置maven的配置文件替换镜像源 vim /usr/local/maven/conf/settings.xml 将源文件里的内容替换为 这时开始打包 速度就会很快
[rootweb-nginx ~]# cd xzs-mysql/source/xzs
[rootweb-nginx xzs]# mvn package
服务上线
[rootweb-nginx ~]# mkdir -p /application/java-server
[rootweb-nginx ~]# cp xzs-mysql/source/xzs/target/xzs-3.9.0.jar /application/java-server
[rootweb-nginx ~]# cd /application/java-server让服务在后台运行
[rootweb-nginx java-server]# nohup java -Duser.timezoneAsia/Shanghai -jar -Dspring.profiles.activeprod xzs-3.9.0.jar start1.log 21 成功运行的日志显示 访问 学生端访问地址为http://ip:8000/student 管理员端访问地址为http://ip:8000/admin 学生端默认账号student / 123456 管理端默认账号admin / 123456 实验中遇到问题 1.mysql设置root允许远程登录语法出现错误 2.学生端及管理端进行打包时注意路径的使用 3.在后端打包时如果使用国外的源可以替换为阿里云的镜像源提升打包成功率。 4.养成观察日志的习惯遇到错误在日志中寻找错误原因