系统版本
:ubuntu2204
sudo apt update
## 编译工具
sudo apt install git openjdk-11-jdk tar vim cmake gcc g++ libsrtp2-dev libssl-dev
## ffmepg
sudo apt install ffmpeg
git clone https://gitee.com/xia-chu/ZLMediaKit.git
cd ZLMediaKit
git submodule update --init --recursive
mkdir -p build release/linux/Release/
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_WEBRTC=true -DENABLE_TESTS=false ..
cmake --build . --target MediaServer
官网下载地址
wget https://dlcdn.apache.org/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz
mkdir app
tar xf apache-maven-3.9.4-bin.tar.gz
mv apache-maven-3.9.4 app/maven
echo "export PATH=~/app/maven/bin:\$PATH" >> ~/.bashrc
## 环境变量生效
source ~/.bashrc
官网下载地址
wget https://nodejs.org/dist/v16.19.0/node-v16.19.0-linux-x64.tar.gz
tar xf node-v16.19.0-linux-x64.tar.gz
mv node-v16.19.0-linux-x64 app/node
echo "export PATH=~/app/node/bin:\$PATH" >> ~/.bashrc
## 环境变量生效
source ~/.bashrc
git clone https://gitee.com/pan648540858/wvp-GB28181-pro.git
cd wvp-GB28181-pro/web_src
# 下载依赖
npm install --registry=https://registry.npmmirror.com
# 编译
npm run build
cd ..
mvn clean package -DskipTests
curl -sfL https://get.rainbond.com/install_docker | bash
sudo curl -L https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
## 创建储存目录
mkdir -p /home/media/mysqldata /home/media/redisdata
cd /home/media/
vim video.yml
将以下内容复制到vim
编辑器中
version: "3.8"
services:
redis:
image: redis:6.2-alpine
restart: always
environment:
TZ: Asia/Shanghai
ports:
- 6379:6379
volumes:
- /opt/video/redisdata/data:/data
- /opt/video/redisdata/log:/logs
command: redis-server --port 6379 --requirepass 12345678 --appendonly yes
mysql:
image: mysql:8
restart: always
command:
[
"--character-set-server=utf8mb4",
"--collation-server=utf8mb4_unicode_ci",
"--default-time-zone=+8:00",
]
ports:
- 3306:3306
environment:
TZ: Asia/Shanghai
MYSQL_ROOT_PASSWORD: 12345678
SQL_MODE: "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION"
volumes:
- /opt/video/mysqldata/mysql:/var/lib/mysql:rw
# 将镜像pull下来
docker pull redis:6.2-alpine
docker pull mysql:8
## 启动
docker-compose -f video.yml -p wvp up -d
mkdir -p /home/media/zlm
# 进入zlm项目目录
cd ~/ZLMediaKit
cp -r release/linux/Release/* /home/media/zlm
vim /etc/systemd/system/zlm.service
将以下内容复制到vim
编辑器
[Unit]
Description=ZLMediaKit
[Service]
Environment="PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin"
ExecStart=/home/media/zlm/MediaServer -c /home/media/zlm/config.ini
StandardOutput=null
[Install]
WantedBy=multi-user.target
# 设置开机启动
systemctl enable zlm
# 启动zlm
systemctl start zlm
# 重启zlm
systemctl restart zlm
# 停止zlm
systemctl stop zlm
# 查看启动状态
systemctl status zlm
## 进入wvp项目
cd ~/wvp-GB28181-pro/
## 复制mysql.sql、update.sql文件到mysql容器
docker cp sql media-mysql-1:/tmp
## 进入mysql容器
docker exec -it media-mysql-1 bash
## 登录数据库
mysql -uroot -p12345678
## 创建wvp数据库
CREATE DATABASE `wvp` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mkdir -p /home/media/wvp
cd ~/wvp-GB28181-pro/
# 复制java包安装目录
cp target/wvp-pro-2.6.6-xxxxx.jar /home/media/wvp/wvp-pro.jar
# 复制配置文件安装目录
cp src/main/resources/all-application.yml /home/media/wvp/application.yml
vim /etc/systemd/system/wvp.service
将以下内容复制到vim
编辑器
[Unit]
Description=wvp
[Service]
Environment="PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin"
ExecStart=/usr/bin/java -jar /home/media/wvp/wvp-pro.jar --spring.config.location=/home/media/wvp/application.yml
StandardOutput=null
[Install]
WantedBy=multi-user.target
# 设置开机启动
systemctl enable wvp
# 启动wvp
systemctl start wvp
# 重启wvp
systemctl restart wvp
# 停止wvp
systemctl stop wvp
# 查看启动状态
systemctl status wvp
git clone https://gitee.com/pan648540858/wvp-pro-assist.git
cd wvp-pro-assist
## assist在编译前需要把配置文件更改好
mvn clean package -DskipTests
mkdir /home/media/assist
cp target/wvp-pro-assist-2.6.8-08261304.jar /home/media/assist/wvp-pro-assist.jar
vim /etc/systemd/system/assist.service
将以下内容复制到vim
编辑器
[Unit]
Description=assist
[Service]
Environment="PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin"
ExecStart=/usr/bin/java -jar /home/media/assist/wvp-pro-assist.jar
StandardOutput=null
[Install]
WantedBy=multi-user.target
# 设置开机启动
systemctl enable assist
# 启动wvp
systemctl start assist
登录地址
http://xxx.xxx.xxx.xxx:18080
用户名/密码:admin/admin
需要远程协助可私信我