1. 程式人生 > >【原創】Centos配置turn服務器

【原創】Centos配置turn服務器

cal wget -a hup def database var kill 多個

使用ssh工具,進行命令行,安裝下面的就是可以配置turn-server(coturn)

1.安裝centos必須的庫文件

yum install -y make gcc cc gcc-c++ wget yum install -y openssl-devel libevent libevent-devel mysql-devel mysql-server 2. 下載並安裝 LibEvent modules wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz tar zxvf libevent-2.0.21-stable.tar.gz cd libevent-2.0.21-stable && ./configure sudo make && sudo make install && cd .. 3.下載並安裝 TURN modules
另外具體版面可以到: http://turnserver.open-sys.org/downloads/ 查看 wget http://turnserver.open-sys.org/downloads/v4.4.5.2/turnserver-4.4.5.2.tar.gz tar -zxvf turnserver-4.4.5.2.tar.gz cd turnserver-4.4.5.2 && ./configure sudo make && sudo make install 安裝成功後出現: ================================================================== 1) If you system supports automatic start-up system daemon services, the, to enable the turnserver as an automatically started system service, you have to: a) Create and edit /etc/turnserver.conf or /usr/local/etc/turnserver.conf . Use /usr/local/etc/turnserver.conf.default as an example. b) For user accounts settings: set up SQLite or PostgreSQL or MySQL or MongoDB or Redis database for user accounts. Use /usr/local/share/turnserver/schema.sql as SQL database schema, or use /usr/local/share/turnserver/schema.userdb.redis as Redis database schema description and/or /usr/local/share/turnserver/schema.stats.redis as Redis status & statistics database schema description. If you are using SQLite, the default database location is in /var/db/turndb or in /usr/local/var/db/turndb or in /var/lib/turn/turndb. c) add whatever is necessary to enable start-up daemon for the /usr/local/bin/turnserver. 2) If you do not want the turnserver to be a system service, then you can start/stop it "manually", using the "turnserver" executable with appropriate options (see the documentation). 3) To create database schema, use schema in file /usr/local/share/turnserver/schema.sql. 4) For additional information, run: $ man turnserver $ man turnadmin $ man turnutils ================================================================== 4.配置“turnserver.conf” file
cp /usr/local/etc/turnserver.conf.default /etc/turnserver.conf vi /etc/turnserver.conf #監聽端口可以不設置會默認的使用3478
listening-port=3478
#listening-ip,註意必須是你的內網IP地址如(如果你是阿裏雲的,就是私網地址):
listening-ip=172.xx.xx.xx
#relay-ip可以不設置,默認會使用你的外網ip地址作為轉發包的中繼地址,建議不設置,使用默認就可以:
#external-ip,註意必須使用你的外網IP地址如:
external-ip=xxx.xxx.xxx.xxx
#設置用戶名及密碼,這個是作為TURN服務器使用必須設置的,可以設置多個,我這裏配置2個
user=user:simon user=user:simon2 5.允許 turn server
nohup turnserver -v -r 外網地址:3478 -a -o -c /etc/turnserver.conf > /dev/null & turnserver -v -r 外網地址:3478 -a -o -c /etc/turnserver.conf 6.停止turn sever cat /var/run/turnserver.pid or /var/tmp/turnserver.pid 12345 kill 12345

【原創】Centos配置turn服務器