CentOS7下离线编译ZLMediaKit
系统环境
CentOS版本号
CentOS Linux release 7.9.2009 (Core)
内核版本
Linux localhost.localdomain 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
镜像下载地址
https://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/?spm=a2c6h.25603864.0.0.196df5adF9cHsb
切换到root用户
如果不是root用户进行操作的话,可能会有权限限制问题
su root
安装包准备
在可以联网的电脑上(windows或centos均可),下载ZLMediaKit
1 2 3 4 5 6 7 | git clone --depth 1 https: //gitee.com/xia-chu/ZLMediaKit cd ZLMediaKit #千万不要忘记执行这句命令 git submodule update --init |
之后压缩文件夹ZLMediaKit,作为离线安装的ZLMediaKit包
安装gcc
git_gcc_gcc-c++.zip包内容如下,可参考 https://blog.csdn.net/White_Black007/article/details/81357234 提取
拷贝程序包git_gcc_gcc-c++.zip到服务器
执行以下命令进行安装
1 2 3 4 5 6 7 8 9 10 11 12 13 | #解压缩 unzip git_gcc_gcc-c++.zip cd git_gcc_gcc-c++ #安装 rpm -Uvh *.rpm --nodeps --force #验证 gcc --version |
安装cmake
下载地址 https://cmake.org/files/v3.26/
拷贝文件cmake-3.26.3-linux-x86_64.tar.gz到服务器
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 1 .解压缩包,并将其移动到/opt 目录下 tar -xf cmake- 3.26 . 3 -linux-x86_64.tar.gz mv cmake- 3.26 . 3 -linux-x86_64 /opt/cmake- 3.26 . 3 # 2 .建立软连接 sudo ln -sf /opt/cmake- 3.26 . 3 /bin/* /usr/bin/ # 3 .执行命令查看版本 cmake --version |
安装openssl
下载地址 https://www.openssl.org/source/
拷贝程序包openssl-1.1.1w.tar.gz到服务器
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | #解压缩 tar -zvxf openssl- 1.1 .1w.tar.gz cd openssl- 1.1 .1w #设定OpenSSL安装目录 ./config --prefix=/usr/local/openssl #编译 也可执行make -j4 提高编译速度 make #安装 make install #创建符号链接 sudo ln -s /usr/local/openssl/lib/libcrypto.so. 1.1 /usr/lib64/libcrypto.so. 1.1 sudo ln -s /usr/local/openssl/lib/libssl.so. 1.1 /usr/lib64/libssl.so. 1.1 #执行命令查看版本 openssl version |
注:
执行./config --prefix=usr/local/openssl 时报错
是由于 --prefix 后面必须时绝对路径,已经更改为./config --prefix=/usr/local/openssl,而不是 ./config --prefix=usr/local/openssl
源码编译
拷贝文件ZLMediaKit.zip到服务器
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 解压缩包 unzip ZLMediaKit.zip cd ZLMediaKit mkdir build cd build cmake .. make -j4 |
运行
编译完文件位置 ZLMediaKit/release/linux/Debug/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #增加权限 cd /home/sa/ZLMediaKit/release/linux/Debug/ chmod 777 MediaServer #直接运行 ./MediaServer #或 #以守护进程运行 ./MediaServer -d & |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)