本文作者:DurkBlue

ZLMediaKit在linux X86_64上的部署与启动推荐

DurkBlue03-0920985
ZLMediaKit在linux X86_64上的部署与启动摘要: ...

步骤1:安装yasm



wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz

tar -zxvf yasm-1.3.0.tar.gz

cd yasm-1.3.0

./configure

make && make install

#查看是否安装成功

yasm --version


步骤2:安装gcc



# 首先查看是否已经安装gcc,如果安装且版本>=4.8跳过此步骤

gcc -v

# 安装gcc 

yum isntall gcc

yum -y install gcc-c++



 步骤3:安装ffmpeg



wget http://www.ffmpeg.org/releases/ffmpeg-3.1.tar.gz

tar -zxvf ffmpeg-3.1.tar.gz

 

cd ffmpeg-3.1

./configure --prefix=/usr/local/ffmpeg

make && make install

 

vim /etc/profile

 

#在最后PATH添加环境变量:

export PATH=$PATH:/usr/local/ffmpeg/bin

 

#更新环境

source /etc/profile

 

#查看ffmpeg版本

ffmpeg -version



步骤4:安装cmake


#获取CMake源码包

wget https://github.com/Kitware/CMake/releases/download/v3.20.5/cmake-3.20.5.tar.gz

 

#解压CMake源码包

tar -zxvf cmake-3.20.5.tar.gz

 

#编译安装

cd cmake-3.20.5

./bootstrap && make -j4 && make install

 

#配置环境变量

vim /etc/profile

#文件末尾加上配置 

export CMAKE_HOME=/opt/cmake/cmake-3.20.5/bin

export PATH=$CMAKE_HOME:$PATH

 

#刷新配置

source /etc/profile

 

cmake --version


步骤5:安装openssl



# 服务器安装好后一版自带openssl,但是自带的openssl可能版本和zlmediakit所需的版本不匹配,此处推荐安装openssl 1.1.1K

#查看openssl版本

openssl version -a

#安装openssl

wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz

tar -xvzf openssl-1.1.1k.tar.gz

yum install -y zlib zlib-devel perl-CPAN

cd openssl-1.1.1k

./config shared --openssldir=/usr/local/openssl --prefix=/usr/local/openssl

make && make install

echo "/usr/local/lib64/" >> /etc/ld.so.conf

echo "/usr/local/openssl/lib" >> /etc/ld.so.conf

ldconfig

ln -s /usr/local/openssl/bin/openssl  /usr/local/bin/openssl # 替换系统openssl,非必须

openssl version -a


 步骤6:安装libsrtp



wget https://codeload.github.com/cisco/libsrtp/tar.gz/refs/tags/v2.3.0

tar -xvzf libsrtp-2.3.0.tar.gz

cd libsrtp-2.3.0

./configure --enable-openssl --with-openssl-dir=/usr/local/openssl

make -j8 && make install

 

步骤7:下载zlm源码



#如果没安装git 那么安装

yum install -y git

#国内用户推荐从同步镜像网站gitee下载 

git clone --depth 1 https://gitee.com/xia-chu/ZLMediaKit

cd ZLMediaKit

#千万不要忘记执行这句命令

git submodule update --init

 

#编译

mkdir build

 

cd build

 

cmake .. -DENABLE_WEBRTC=true  -DOPENSSL_ROOT_DIR=/usr/local/openssl                   -DOPENSSL_LIBRARIES=/usr/local/openssl/lib

 

cmake --build . --target MediaServer

 

# 最终输出

[ 96%] Built target test_rtcp_fci

[ 96%] Building CXX object tests/CMakeFiles/test_rtp.dir/test_rtp.cpp.o

[ 97%] Linking CXX executable ../../release/linux/Debug/test_rtp

[ 97%] Built target test_rtp

[ 97%] Building CXX object tests/CMakeFiles/test_wsServer.dir/test_wsServer.cpp.o

[ 97%] Linking CXX executable ../../release/linux/Debug/test_wsServer

[ 97%] Built target test_wsServer

[ 97%] Building CXX object tests/CMakeFiles/test_server.dir/test_server.cpp.o

[ 97%] Linking CXX executable ../../release/linux/Debug/test_server

[ 97%] Built target test_server

[ 98%] Built target jsoncpp

[ 98%] Linking CXX executable ../../release/linux/Debug/MediaServer

[100%] Built target MediaServer



步骤8:配置文件

配置http端口和https端口,并接触ip限制白名单


ZLMediaKit在linux X86_64上的部署与启动 第1张


步骤8:运行


MediaServer -c /data/durkblue/ZLMediaKit/conf/config.ini   # /data/durkblue/ZLMediaKit/conf/config.ini为MediaServer配置文件目录


步骤9:查看是否启动成功


ps -ef | grep MediaServer


常用命令


#热加载配置文件

killall -1 MediaServer

 

#关闭MediaServer

killall -2 MediaServer


访问链接

#ip:ZLMediaKit配置文件中http的port端口

http://ip:端口/webrtc/



此篇文章由DurkBlue发布,转载一下需要注明来处
文章投稿或转载声明

来源:DurkBlue版权归原作者所有,转载请保留出处。本站文章发布于 03-09
温馨提示:文章内容系作者个人观点,不代表DurkBlue博客对其观点赞同或支持。

赞(0)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

阅读
分享