Ubuntu 系统下搭建 SRS 流媒体服务器

这个安装 SRS 服务器的过程,笔者是在 root 身份下进行的。
刚安装好的 Ubuntu 系统的 root 身份是没有密码的,没有密码就不能登录,所以首先要先给 root 设置密码:
sudo passwd,键入两次密码设置成功。
然后执行 su root 转换 root 身份。

然后安装 Git:
执行 apt install git

正式安装

  1. 执行 git clone https://github.com/ossrs/srs [该过程很漫长]
  2. 执行 cd srs/trunk
  3. 执行 ./configure && make
  4. 启动服务器则执行 ./objs/srs -c conf/srs.conf

遇到的问题

若在上节步骤 3 中的时候报下面的错误信息

patching file Makefile
cc -I. -DHTTP_PARSER_STRICT=1  -Wall -Wextra -Werror -O0 -g  -c http_parser.c
http_parser.c: In function ‘http_parser_parse_url’:
http_parser.c:2093:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
         found_at = 1;
         ~~~~~~~~~^~~
http_parser.c:2096:7: note: here
       case s_req_server:
       ^~~~
cc1: all warnings being treated as errors
Makefile:40: recipe for target 'http_parser.o' failed
make: *** [http_parser.o] Error 1
build http-parser-2.1 failed, ret=2

该错误将在 SRS3 版本后解决,2 版本则需要开发者自行处理,处理流程在下。

步骤:

  • 执行 cd .. 回到 trunk 目录

  • 执行 cd 3rdparty 进入三方框架目录

  • 执行 mkdir tempcd temp

  • 执行 unzip ../http-parser-2.1.zip

    image

  • 执行 grep -n "FALLT" ./http-parser-2.1/http_parser.c

    image

  • 执行 sed -e s/FALLTROUGH/FALLTHROUGH/ -i ./http-parser-2.1/http_parser.c

  • 执行 grep -n "FALLT" ./http-parser-2.1/http_parser.c

    image

  • 执行 mv ../http-parser-2.1.zip ../http-parser-2.1-orig.zip

  • 执行 zip ../http-parser-2.1.zip http-parser-2.1/*

    image

  • 执行 cd ../.. 回到 trunk 文件夹,此时一定是解决成功的 。

  • 执行 ./configure && make

    image

你可能感兴趣的:(Ubuntu 系统下搭建 SRS 流媒体服务器)