原创Centos配置turn服务器
Posted SimenLiang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了原创Centos配置turn服务器相关的知识,希望对你有一定的参考价值。
使用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
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服务器的主要内容,如果未能解决你的问题,请参考以下文章
如何在 CentOS 系统中安装和配置 nginx 服务? 原创