This commit is contained in:
acgist
2023-02-03 11:52:17 +08:00
parent b01bde51eb
commit e116b97be0
5 changed files with 126 additions and 511 deletions

View File

@@ -1,6 +1,17 @@
# 部署
## Yum源
## 整体环境
```
CentOSCentOS Linux release 7.9.2009 (Core)
Java >= 17
Maven >= 3.6.0
gcc/g++ >= 4.9
node version >= v16.0.0
python version >= 3.6 with PIP
```
## 设置Yum源
```
cd /etc/yum.repos.d
@@ -9,11 +20,13 @@ wget /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.
yum makecache
```
## Linux句柄数量
## 优化Linux句柄数量
```
# 配置
vim /etc/security/limits.conf
---
root soft nofile 655350
root hard nofile 655350
* soft nofile 655350
@@ -22,48 +35,82 @@ root hard nofile 655350
* hard nproc 655350
* soft core unlimited
* hard core unlimited
---
# 验证(重新打开窗口有效)
ulimit -a
```
## Linux内核优化
## 优化Linux内核参数
```
# 配置
vim /etc/sysctl.conf
---
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_max_tw_buckets = 8192
net.ipv4.tcp_max_syn_backlog = 8192
---
# 其他
net.core.rmem_max
net.core.rmem_default
net.core.wmem_max
net.core.wmem_default
net.core.somaxconn = 1024
net.core.netdev_max_backlog = 8092
net.ipv4.udp_mem
net.ipv4.udp_rmem
net.ipv4.udp_wmem
net.ipv4.tcp_mem = 78643200 104857600 157286400
net.ipv4.tcp_rmem = 873200 1746400 3492800
net.ipv4.tcp_wmem = 873200 1746400 3492800
# 立即生效
sysctl -p
```
## Git
## 安装Git
```
# 安装
yum install git
# 验证
git --version
```
## 媒体
## 安装GCC/G++
## Java
```
# 安装
yum install centos-release-scl
yum install devtoolset-10-gcc devtoolset-10-gcc-c++
scl enable devtoolset-10 -- bash
安装之前需要卸载旧版,如果旧版已经是`17+`可以忽略安装。
# 配置
vim /etc/profile
---
source /opt/rh/devtoolset-10/enable
---
# 验证
gcc -v
g++ -v
```
## 安装Node
```
# 下载
mkdir -p /data/nodejs
cd /data/nodejs
wget https://nodejs.org/dist/v16.19.0/node-v16.19.0-linux-x64.tar.xz
xz -d node-v16.19.0-linux-x64.tar.xz
tar -xf node-v16.19.0-linux-x64.tar
# 连接
ln -sf /data/nodejs/node-v16.19.0-linux-x64/bin/npm /usr/local/bin/
ln -sf /data/nodejs/node-v16.19.0-linux-x64/bin/node /usr/local/bin/
# 验证
npm -v
node -v
```
## 安装Java
```
# 下载
@@ -71,16 +118,18 @@ mkdir -p /data/java
cd /data/java
wget https://download.java.net/java/GA/jdk17.0.2/dfd4a8d0985749f896bed50d7138ee7f/8/GPL/openjdk-17.0.2_linux-x64_bin.tar.gz
tar -zxvf openjdk-17.0.2_linux-x64_bin.tar.gz
# 环境变量
# 配置
vim ~/.bash_profile
PATH=$PATH:/data/java/jdk-17.0.2/bin
. ~/.bash_profile
ln -sf /data/java/jdk-17.0.2/bin/java /usr/local/bin/java
# 验证
java -version
```
## Maven
## 安装Maven
```
# 下载
@@ -88,35 +137,50 @@ mkdir -p /data/maven
cd /data/maven
wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
tar -zxvf apache-maven-3.8.6-bin.tar.gz
# 环境变量
# 配置
vim ~/.bash_profile
PATH=$PATH:/data/maven/apache-maven-3.8.6/bin
. ~/.bash_profile
# 验证
mvn -version
```
## 信令
## 下载源码
```
# 下载源码
mkdir -p /data/taoyao
cd /data
git clone https://gitee.com/acgist/taoyao.git
cd /data/taoyao/taoyao
git clone https://gitee.com/acgist/taoyao.git --recursive
```
## 安装媒体
```
# 编译代码
cd /data/taoyao/taoyao-media-server
npm install
# 启动媒体
```
## 安装信令
```
# 编译代码
cd /data/taoyao/taoyao-signal-server
mvn clean package -D skipTests
#mvn clean package -D skipTests -P release
# 拷贝脚本
cp taoyao-server/target/taoyao-server-1.0.0/bin/deploy.sh ../
cp taoyao-server/target/taoyao-server-1.0.0/bin/deploy.sh ./
# 配置启动服务
vim /usr/lib/systemd/system/taoyao-signal.service
# 启动服务
vim /usr/lib/systemd/system/taoyao.service
----
[Unit]
Description=桃夭
Description=taoyao signal server
After=network.target
Wants=network.target
@@ -124,7 +188,7 @@ Wants=network.target
User=root
Type=forking
KillMode=process
ExecStart=/data/taoyao/taoyao-server/bin/startup.sh
ExecStart=/data/deploy/taoyao-signal-server/bin/startup.sh
ExecReload=/bin/kill -HUP $MAINPID
ExecStop=/bin/kill -QUIT $MAINPID
Restart=always
@@ -139,24 +203,24 @@ systemctl start taoyao
systemctl enable taoyao
```
## 终端
## 安装终端
## 防火墙
## 配置防火墙
### taoyao-media-server
RTC port for ICE, DTLS, RTP, etc.40000-49999
```
firewall-cmd --zone=public --add-port=8888/tcp --permanent
firewall-cmd --zone=public --add-port=45535-65535/udp --permanent
# 媒体服务数据40000-49999
firewall-cmd --zone=public --add-port=40000-49999/udp --permanent
firewall-cmd --reload
firewall-cmd --list-ports
# 删除端口
firewall-cmd --zone=public --remove-port=8888/udp --permanent
firewall-cmd --zone=public --remove-port=45535-65535/udp --permanent
#firewall-cmd --zone=public --remove-port=8888/udp --permanent
#firewall-cmd --zone=public --remove-port=40000-49999/udp --permanent
```
## 证书
@@ -186,4 +250,4 @@ https://blog.csdn.net/weixin_48638578/article/details/120191152
https://blog.csdn.net/weixin_45565568/article/details/108929438
https://blog.csdn.net/weixin_40425640/article/details/125444018
http://t.zoukankan.com/yjmyzz-p-webrtc-groupcall-using-kurento.html
https://lequ7.com/guan-yu-webrtc-yi-wen-xiang-jie-webrtc-ji-chu.html
https://lequ7.com/guan-yu-webrtc-yi-wen-xiang-jie-webrtc-ji-chu.html