Ubuntu 16.04简易安装Nginx-rtmp-module

Ubuntu 16.04简易安装Nginx-rtmp-module

libnginx-mod-rtmp是18.04上自带的,可以通过apt-get install libnginx-mod-rtmp进行安装,在16.04上如果想要安装,直接下载libnginx-mod-rtmp_1.14.0-0+xenial1_amd64.deb安装的话会被告知nginx版本过低,依赖有问题,需要16.04自带的nginx版本是1.10,rtmp需要1.14。而一些其他文章都是需要编译nginxnginx-rtmp-module来实现的安装。而我并不想上来就编译。找到了升级nginx的方法,将nginx升级后即可apt-get install libnginx-mod-rtmp安装libnginx-mod-rtmp了。

升级nginx到1.14

依次运行如下命令:

sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install nginx

来源:https://stackoverflow.com/a/44116781/2193455

安装libnginx-mod-rtmp

tony@pc:~/Downloads$ sudo apt-get install libnginx-mod-rtmp
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  binutils-arm-linux-gnueabihf cpp-5-arm-linux-gnueabihf cpp-arm-linux-gnueabihf gcc-5-arm-linux-gnueabihf-base gcc-5-cross-base libasan2-armhf-cross libatomic1-armhf-cross libc6-armhf-cross libc6-dev-armhf-cross
  libgcc-5-dev-armhf-cross libgcc1-armhf-cross libgomp1-armhf-cross libstdc++6-armhf-cross libubsan0-armhf-cross linux-headers-4.15.0-33 linux-headers-4.15.0-33-generic linux-image-4.15.0-33-generic linux-libc-dev-armhf-cross
  linux-modules-4.15.0-33-generic linux-modules-extra-4.15.0-33-generic
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  libnginx-mod-rtmp
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 142 kB of archives.
After this operation, 371 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/nginx/stable/ubuntu xenial/main amd64 libnginx-mod-rtmp amd64 1.14.0-0+xenial1 [142 kB]
Fetched 142 kB in 23s (6,165 B/s)           
Selecting previously unselected package libnginx-mod-rtmp.
(Reading database ... 363674 files and directories currently installed.)
Preparing to unpack .../libnginx-mod-rtmp_1.14.0-0+xenial1_amd64.deb ...
Unpacking libnginx-mod-rtmp (1.14.0-0+xenial1) ...
Setting up libnginx-mod-rtmp (1.14.0-0+xenial1) ...
Processing triggers for nginx-full (1.14.0-0+xenial1) ...
Triggering nginx reload ...
tony@pc:~/Downloads$ 

这样就成功在Ubuntu 16.04上安装了libnginx-mod-rtmp

测试

打开/etc/nginx/nginx.conf添加如下配置

rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        application live {
            live on;
        }
    }
}

然后先重启

sudo systemctl restart nginx

其他注意事项

如果是在阿里云或者腾讯云上安装,还要在安全组里打开1935端口。
在这里插入图片描述

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

袁保康

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值