智慧车辆管理系统是一种集成了现代信息技术的高效解决方案,旨在优化车辆监控、调度和管理。该系统通过GPS定位、物联网技术、大数据分析和人工智能算法,实现对车辆的实时追踪、状态监控和故障预警。它能够提高车队运营效率,降低成本,并增强安全性。通过用户友好的界面,管理者可以轻松获取车辆信息,制定调度计划,及时响应突发事件,从而提升整体的物流和交通管理水平。
配置过程如下
- 基础环境准备systemctl stop firewalld.service --now
setenforce 0
yum -y install zip
unzip vehicle.zip
tar -xf repository_vehicle.tar.gz
tar -xf apache-maven-3.6.3-bin.tar.gz - MySQL数据库准备
- 安全mysql数据库软件包并启动服务
yum -y install mysql mysql-server
systemctl enable mysqld --now
配置项目用户
[root@zhcl ~]#mysqladmin -uroot -p password ‘123456’
[root@zhcl ~]#Mysql -uroot -p123456
mysql> create user prouser@localhost identified by ‘123456’;
mysql> grant all privileges on *.* to prouser@localhost ;
配置项目数据库
mysql -hlocalhost -uprouser -p'123456' < vehicle_backend/sql/vehicle.sql
- 配置maven服务进行后端代码编译
- 修改后端yml配置文件数据库参数,如下:
- [root@zhcl ~]# vim vehicle_backend/src/main/resources/application-vm.yml
..........................................
type: com.alibaba.druid.pool.DruidDataSource url:jdbc:mysql://localhost:3306/vehicle_management?characterEncoding=utf8&serverTimezone=UTC
driver-class-name: com.mysql.cj.jdbc.Driver
username: prouser
password: 123456
........................................... - 安装配置maven服务安装JDK
yum -y install java-1.8.0-openjdk-devel
配置maven环境变量
[root@zhcl ~]# mv apache-maven-3.6.3 /usr/local/maven
[root@zhcl ~]# mv repository /usr/local/maven/
[root@zhcl ~]#tail -2 /etc/bashrc
export MAVEN_HOME="/usr/local/maven"
export PATH=${MAVEN_HOME}/bin/:$PATH
[root@zhcl ~]# source /etc/bashrc
[root@zhcl ~]# mvn -v
配置maven仓库
[root@zhcl ~]#mv repository /usr/local/maven/
[root@zhcl ~]#vim /usr/local/maven/conf/settings.xml
......
<mirror>
<id>local-repo</id>
<mirrorOf>*</mirrorOf>
<name>local-repo</name>
<url>file:///usr/local/maven/repository</url>
</mirror>
.......
(3)编译后端代码,生成可执行的jar包
[root@zhcl ~]#cd vehicle_backend/
[root@zhcl vehicle_backend]#mvn clean
[root@zhcl vehicle_backend]#mvn package -Dmaven.test.skip=true
[root@zhcl vehicle_backend]# ls target/
classes maven-archiver vehicle-0.0.1-SNAPSHOT.jar
generated-sources maven-status vehicle-0.0.1-SNAPSHOT.jar.original
[root@zhclvehicle_backend]cp target/vehicle-0.0.1-SNAPSHOT.jar
/usr/local/project/vehicle/
- 车辆管理系统项目部署
- 配置项目服务管理脚本
[root@zhcl ~]mkdir -p /usr/local/project/vehicle
[root@zhcl ~]mv run.sh /usr/local/project/vehicle/
[root@zhcl ~]chmod +x /usr/local/project/vehicle/run.sh - 编写项目service服务文件
- [root@zhcl ~]# vim /usr/lib/systemd/system/vehicle.service
[root@zhcl ~]# cat /usr/lib/systemd/system/vehicle.service
[Unit]
Description=VehicleProject Jar
After=sshd.service
[Service]
ExecStart=/usr/local/project/vehicle/run.sh start
ExecStop=/usr/local/project/vehicle/run.sh stop
Type=forking
[Install]
WantedBy=multi-user.target
[root@zhcl ~]# systemctl daemon-reload重新加载service文件 - 启动服务、测试接口
[root@zhcl ~]# systemctl enable vehicle.service --now
[root@zhcl ~]# ss -anptul | grep 8080
tcp LISTEN 0 100 *:8080 *:* users:(("java",pid=956,fd=19))
打开浏览器访问:http://ip地址:8080
测试接口(需登录认证123456/123456)
5.项目前端资源部署# 上传前端资源
[root@zhcl ~]# cp -r vehicle_frontend/dist /usr/local/project/vehicle/
[root@zhcl ~]# cd /usr/local/project/vehicle/
[root@zhcl ~]# ls dist
# 部署大屏幕
[root@zhcl ~]# cp -r vehicle_homepage /usr/local/project/vehicle/homepage
[root@zhcl ~]# ls /usr/local/project/vehicle/homepage/
data files homepage.html images index.html plugins resources
start_c_1.html start.html start_with_pages.html
# 安装nginx
[root@zhcl ~]# yum -y install nginx
[root@zhcl ~]# vim /etc/nginx/nginx.conf
#注释掉默认配置文件监听端口
[root@zhcl ~]# sed -rn '38,40p' /etc/nginx/nginx.conf
server {
#listen 80 default_server;
#listen [::]:80 default_server;
# 配置nginx发布资源
[root@zhcl ~]# vim /etc/nginx/conf.d/vehicle.conf
[root@zhcl ~]# cat /etc/nginx/conf.d/vehicle.conf
server {
listen 80;
server_name __;
location / {
root "/usr/local/project/vehicle/dist/";
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /dashboard/display/ {
alias "/usr/local/project/vehicle/homepage/";
index homepage.html index.html index.htm;
try_files $uri $uri/ /index.html;
}
location /api/ {
proxy_pass http://localhost:8080/;
# 启动服务
[root@zhcl ~]# systemctl enable nginx.service --now
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service →
/usr/lib/systemd/system/nginx.service.
[root@zhcl ~]# ss -anptul | grep nginx
tcp LISTEN 0 128 0.0.0.0:80 0.0.0.0:* users:(("nginx",pid=1785,fd=8),("nginx",pid=1751,fd=8))
6.测试验证