우분투 같은 경우 알아서 명령어 한줄이면 turnserver를 설치 해주지만
centos 같은 경우 dependency부터 해서 설치를 해줘야 합니다.
sudo yum install -y make gcc cc gcc-c++ wget openssl-devel libevent libevent-devel # 의존성 설치
mkdir /root/turn # 설치할 경로 생성
cd /root/turn # 이동
wget https://coturn.net/turnserver/v4.5.1.3/turnserver-4.5.1.3.tar.gz # source파일 다운로드
tar -xvzf 4.5.1.3.tar.gz # 압축해제
cd turnserver-4.5.1.3
./configure --prefix=/usr/local/turnserver # turn 설치 경로 지정
sudo make # cmake 실행
sudo make install
# 환경 변수 세팅
sudo vim ~/.bashrc
# 맨 아래 추가
export turnserver_home=/usr/local/turnserver
export PATH=$PATH:$turnserver_home/bin
# turnserver 세팅 파일 생성
sudo vim /etc/turnserver.conf
아래 내용 복사해서 붙여넣기
# Listener IP address of relay server. Multiple listeners can be specified.
# If no IP(s) specified in the config file or in the command line options,
# then all IPv4 and IPv6 system IPs will be used for listening.
listening-ip=0.0.0.0
# External IP-Address of the TURN server
external-ip=IP_ADDRESS
# TURN listener port for UDP and TCP (Default: 3478).
listening-port=3478
# 443 for TURN over TLS, which can bypass firewalls
tls-listening-port=443
# host domain name.
realm=mycompany.org
# Path to the SSL certificate and private key.
# Certificate file.
cert=/usr/local/etc/turn_server_cert.pem
# Private key file.
pkey=/usr/local/etc/turn_server_pkey.pem
# Lower and upper bounds of the UDP relay endpoints:
# Further ports that are open for communication
min-port=10000
max-port=20000
# This allows TURN credentials to be accounted for a specific user id.
# If you don't have a suitable id, the timestamp alone can be used.
# This option is just turning on secret-based authentication.
# The actual value of the secret is defined by option static-auth-secret,
use-auth-secret
static-auth-secret=<YOUR_SECRET>
# Option to set the log file name.
# By default, the turnserver tries to open a log file in
# /var/log, /var/tmp, /tmp and current directories directories
log-file=/var/log/turnserver.log
# Enable verbose logging
verbose
# Do not allow an TLS/DTLS version of protocol
no-tlsv1
no-tlsv1_1
no-tlsv1_2
실행 법은 2가지 있음. 직정 ip, port 지정해서 실행하거나
turnserver -v -r extranet-ip:port -a -o -c /etc/turnserver.conf
unit을 다음과 같이 생성해서
sudo vim /etc/systemd/system/turnserver.service
#내용
Description=turnserver Service
After=network.target
[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/turnserver -c /etc/turnserver.conf
Restart=on-abort
[Install]
WantedBy=multi-user.target
#실행
sudo systemctl start turnserver
● turnserver.service
Loaded: loaded (/etc/systemd/system/turnserver.service; disabled; vendor preset: disabled)
Active: active (running) since Tue 2022-11-08 01:55:37 UTC; 8s ago
Main PID: 16193 (turnserver)
Tasks: 7 (limit: 4440)
Memory: 12.4M
CPU: 27ms
CGroup: /system.slice/turnserver.service
└─16193 /usr/local/bin/turnserver -c /etc/turnserver.conf