视频服务以及通话服务安装
拷贝安装目录
- 当前工作路径为
/home/myworkspace/vserver/server4.0
- 切换到目录
cd /home/myworkspace/vserver/server4.0/trunk
chmod -R 777 /home/myworkspace/vserver/server4.0/trunk
./configure
make && make install
已经安装好 添加自启动服务
sudo ln -sf /usr/local/srs/etc/init.d/srs /etc/init.d/srs
#centos
sudo /sbin/chkconfig --add srs
# 或者 ubuntu
sudo update-rc.d srs defaults
# 查看状态
/etc/init.d/srs status
# 启动
/etc/init.d/srs start
# 停止
/etc/init.d/srs stop
# 重新加载
/etc/init.d/srs reload
端口使用情况
- 修改/usr/local/srs/conf/srs.conf 中的端口
- 11935 rtmp 接口 -> 1935
- 1985 api 端口 -> 1985 (后面用统一 nginx 代理进来)
- 18000 webrtc 端口 -> 8000
- 18080 http 端口 -> 8080 (后面用统一 nginx 代理进来)
# 查看端口是否被占用
lsof -i:port
lsof -i:11935
# 启动成功显示
[root@bogon trunk]# /etc/init.d/srs start
Starting SRS... [ OK ]
SRS started(pid 24219) [ OK ]
启动
- /etc/init.d/srs start
- 日志目录为
/usr/local/srs/objs/srs.log
安装通话相关服务
安装 GO 语言
- GO 默认已经安装到
/home/myworkspace/vserver/go
- 添加 GO_HOME 到 PATH 中
sudo vi /etc/profile
GO_HOME=/home/myworkspace/vserver/go
PATH=$PATH:$ERLANG_HOME/bin:$GO_HOME/bin
source /etc/profile
# 执行返回版本就安装成功了
go version
# 继续第二步安装通信服务
cd /home/myworkspace/vserver/server4.0/trunk/3rdparty/signaling
make
./objs/signaling
# 出现下行说明成功
[trace] 2023/08/17 17:57:34.419488 Signaling ok, root=./www, home page is http://localhost:1989
# 继续第三步安装加密代理服务 需要使用到nginx的证书 证书位于`/usr/local/nginx/cert`
cd /home/myworkspace/vserver/server4.0/trunk/3rdparty/httpx-static
make
sudo ./objs/httpx-static -http 85 -https 11938 -ssk /usr/local/nginx/cert/www.domain.com.cn.key -ssc /usr/local/nginx/cert/www.domain.com.cn.pem -proxy http://127.0.0.1:1989/sig -proxy http://127.0.0.1:1985/rtc -proxy http://127.0.0.1:18080/
# 出现下行说明成功
GoOryx/1.0.18 HTTP/HTTPS static server with API proxy.
# 将三个进程添加到自启动服务中
# 视频服务之前已加入自启动 显示即成功: SRS(pid 24219) is running.
service srs status
# signal
cd /home/myworkspace/vserver/services
sudo ln -sf /home/myworkspace/vserver/services/init.d/video-signal /etc/init.d/video-signal
# 查看状态-status 启动-start 停止-stop
/etc/init.d/video-signal status
lsof -i:1989
# 返回有内容即开启成功
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
signaling 64901 root 3u IPv6 422265214 0t0 TCP *:tr-rsrb-p3 (LISTEN)
# 添加自启动
#centos
sudo /sbin/chkconfig --add video-signal
# 或者 ubuntu
sudo update-rc.d video-signal defaults
# 查看状态
/etc/init.d/video-signal status
# 启动
/etc/init.d/video-signal start
# 停止
/etc/init.d/video-signal stop
# 重新加载
/etc/init.d/video-signal reload
# httpx
sudo ln -sf /home/myworkspace/vserver/services/init.d/video-httpx /etc/init.d/video-httpx
sudo systemctl daemon-reload
# 查看状态-status 启动-start 停止-stop
/etc/init.d/video-httpx status
lsof -i:11938
# 返回有内容即开启成功
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
signaling 36337 root 3u IPv6 415197409 0t0 TCP *:tr-rsrb-p3 (LISTEN)
# 添加自启动
#centos
sudo /sbin/chkconfig --add video-httpx
# 或者 ubuntu
sudo update-rc.d video-httpx defaults
# 查看状态
/etc/init.d/video-httpx status
# 启动
/etc/init.d/video-httpx start
# 停止
/etc/init.d/video-httpx stop
# 重新加载
/etc/init.d/video-httpx reload
# 检查三个进程是否均启动成功
lsof -i:18080
lsof -i:1989
lsof -i:11938
后台管理服务
- 已配置服务 服务名为 smart-camera
- 添加 java 到 PATH 中
- service 原文件在/home/myworkspace/project/smart-camera.service
- JAR 文件位置
/home/myworkspace/project/smart-camera-SNAPSHOT.jar
# 查看当前服务状态
sudo ln -s /home/myworkspace/project/smart-camera.service /lib/systemd/system/smart-camera.service
# 重新加载服务
sudo systemctl daemon-reload
# 检查服务是否存在和实际内容正确
sudo systemctl cat smart-camera.service
# 启动服务
sudo systemctl start smart-camera.service
# 自启动
sudo systemctl enable smart-camera.service
# 查看当前状态
sudo systemctl status smart-camera.service
# wss
location ^~ /smartApi/imserver {
proxy_pass http://127.0.0.1:9999;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_read_timeout 600s;
proxy_send_timeout 600s;
}