安装coturn穿透服务器
系统centos8
安装依赖环境
yum install openssl openssl-libs libevent libevent-devel
下载,编译,安装coturn
git clone https://github.com/coturn/coturn cd coturn ./configure make make install
查看是否安装成功
which turnserver
修改配置文件
cd /usr/local/etc cp turnserver.conf.default turnserver.conf
使用openssl生成自签名证书
openssl req -x509 -newkey rsa:2048 -keyout /etc/turn_server_pkey.pem -out /etc/turn_server_cert.pem -days 99999 -nodes
会让你填一些信息,你改成你自己的
Country Name (2 letter code) [XX]:CN State or Province Name (full name) []:guangdong Locality Name (eg, city) [Default City]:zhuhai Organization Name (eg, company) [Default Company Ltd]:suruozhong Organizational Unit Name (eg, section) []: Common Name (eg, your name or your server's hostname) []:www.xsport.site Email Address []:839293390@qq.com
先查看网卡和ip地址
ip addr
在配置文件底部添加以下配置
vi /usr/local/etc/turnserver.conf
#刚才查询的网卡名称 relay-device=eth0 #内网ip listening-ip=172.18.45.148 listening-port=3478 tls-listening-port=5349 #内网ip relay-ip=172.18.45.148 #外网ip external-ip=120.24.202.* relay-threads=50 lt-cred-mech #证书路径 cert=/etc/turn_server_cert.pem pkey=/etc/turn_server_pkey.pem pidfile=”/var/run/turnserver.pid” min-port=45535 max-port=65535 user=admin:123456 no-cli
启动turnserver
turnserver -o -a -f -user=admin:123456 -r Guangdong
开放端口
tcp 3478
udp 3478
udp 45535/65535