• janus-gateway安装(docker方式)(centos7)


    • 安装docker和docker compose,参照上一篇博客
    • 安装turn,教程https://www.jianshu.com/p/d65e369f44fb

    • 新建目录
    mkdir /usr/local/etc/janus
    • 上传janus配置文件至/usr/local/etc/janus目录下(参考来源

    设置好的参考配置文件链接: https://pan.baidu.com/s/1rifqq1GVpCm5T_rEwsLJEg?pwd=4j9y 提取码: 4j9y 

    注意:https的SSL证书需提前生成;无域名的情况,证书生成参考教程

    配置文件中需要修改的地方有:

    janus.jcfg:

    1. general: {
    2. configs_folder = "/usr/local/etc/janus" # Configuration files folder
    3. plugins_folder = "/usr/local/lib/janus/plugins" # Plugins folder
    4. transports_folder = "/usr/local/lib/janus/transports" # Transports folder
    5. events_folder = "/usr/local/lib/janus/events" # Event handlers folder
    6. loggers_folder = "/usr/local/lib/janus/loggers" # External loggers folder
    7. }
    8. nat: {
    9. stun_server = "47.104.30.235" #stun服务器外网地址
    10. #stun_port = 3478
    11. nice_debug = false
    12. #full_trickle = true
    13. #ice_nomination = "regular"
    14. #ice_keepalive_conncheck = true
    15. #ice_lite = true
    16. #ice_tcp = true
    17. # By default Janus tries to resolve mDNS (.local) candidates: even
    18. # though this is now done asynchronously and shouldn't keep the API
    19. # busy, even in case mDNS resolution takes a long time to timeout,
    20. # you can choose to drop all .local candidates instead, which is
    21. # helpful in case you know clients will never be in the same private
    22. # network as the one the Janus instance is running from. Notice that
    23. # this will cause ICE to fail if mDNS is the only way to connect!
    24. #ignore_mdns = true
    25. # In case you're deploying Janus on a server which is configured with
    26. # a 1:1 NAT (e.g., Amazon EC2), you might want to also specify the public
    27. # address of the machine using the setting below. This will result in
    28. # all host candidates (which normally have a private IP address) to
    29. # be rewritten with the public address provided in the settings. As
    30. # such, use the option with caution and only if you know what you're doing.
    31. # Make sure you keep ICE Lite disabled, though, as it's not strictly
    32. # speaking a publicly reachable server, and a NAT is still involved.
    33. # If you'd rather keep the private IP address in place, rather than
    34. # replacing it (and so have both of them as advertised candidates),
    35. # then set the 'keep_private_host' property to true.
    36. # Multiple public IP addresses can be specified as a comma separated list
    37. # if the Janus is deployed in a DMZ between two 1-1 NAT for internal and
    38. # external users.
    39. #nat_1_1_mapping = "1.2.3.4"
    40. #keep_private_host = true
    41. # You can configure a TURN server in two different ways: specifying a
    42. # statically configured TURN server, and thus provide the address of the
    43. # TURN server, the transport (udp/tcp/tls) to use, and a set of valid
    44. # credentials to authenticate. Notice that you should NEVER configure
    45. # a TURN server for Janus unless it's really what you want! If you want
    46. # *users* to use TURN, then you need to configure that on the client
    47. # side, and NOT in Janus. The following TURN configuration should ONLY
    48. # be enabled when Janus itself is sitting behind a restrictive firewall
    49. # (e.g., it's part of a service installed on a box in a private home).
    50. turn_server = "47.104.30.235"
    51. turn_port = 3478
    52. turn_type = "udp"
    53. turn_user = "admin"
    54. turn_pwd = "123456"
    55. # You can also make use of the TURN REST API to get info on one or more
    56. # TURN services dynamically. This makes use of the proposed standard of
    57. # such an API (https://tools.ietf.org/html/draft-uberti-behave-turn-rest-00)
    58. # which is currently available in both rfc5766-turn-server and coturn.
    59. # You enable this by specifying the address of your TURN REST API backend,
    60. # the HTTP method to use (GET or POST) and, if required, the API key Janus
    61. # must provide. The timeout can be configured in seconds, with a default of
    62. # 10 seconds and a minimum of 1 second. Notice that the 'opaque_id' provided
    63. # via Janus API will be used as the username for a specific PeerConnection
    64. # by default; if that one is missing, the 'session_id' will be used as the
    65. # username instead.
    66. #turn_rest_api = "http://yourbackend.com/path/to/api"
    67. #turn_rest_api_key = "anyapikeyyoumayhaveset"
    68. #turn_rest_api_method = "GET"
    69. #turn_rest_api_timeout = 10
    70. # In case a TURN server is provided, you can allow applications to force
    71. # Janus to use TURN (https://github.com/meetecho/janus-gateway/pull/2774).
    72. # This is NOT allowed by default: only enable it if you know what you're doing.
    73. #allow_force_relay = true
    74. # You can also choose which interfaces should be explicitly used by the
    75. # gateway for the purpose of ICE candidates gathering, thus excluding
    76. # others that may be available. To do so, use the 'ice_enforce_list'
    77. # setting and pass it a comma-separated list of interfaces or IP addresses
    78. # to enforce. This is especially useful if the server hosting the gateway
    79. # has several interfaces, and you only want a subset to be used. Any of
    80. # the following examples are valid:
    81. # ice_enforce_list = "eth0"
    82. # ice_enforce_list = "eth0,eth1"
    83. # ice_enforce_list = "eth0,192.168."
    84. # ice_enforce_list = "eth0,192.168.0.1"
    85. # By default, no interface is enforced, meaning Janus will try to use them all.
    86. #ice_enforce_list = "eth0"
    87. # In case you don't want to specify specific interfaces to use, but would
    88. # rather tell Janus to use all the available interfaces except some that
    89. # you don't want to involve, you can also choose which interfaces or IP
    90. # addresses should be excluded and ignored by the gateway for the purpose
    91. # of ICE candidates gathering. To do so, use the 'ice_ignore_list' setting
    92. # and pass it a comma-separated list of interfaces or IP addresses to
    93. # ignore. This is especially useful if the server hosting the gateway
    94. # has several interfaces you already know will not be used or will simply
    95. # always slow down ICE (e.g., virtual interfaces created by VMware).
    96. # Partial strings are supported, which means that any of the following
    97. # examples are valid:
    98. # ice_ignore_list = "vmnet8,192.168.0.1,10.0.0.1"
    99. # ice_ignore_list = "vmnet,192.168."
    100. # Just beware that the ICE ignore list is not used if an enforce list
    101. # has been configured. By default, Janus ignores all interfaces whose
    102. # name starts with 'vmnet', to skip VMware interfaces:
    103. ice_ignore_list = "vmnet"
    104. # In case you want to allow Janus to start even if the configured STUN or TURN
    105. # server is unreachable, you can set 'ignore_unreachable_ice_server' to true.
    106. # WARNING: We do not recommend to ignore reachability problems, particularly
    107. # if you run Janus in the cloud. Before enabling this flag, make sure your
    108. # system is correctly configured and Janus starts after the network layer of
    109. # your machine is ready. Note that Linux distributions offer such directives.
    110. # You could use the following directive in systemd: 'After=network-online.target'
    111. # https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before=
    112. #ignore_unreachable_ice_server = true
    113. }

    janus.transport.http.jcfg:

    1. general: {
    2. #events = true # Whether to notify event handlers about transport events (default=true)
    3. json = "indented" # Whether the JSON messages should be indented (default),
    4. # plain (no indentation) or compact (no indentation and no spaces)
    5. base_path = "/janus" # Base path to bind to in the web server (plain HTTP only)
    6. http = true # Whether to enable the plain HTTP interface
    7. port = 8088 # Web server HTTP port
    8. #interface = "eth0" # Whether we should bind this server to a specific interface only
    9. #ip = "192.168.0.1" # Whether we should bind this server to a specific IP address (v4 or v6) only
    10. https = true # Whether to enable HTTPS (default=false)
    11. secure_port = 8089 # Web server HTTPS port, if enabled
    12. #secure_interface = "eth0" # Whether we should bind this server to a specific interface only
    13. #secure_ip = "192.168.0.1" # Whether we should bind this server to a specific IP address (v4 or v6) only
    14. #acl = "127.,192.168.0." # Only allow requests coming from this comma separated list of addresses
    15. #mhd_connection_limit = 1020 # Open connections limit in libmicrohttpd (default=1020)
    16. #mhd_debug = false # Ask libmicrohttpd to write warning and error messages to stderr (default=false)
    17. }
    18. certificates: {
    19. cert_pem = "/usr/cert/server.crt" #ssl证书地址
    20. cert_key = "/usr/cert/server.key" #ssl证书地址
    21. #cert_pwd = "secretpassphrase"
    22. #ciphers = "PFS:-VERS-TLS1.0:-VERS-TLS1.1:-3DES-CBC:-ARCFOUR-128"
    23. }

    janus.transport.websockets.jcfg:

    1. general: {
    2. #events = true # Whether to notify event handlers about transport events (default=true)
    3. json = "indented" # Whether the JSON messages should be indented (default),
    4. # plain (no indentation) or compact (no indentation and no spaces)
    5. #pingpong_trigger = 30 # After how many seconds of idle, a PING should be sent
    6. #pingpong_timeout = 10 # After how many seconds of not getting a PONG, a timeout should be detected
    7. ws = true # Whether to enable the WebSockets API
    8. ws_port = 8188 # WebSockets server port
    9. #ws_interface = "eth0" # Whether we should bind this server to a specific interface only
    10. #ws_ip = "192.168.0.1" # Whether we should bind this server to a specific IP address only
    11. #ws_unix = "/run/ws.sock" # Use WebSocket server over UNIX socket instead of TCP
    12. wss = true # Whether to enable secure WebSockets
    13. wss_port = 8989 # WebSockets server secure port, if enabled
    14. #wss_interface = "eth0" # Whether we should bind this server to a specific interface only
    15. #wss_ip = "192.168.0.1" # Whether we should bind this server to a specific IP address only
    16. #wss_unix = "/run/wss.sock" # Use WebSocket server over UNIX socket instead of TCP
    17. #ws_logging = "err,warn" # libwebsockets debugging level as a comma separated list of things
    18. # to debug, supported values: err, warn, notice, info, debug, parser,
    19. # header, ext, client, latency, user, count (plus 'none' and 'all')
    20. #ws_acl = "127.,192.168.0." # Only allow requests coming from this comma separated list of addresses
    21. }
    22. certificates: {
    23. cert_pem = "/usr/cert/server.crt"
    24. cert_key = "/usr/cert/server.key"
    25. #cert_pwd = "secretpassphrase"
    26. #ciphers = "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256"
    27. }

    其他文件配置根据实际需要配置

    • 上传docker-compose.yaml至/usr/local/下

    配置好的参考文件链接: 链接:https://pan.baidu.com/s/1jTjI11oq2vIX9s9aNi3ypA?pwd=lv1m 
    提取码:lv1m 
     

     注意:外面配置的所有的文件路径需要做映射,包括SSL证书路径

    1. version: '3.8'
    2. services:
    3. #
    4. # janus-gateway
    5. #
    6. janus-gateway:
    7. image: 'canyan/janus-gateway:latest'
    8. command: ["/usr/local/bin/janus", "-F", "/usr/local/etc/janus"]
    9. container_name: janus
    10. ports:
    11. - "8088:8088"
    12. - "8089:8089"
    13. - "8889:8889"
    14. - "8000:8000"
    15. - "7088:7088"
    16. - "7089:7089"
    17. - "8188:8188"
    18. - "8989:8989"
    19. volumes:
    20. - "./etc/janus/janus.jcfg:/usr/local/etc/janus/janus.jcfg"
    21. - "./etc/janus/janus.eventhandler.sampleevh.jcfg:/usr/local/etc/janus/janus.eventhandler.sampleevh.jcfg"
    22. - "./etc/janus/janus.transport.http.jcfg:/usr/local/etc/janus/janus.transport.http.jcfg"
    23. - "./etc/janus/janus.eventhandler.gelfevh.jcfg:/usr/local/etc/janus/janus.eventhandler.gelfevh.jcfg"
    24. - "./etc/janus/janus.eventhandler.mqttevh.jcfg:/usr/local/etc/janus/janus.eventhandler.mqttevh.jcfg"
    25. - "./etc/janus/janus.eventhandler.nanomsgevh.jcfg:/usr/local/etc/janus/janus.eventhandler.nanomsgevh.jcfg"
    26. - "./etc/janus/janus.eventhandler.rabbitmqevh.jcfg:/usr/local/etc/janus/janus.eventhandler.rabbitmqevh.jcfg"
    27. - "./etc/janus/janus.eventhandler.wsevh.jcfg:/usr/local/etc/janus/janus.eventhandler.wsevh.jcfg"
    28. - "./etc/janus/janus.logger.jsonlog.jcfg:/usr/local/etc/janus/janus.logger.jsonlog.jcfg"
    29. - "./etc/janus/janus.plugin.audiobridge.jcfg:/usr/local/etc/janus/janus.plugin.audiobridge.jcfg"
    30. - "./etc/janus/janus.plugin.duktape.jcfg:/usr/local/etc/janus/janus.plugin.duktape.jcfg"
    31. - "./etc/janus/janus.plugin.echotest.jcfg:/usr/local/etc/janus/janus.plugin.echotest.jcfg"
    32. - "./etc/janus/janus.plugin.lua.jcfg:/usr/local/etc/janus/janus.plugin.lua.jcfg"
    33. - "./etc/janus/janus.plugin.nosip.jcfg:/usr/local/etc/janus/janus.plugin.nosip.jcfg"
    34. - "./etc/janus/janus.plugin.recordplay.jcfg:/usr/local/etc/janus/janus.plugin.recordplay.jcfg"
    35. - "./etc/janus/janus.plugin.sip.jcfg:/usr/local/etc/janus/janus.plugin.sip.jcfg"
    36. - "./etc/janus/janus.plugin.streaming.jcfg:/usr/local/etc/janus/janus.plugin.streaming.jcfg"
    37. - "./etc/janus/janus.plugin.textroom.jcfg:/usr/local/etc/janus/janus.plugin.textroom.jcfg"
    38. - "./etc/janus/janus.plugin.videocall.jcfg:/usr/local/etc/janus/janus.plugin.videocall.jcfg"
    39. - "./etc/janus/janus.plugin.videoroom.jcfg:/usr/local/etc/janus/janus.plugin.videoroom.jcfg"
    40. - "./etc/janus/janus.plugin.voicemail.jcfg:/usr/local/etc/janus/janus.plugin.voicemail.jcfg"
    41. - "./etc/janus/janus.transport.mqtt.jcfg:/usr/local/etc/janus/janus.transport.mqtt.jcfg"
    42. - "./etc/janus/janus.transport.nanomsg.jcfg:/usr/local/etc/janus/janus.transport.nanomsg.jcfg"
    43. - "./etc/janus/janus.transport.pfunix.jcfg:/usr/local/etc/janus/janus.transport.pfunix.jcfg"
    44. - "./etc/janus/janus.transport.rabbitmq.jcfg:/usr/local/etc/janus/janus.transport.rabbitmq.jcfg"
    45. - "./etc/janus/janus.transport.websockets.jcfg:/usr/local/etc/janus/janus.transport.websockets.jcfg"
    46. - "/usr/cert/server.crt:/usr/cert/server.crt"
    47. - "/usr/cert/server.key:/usr/cert/server.key"
    48. restart: always
    • 开放相关的外网端口,包括trun(udp-3478,30000-60000)的。
    • 进入/usr/local/目录,启动镜像

    1. cd /usr/local/
    2. docker-compose up -d
    1. 2、安装与常用命令
    2. rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
    3. yum install -y nginx
    4. sudo systemctl start nginx
    5. sudo systemctl enable nginx
    6. systemctl restart nginx
    7. 3open() “/usr/local/var/run/nginx.pid” failed (13: Permission denied)
    8. sudo chmod -R 777 /usr/local/var/run
    • 上传janus网站到服务器

    链接:https://pan.baidu.com/s/1ZtsJS2ZUO1GcwtPNVhMiQw?pwd=hdui 
    提取码:hdui 
     

    参考原文:janus快速搭建docker版本centos7.9_weixin_37849325的博客-CSDN博客_docker安装janus

  • 相关阅读:
    Sunwing.ca requests下单 请求参数介绍
    练[红明谷CTF 2021]write_shell
    我给大家免费公开五份阿里Java架构师学习手册助力金九银十
    ERROR LINK2019 无法解析的外部符号的常见错因
    SG-Former实战:使用SG-Former实现图像分类任务(一)
    聊聊那些年遇到过的奇葩代码
    元素居中大合集
    注意力(Attention)
    全面认识RPA,细述RPA的前世今生
    transient关键字使用说明
  • 原文地址:https://blog.csdn.net/q651742112/article/details/128091672