- Introduction to the Learning System
- Deploy java environment
- Install maven
- Install node.js front-end packaging tool command npm
- Git command to get source code
- Install and configure mysql
- Front-end packaging
- Pack jar package
- Service online
- !!!Solution to failure of jar package creation
Introduction to the Learning System
The Xuezhisi open source examination system is a java + vue examination system that does not separate the front and back ends. The main advantages are simple and fast development and deployment, friendly interface design, and clear code structure. Supports web and WeChat applets, covering devices such as PCs and mobile phones. Supports multiple deployment methods: integrated deployment, front-end and back-end separation deployment, and docker deployment.
Deploy java environment
#Prepare the environment yum -y install vim wget lrzsz #Upload jdk package #Extract and install to the specified directory [root@localhost ~]# tar -xf jdk-8u211-linux-x64.tar.gz -C /usr/local [root@localhost ~]# mv /usr/local/jdk1.8.0_211/ /usr/local/java #Modify system environment variables [root@localhost ~]# vim /etc/profile JAVA_HOME=/usr/local/java PATH=$JAVA_HOME/bin:$PATH #Reload environment variables [root@localhost ~]# source /etc/profile #Check whether the java environment is configured successfully [root@localhost ~]# 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)
Install maven
#Download the maven installation package [root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz - -no-check-certificate #Install [root@localhost ~]# tar -xf apache-maven-3.8.8-bin.tar.gz -C /usr/local #Configure system variables [root@localhost ~]# vim /etc/profile MAVEN_HOME=/usr/local/maven PATH=$PATH:$MAVEN_HOME/bin #Reload environment variables [root@localhost ~]# source /etc/profile #Check maven version [root@localhost ~]# 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"
Install the node.js front-end packaging tool command npm
# Download node installation package [root@localhost ~]# wget https://nodejs.org/download/release/latest-v16.x/node-v16.20.2-linux-x64.tar.xz #Install and rename [root@localhost ~]# tar -xf node-v16.20.2-linux-x64.tar.xz -C /usr/local/ [root@localhost ~]# mv /usr/local/node-v16.20.2-linux-x64/ /usr/local/node #Configure environment variables [root@localhost ~]# vim /etc/profile NODE_HOME=/usr/local/node PATH=$NODE_HOME/bin:$PATH [root@localhost ~]# source /etc/profile #View node version [root@localhost ~]# node --version v16.20.2
Git command to get source code
[root@web-nginx ~]# yum install -y git [root@web-nginx ~]# git clone https://gitee.com/hyunze/xzs-mysql.git
Install and configure mysql
#Install MySQL and change password [root@localhost ~]# yum -y install mysql-server [root@localhost ~]# systemctl start mysqld [root@localhost ~]# grep pass /var/log/mysqld.log 2023-11-04T06:40:58.561457Z 1 [Note] A temporary password is generated for root@localhost: b/psllu>P0pd [root@localhost ~]# mysqladmin -uroot -p'b/psllu>P0pd' password 'Qianfeng@123' [root@localhost ~]# mysql -pQianfeng@123 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.42 MySQL Community Server (GPL) Copyright (c) 2000, 2023, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. #Create database xzs mysql> create database xzs character set utf8 collate utf8_general_ci; Query OK, 1 row affected (0.00 sec) #Set root to allow remote login mysql> update mysql.user set host = '%' where user = 'root'; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> \q Bye
#Modify database information [root@web-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?useSSL=false & amp;useUnicode=true & amp;serverTimezone=Asia/Shanghai & amp;characterEncoding=utf8 & amp;zeroDateTimeBehavior=convertToNull & amp;allowPublicKeyRetrieval= true &allowMultiQueries=true username: root password: QianFeng@123! driver-class-name: com.mysql.cj.jdbc.Driver #Import initialization sql [root@web-nginx ~]# mysql -uroot -p'QianFeng@123!' xzs < xzs-mysql/sql/xzs-mysql.sql
Front-end packaging
#Student terminal [root@web-nginx ~]# cd xzs-mysql/source/vue/xzs-student/ [root@web-nginx xzs-student]# npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ [root@web-nginx xzs-student]# npm install --registry https://registry.npm.taobao.org [root@web-nginx xzs-student]# npm run build [root@web-nginx xzs-student]# cp -r student xzs-mysql/source/xzs/src/main/resources/static #Management end [root@web-nginx ~]# cd xzs-mysql/source/vue/xzs-admin/ [root@web-nginx xzs-admin]# npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ [root@web-nginx xzs-admin]# npm install --registry https://registry.npm.taobao.org [root@web-nginx xzs-admin]# npm run build [root@web-nginx xzs-admin]# cp -r admin xzs-mysql/source/xzs/src/main/resources/static
Packaging jar package
[root@web-nginx ~]# cd xzs-mysql/source/xzs [root@web-nginx xzs]# mvn package
Service online
[root@web-nginx ~]# mkdir -p /application/java-server [root@web-nginx ~]# cp xzs-mysql/source/xzs/target/xzs-3.9.0.jar /application/java-server [root@web-nginx ~]# cd /application/java-server [root@web-nginx java-server]# nohup java -Duser.timezone=Asia/Shanghai -jar -Dspring.profiles.active=prod xzs-3.9.0.jar > start1.log 2> & amp;1 & amp ;
The student access address is: http://ip:8000/student
The administrator access address is: http://ip:8000/admin
Default student account: student / 123456
Manager default account: admin / 123456
!!!Solution to failure of jar package creation
Switch the foreign maven image to the domestic image source
Alibaba Cloud maven image source
[root@web-nginx ~]# vim /usr/local/maven/conf/settings.xml
Switch the mirrors module in the configuration file to the Alibaba Cloud mirror source as shown below
Repackage after modification is completed
[root@web-nginx ~]# cd xzs-mysql/source/xzs [root@web-nginx xzs]# mvn package