Linux系统上ZLM流媒体服务部署(centos/ubuntu)

文章详细介绍了如何在基于CentOS和Ubuntu的系统上,通过YUM和APT管理工具进行依赖安装,然后编译和构建ZLMediaKit,包括GCC、CMake的更新与安装,以及MediaServer的启动步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

基于centos:

  • 建议删除原有的gcc:yum remove gcc*
  • 更新yum库:yum update -y
  • 安装gcc以及以下操作需要的依赖:yum install gcc gcc-c++ ncurses-devel perl openssl-devel -y
  • 安装cmake:
  • cd /usr/local/
    
    yum install -y wget
    
    wget http://www.cmake.org/files/v3.26/cmake-3.26.4.tar.gz
    
    tar -zxvf cmake-3.26.4.tar.gz
    
    cd cmake-3.26.4
    
    ./bootstrap
    
    gmake
    
    gmake install
    
    sed -i '$a PATH=/usr/local/cmake-3.26.4/bin:$PATH\nexport PATH' /etc/profile
    
    bash /etc/profile
    
    source /etc/profile
  • ZLM下载、构建、编译:

  • yum install -y git libsrtp.i686 libsrtp.x86_64 libsrtp-devel.i686 libsrtp-devel.x86_64 baresip.x86_64 libre.x86_64
    
    git clone --depth 1 https://gitee.com/xia-chu/ZLMediaKit
    
    cd ZLMediaKit
    
    git submodule update --init
    
    mkdir build
    
    cd build 
    
    cmake ..
    
    make -j4
  • 运行:

  • kill -9 `ps aux |grep MediaServer |grep -v grep |grep -v retomcat | awk '{print $2}'`
    
    /usr/local/cmake-3.26.4/ZLMediaKit/release/linux/Debug/MediaServer -d &

 基于ubuntu:

  • 建议先更新库:sudo apt-get update
  • sudo apt-get upgrade -y
  • 删除老包:sudo apt remove gcc g++ cmake
  • 安装依赖:sudo apt install gcc g++ perl libssl-dev make libncurses5-dev libncursesw5-dev -y
  • 安装cmake:
  • cd /usr/local/
    
    sudo wget http://www.cmake.org/files/v3.26/cmake-3.26.4.tar.gz
    
    sudo tar -zxvf cmake-3.26.4.tar.gz
    
    cd cmake-3.26.4
    
    sudo apt-get update
    
    sudo ./bootstrap
    
    sudo make
    
    sudo make install
    
    sudo sed -i '$a PATH=/usr/local/cmake-3.26.4/bin:$PATH\nexport PATH' /etc/profile
    
    sudo bash /etc/profile
  • ZLM下载、构建、编译
  • sudo apt install libsrtp2-dev git -y
    
    sudo git clone --depth 1 https://gitee.com/xia-chu/ZLMediaKit
    
    cd ZLMediaKit
    
    sudo git submodule update --init
    
    sudo mkdir build
    
    cd build
    
    sudo cmake ..
    
    sudo make -j4

  • 运行:
  • sudo kill -9 `ps aux | grep MediaServer | grep -v grep | grep -v retomcat | awk '{print $2}'`
    sudo /usr/local/cmake-3.26.4/ZLMediaKit/release/linux/Debug/MediaServer -d &
    

 运行结果:

  • 2023-07-06 11:40:33.864 D [MediaServer] [8829-MediaServer] System.cpp:122 startDaemon | 启动子进程:8831
    2023-07-06 11:40:33.864 I [MediaServer] [8831-MediaServer] System.cpp:154 systemSetup | core文件大小设置为:18446744073709551615
    2023-07-06 11:40:33.864 I [MediaServer] [8831-MediaServer] System.cpp:163 systemSetup | 文件最大描述符个数设置为:100002
    2023-07-06 11:40:33.864 I [MediaServer] [8831-MediaServer] main.cpp:261 start_main | ZLMediaKit(git hash:6cd9e15/%aI,branch:master,build time:2023-06-26T16:35:33)
    2023-07-06 11:40:33.883 D [MediaServer] [8831-MediaServer] SSLBox.cpp:174 setContext | Add certificate of: default.zlmediakit.com
    2023-07-06 11:40:33.883 D [MediaServer] [8831-stamp thread] util.cpp:366 operator() | Stamp thread started
    2023-07-06 11:40:33.884 I [MediaServer] [8831-MediaServer] EventPoller.cpp:482 EventPollerPool | EventPoller created size: 2
    2023-07-06 11:40:33.884 I [MediaServer] [8831-MediaServer] TcpServer.cpp:213 start_l | TCP server listening on [::]: 554
    2023-07-06 11:40:33.884 I [MediaServer] [8831-MediaServer] TcpServer.cpp:213 start_l | TCP server listening on [::]: 1935
    2023-07-06 11:40:33.884 I [MediaServer] [8831-MediaServer] TcpServer.cpp:213 start_l | TCP server listening on [::]: 80
    2023-07-06 11:40:33.884 I [MediaServer] [8831-MediaServer] TcpServer.cpp:213 start_l | TCP server listening on [::]: 443
    2023-07-06 11:40:33.884 I [MediaServer] [8831-MediaServer] TcpServer.cpp:213 start_l | TCP server listening on [::]: 10000
    2023-07-06 11:40:33.884 I [MediaServer] [8831-MediaServer] UdpServer.cpp:108 start_l | UDP server bind to [::]: 10000
    2023-07-06 11:40:33.885 I [MediaServer] [8831-MediaServer] UdpServer.cpp:108 start_l | UDP server bind to [::]: 9000
    2023-07-06 11:40:33.885 I [MediaServer] [8831-MediaServer] main.cpp:404 start_main | 已启动http api 接口
    2023-07-06 11:40:33.885 I [MediaServer] [8831-MediaServer] main.cpp:406 start_main | 已启动http hook 接口
    

配置文件:

  • cd /usr/local/cmake-3.26.4/ZLMediaKit/release/linux/Debug/
    
    cat config.ini
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值