流媒体服务器安装
首先安装需要的依赖包
1 |
yum install -y gcc-c++ pcre-devel zlib-devel make cmake ncurses ncurses-devel |
安装nginx
1 2 3 4 5 6 7 8 9 10 11 12 |
cd ~ mkdir download cd download mkdir source cd source wget http://nginx.org/download/nginx-1.8.0.tar.gz tar zxvf nginx-1.8.0.tar.gz git clone https://github.com/arut/nginx-rtmp-module.git cd nginx-1.8.0 ./configure --user=nginx --group=nginx --add-module=../nginx-rtmp-module --prefix=/usr/local/cellar/nginx --sbin-path=/usr/sbin/nginx --conf-path=/usr/local/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --with-http_ssl_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 mkdir /var/cache/nginx |
把nginx加到服务中
1 |
vi /lib/systemd/system/nginx.service |
将下面内容写入到 nginx.service
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Description=The nginx HTTP and reverse proxy server After=syslog.target network.target remote-fs.target nss-lookup.target [Service] Type=forking PIDFile=/var/run/nginx.pid ExecStartPre=/usr/sbin/nginx -t ExecStart=/usr/sbin/nginx ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target |
使用 service nginx start 即可启动
使用 service nginx stop 即可停止
使用 service nginx restart 即可重新启动
将nginx加入到开机启动项
1 |
systemctl enable nginx |
开启防火墙允许访问80端口
1 |
firewall-cmd --permanent --zone=public --add-port=80/tcp |
重启防火墙
1 |
firewall-cmd --reload |
安装ffmpeg
先去https://www.ffmpeg.org/下载一个最新版本的
需要的依赖包
yasm
wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
x264
wget ftp://ftp.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
fdk-acc
wget http://sourceforge.net/projects/opencore-amr/files/fdk-aac/
ame
wget http://ufpr.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
opus
wget http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz
ogg
wget http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
vorbis
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz
libvpx
wget git clone https://github.com/webmproject/libvpx.git
xvidcore
wget http://downloads.xvid.org/downloads/xvidcore-1.3.4.tar.gz
libtheora
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.gz
yasm
1 2 3 |
tar zxvf yasm-1.3.0.tar.gz cd yasm-1.3.0 ./configure --prefix=/usr/local/cellar/ffmpeg_build --bindir=/usr/bin |
x264
1 2 3 4 5 6 |
tar axf last_x264.tar.bz2 cd last_x264 ./configure \ --prefix=/usr/local/cellar/ffmpeg_build \ --bindir=/usr/bin \ --enable-shared |
fdk-acc
1 2 3 4 |
tar zxvf fdk-aac-0.1.4.tar.gz cd fdk-aac-0.1.4 autoreconf -fiv ./configure --prefix=/usr/local/cellar/ffmpeg_build --disable-shared |
lame
1 2 3 |
tar zxvf lame-3.99.5.tar.gz cd tar zxvf lame-3.99.5 ./configure --prefix=/usr/local/cellar/ffmpeg_build --bindir=/usr/bin --disable-shared --enable-nasm |
opus
1 2 3 4 |
tar zxvf opus-1.1.tar.gz cd opus-1.1 autoreconf -fiv ./configure --prefix=/usr/local/cellar/ffmpeg_build --disable-shared |
ogg
1 2 3 |
tar zxvf libogg- |