centos7部署nginx-http-flv,ffmepg,视频流服务器部署最详细踩坑

------linux 安装nginx http-flv

1 usr/local/新建nginx文件夹
2 sr/local/新建hd文件夹,用来存放下载的所有软件安装包
3 下载yum -y install wget, wget http://nginx.org/download/nginx-1.18.0.tar.gz;
yum -y install git, git clone git://github.com/winshining/nginx-http-flv-module.git
4. 解压nginx, tar -zxvf ×××.tar.gz
5. 安装以下依赖,否则nginx configure报错。
yum install pcre-devel
yum install zlib zlib-devel
yum install openssl openssl-devel

//也可用一条命令代替
yum install pcre-devel zlib zlib-devel openssl openssl-devel

4 yum -y install gcc-c++, ./configure --prefix=/usr/local/nginx --add-module=…/nginx-http-flv-module
5 make && make install

6 xshell传输文件工具 yum -y install lrzsz, windows版的nginx.conf, stat.xsl拖到linux.
7 启动nginx, 进入sbin目录,./nginx
8 安装nginx环境变量—
配置环境变量,编辑/etc/profile 增加如下内容:(等号左右不要加空格)
export NGINX_HOME=/usr/local/nginx; export PATH= P A T H : PATH: PATH:NGINX_HOME/sbin
刷新环境变量 source /etc/profile
验证nginx -v
开启nginx: nginx

------安装ffmpeg

1 wget https://github.com/FFmpeg/FFmpeg/archive/n3.3.5.tar.gz(libavcodec/libx264.c:282:9: 错误:‘x264_bit_depth’未声明(在此函数内第一次使用)),与x264版本冲突,ffmepeg 用4以上最好

用windows打开地址下载
wget https://github.com/FFmpeg/FFmpeg/archive/n4.2.tar.gz
2 解压,升级工具 yum install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel harfbuzz-devel

3 yasm: yum install -y epel-release; yum install yasm
4 安装x264: git clone https://git.videolan.org/git/x264.git;
编译 ./configure --enable-shared --enable-static --disable-asm;
make && make install
5 编译 ffmpeg
./configure --prefix=/usr/local/ffmpeg --enable-shared --enable-swscale --enable-gpl --enable-nonfree --enable-pic --enable-version3 --enable-postproc --enable-pthreads --enable-static --enable-libx264
make && make install

6 profile配置文件中设置环境变量
export PATH="/usr/local/ffmpeg/bin:${PATH}"

7 进入ffmpeg的bin: ldd ffmpeg 查看ffmpeg缺少的依赖
在etc中增加 export LD_LIBRARY_PATH=…/lib/
source /etc/profile

8 复制缺少的libx264.so.164(找x264的安装位置,默认在/usr/locla/lib/下)到ffmpeg下的lib
9 ffmpeg -version

上一篇:开源系统-咖啡壶部署安装


下一篇:lnmp部署-编译安装PHP7.2