详细过程请参考:https://github.com/meetecho/janus-gateway
yum install -y epel-release libmicrohttpd-devel jansson-devel \
openssl-devel libsrtp-devel sofia-sip-devel glib2-devel \
opus-devel libogg-devel libcurl-devel pkgconfig gengetopt \
libconfig-devel libtool autoconf automake libnice-devel \
make gcc gcc-c++ git cmake
git clone https://gitlab.freedesktop.org/libnice/libnice.git
cd libnice
./autogen.sh
./configure --prefix=/usr
make && sudo make install
wget https://github.com/cisco/libsrtp/archive/v1.5.4.tar.gz
tar xfv v1.5.4.tar.gz
cd libsrtp-1.5.4
./configure --prefix=/usr --enable-openssl
make shared_library && sudo make install
wget https://github.com/cisco/libsrtp/archive/v2.2.0.tar.gz
tar xfv v2.2.0.tar.gz
cd libsrtp-2.2.0
./configure --prefix=/usr --enable-openssl
make shared_library && sudo make install
git clone https://github.com/sctplab/usrsctp
cd usrsctp
./bootstrap
./configure --prefix=/usr && make && sudo make install
git clone https://github.com/warmcat/libwebsockets.git
cd libwebsockets
#If you want the stable version of libwebsockets, uncomment the next line
#git checkout v2.4-stable
mkdir build
cd build
#See https://github.com/meetecho/janus-gateway/issues/732 re: LWS_MAX_SMP
cmake -DLWS_MAX_SMP=1 -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_C_FLAGS="-fpic" ..
make && sudo make install
git clone https://github.com/alanxz/rabbitmq-c
cd rabbitmq-c
git submodule init
git submodule update
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make && sudo make install
git clone https://github.com/eclipse/paho.mqtt.c.git
cd paho.mqtt.c
make && sudo make install
sudo yum install libevent libevent-devel openssl openssl-libs -y
wget https://sourceforge.net/projects/levent/files/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz/download
mv download libevent-2.0.22-stable.tar.gz
tar zxvf libevent-2.0.22-stable.tar.gz
cd libevent-2.0.22-stable
./configure
make
sudo make install
cd ..
wget http://coturn.net/turnserver/v4.5.0.7/turnserver-4.5.0.7.tar.gz
tar zxvf turnserver-4.5.0.7.tar.gz
cd turnserver-4.5.0.7
./configure
make install
vim /etc/tuned/tuned-main.conf
添加一下内容
relay-device=eth0
listening-ip=192.168.1.100 #LocalIP
listening-port=3478
tls-listening-port=5349
relay-ip=192.168.1.100 #LocalIP
external-ip=112.112.x.x #NetIP
relay-threads=50
lt-cred-mech
cert=/etc/ssl/cert/domain/cert.pem
pkey=/etc/ssl/cert/domain/key.pem
user=user:password123 #配置一个用户名密码
min-port=3480
max-port=3500
realm=domain.com #所用的域名
git clone https://github.com/meetecho/janus-gateway.git
cd janus-gateway
sh autogen.sh
./configure --prefix=/opt/janus
make
make install
make configs
请记住,仅执行一次此操作,否则后续操作make configs将覆盖您在此期间可能已修改的任何配置文件。如果您已经安装了上述库,但是对数据通道,WebSocket,MQTT和/或RabbitMQ不感兴趣,则可以在配置时禁用它们:
./configure --disable-websockets --disable-data-channels --disable-rabbitmq --disable-mqtt
如果可以使用Doxygen和graphviz,则该过程还可以为您构建文档。默认情况下,编译过程不会尝试构建文档,因此,如果您更喜欢构建文档,请使用
./configure --enable-docs
yum install nginx
添加配置内容如下:vim /etc/nginx/conf.d/default.conf
server {
listen 80; #监听80端口
listen *:443 ssl;
server_name localhost; #定义使用www.xx.com访问
#charset koi8-r; #字符编码
#access_log /var/log/nginx/log/host.access.log main; #设定本虚拟主机的访问日志
location / { #默认请求
root /opt/janus/share/janus/demos; #定义服务器的默认网站根目录位置
index index.html index.htm index.php; #定义首页索引文件的名称
}
#error_page 404 /404.html; #定义错误提示页面
# redirect server error pages to the static page /50x.html #重定向服务器错误页面
#
error_page 500 502 503 504 /50x.html; #定义错误提示页面
location = /50x.html {
root /usr/share/nginx/html;
}
#ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate /opt/janus/share/janus/certs/mycert.pem;
#ssl_certificate_key /etc/nginx/ssl/nginx.key;
ssl_certificate_key /opt/janus/share/janus/certs/mycert.key;
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 #代理服务器的PHP脚本到Apache侦听127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#通过PHP脚本到127.0.0.1:9000的FastCGI服务器监听
#
#location ~ \.php$ {
# root /wwwdata/html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
修改后启动Nginx
nginx -s reload
systemctl start nginx