centos6安装ZLMediaKit
ZLMediaKit的作者是使用Ubuntu 16开发的,但是如果要跑到测试甚至于生产上必须要部署到centos上,笔者主要是使用centos6 (centos7除了下面rpm包外,编译组件操作一致),因为有需求就装完给大家分享一下。
1.安装基础编译环境
1.1 gcc-5.4的安装
注意:centos6默认gcc的版本是gcc-4.4,此时需要升级到gcc-5.4,网络上说的升级到gcc-4.7以上以支持c11是错误的,实测gcc-4.8无法成功cmake出相关基础配置框架
wget http://mirrors.nju.edu.cn/gnu/gcc/gcc-5.4.0/gcc-5.4.0.tar.gztar -zxvf gcc-5.4.0.tar.gzcd gcc-5.4.0./contrib/download_prerequisitescd ..mkdir gcc-build-5.4.0cd gcc-build-5.4.0../gcc-5.4.0/configure --enable-checking=release --enable-languages=c,c++ --disable-multilibmake && make install
(我的虚拟机是双核处理器2.5G内存,需要1个小时,早知多配置几个核心。。。等死了)
gcc -v 此时系统gcc会自动变成gcc-5.4版本
1.2 cmake-3.10安装
暂时没有测试cmake3其他版本是否能安装,目前使用的3.10与作者版本一致
tar -zxvf cmake-3.10.0-rc4.tar.gzcd cmake-3.10.0 ./bootstrapgmake && gmake installyum remove cmakeln -s /usr/local/bin/cmake /usr/bin/cmakeln -s /usr/local/bin/cpack /usr/bin/cpackln -s /usr/local/bin/ctest /usr/bin/ctest#或者是写环境变量export PATH=$PATH:/usr/local/bin#配置进/etc/profile之后source也可以
验证:
# cmake --versioncmake version 3.10.0-rc4
2.编译ZLMediaKit
2.1下载代码
git clone --depth=1 https://github.com/xiongziliang/ZLMediaKit.gitcd ZLMediaKitgit submodule initgit submodule update
2.2 安装依赖性
yum install mysql-devel.x86_64 openssl-devel ffmpeg ffmpeg-devel
另外三个rpm包也需要安装,链接如下:
libx264-devel(https://pkgs.org/download/libx264)wget http://pkgrepo.linuxtech.net/el6/release/x86_64/libx264-devel-0.130-0.20130531.1.el6.x86_64.rpmlibfaac-devel (https://pkgs.org/download/libfaac)wget http://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus/x86_64/RPMS.classic//libfaac-devel-1.28-alt2.x86_64.rpmlibmp4v2-dev(https://pkgs.org/download/libmp4v2)wget https://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/l/libmp4v2-1.5.0.1-10.el6.x86_64.rpm
2.3 编译
# mkdir linux_build# ln -s linux_build/ build# cd build# cmake ..-- The C compiler identification is GNU 5.4.0...-- Configuring done-- Generating done-- Build files have been written to: /usr/local/src/install_pack/ZLMediaKit/build# make
编译好可执行的文件在ZLMediaKit/git/ZLMediaKit/build/bin下面
3.运行编译好的ZLMediaKit
cd ZLMediaKit/git/ZLMediaKit/build./bin/MediaServer# netstat -antlp | grep ./MediaServertcp 0 0 0.0.0.0:555 0.0.0.0:* LISTEN 26771/./MediaServer tcp 0 0 0.0.0.0:1936 0.0.0.0:* LISTEN 26771/./MediaServer tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 26771/./MediaServer tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 26771/./MediaServer tcp 0 0 0.0.0.0:322 0.0.0.0:* LISTEN 26771/./MediaServer tcp 0 0 0.0.0.0:9000 0.0.0.0:* LISTEN 26771/./MediaServer
新闻热点
疑难解答