[Linux]用Flash Media Server 4.5搭建一个在线点播系统

由于公司内部的培训系统需要整一个视频播放系统。所以,我找时间研究了一下相关的资料。 Flash Media Server 是专门用来处理视频播放的一套服务器软件。比如,我们常见的各种视频播放(土豆、优酷、乐视)等视频网站。还有就是直播系统。比如,现在很多培训公司或者公开课什么的,会搭建一个直播的系统,可以在线直播授课内容。当然,关于FMS的功能还有很多。我就不一一列举。大家自行百度谷歌。


一、下载Flash Media Server 4.5
下载地址:http://www.adobe.com/support/flashmediaserver/downloads_updaters.html
这个链接里面有很多版本,大家自动根据自身系统的要求进行下载。推荐使用4.5.x版本。版本太新会导致系统兼容性较差。 根据我大致了解其对Centos 版本支持最高到5.6。而我当前是Centos 6.3,挑战颇有些大。主要是兼容性上面。要想获得最大的性能和稳定性,推荐使用版本对应支持的系统版本。


二、安装Flash Media Server 4.5
1、安装compat-libcap1库 因为,这个Flash Media Server依赖这个库,所以,要先安装这个库。
复制代码
  1. yum -y install compat-libcap1


2、安装FMS(Flash Media Server简称)
复制代码
  1. tar -zxvf FlashMediaServer4.5_x64.tar.gz
  2. cd FMS_4_5_5_r4013/
  3. ./installFMS

因为我是Centos 6.3 64bit版本,安装的时候会出现:


复制代码
  1. WARNING: Your Linux distribution, RedHat i386_x64  is not supported by this

  2.          Adobe Flash Media Server installer.

  3. Copyright(C) 1993-2012 Adobe Systems Incorporated. All rights reserved.

  4. Adobe Flash Media Server 4.5 for Linux

  5. Adobe Flash Media Server 4.5 will be installed on this machine.

  6. You will be asked a series of questions during the install
  7. process and will be presented with the defaults for these questions.

  8. Support is available at http://www.adobe.com/go/flashmediaserver_en

  9. To install Adobe Flash Media Server now, press ENTER.
  10. To cancel the installation at any time, press Control-C.



就是一句警告提示。告诉你这个FMS版本不支持这个系统版本。这仅仅是警告,依然不影响使用。这时候,敲回车继续安装。 此时会显示一些说明:
复制代码
  1. ADOBE FLASH MEDIA SERVER

  2. End User License Agreement

  3. NOTICE TO USER:  THIS END USER LICENSE AGREEMENT (EEMENTOVERNS INSTALLATION AND USE BY LICENSEES OF THE ADOBE SOFTWARE DESCRIBED HEREIN.  LICENSEE AGREES THAT
  4. THIS AGREEMENT IS LIKE ANY WRITTEN NEGOTIATED AGREEMENT SIGNED BY LICENSEE.  BY CLICKING TO ACKNOWLEDGE AGREEMENT TO BE BOUND DURING REVIEW OF AN ELECTRONIC VERSION OF
  5. THIS LICENSE, OR DOWNLOADING, COPYING, INSTALLING OR USING THE SOFTWARE, LICENSEE ACCEPTS ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.  THIS AGREEMENT IS ENFORCEAB
  6. LE AGAINST ANY PERSON OR ENTITY THAT INSTALLS AND USES THE SOFTWARE AND ANY PERSON OR ENTITY (E.G., SYSTEM INTEGRATOR, CONSULTANT OR CONTRACTOR) THAT INSTALLS OR USES
  7. THE SOFTWARE ON ANOTHER PERSONR ENTITYEHALF. ........





直接按键盘上的Q直接结束这个说明信息。此时出现:
复制代码
  1. Do you agree with the license agreement? (y/n):




这是问我们是否同意以上的声明信息。当然是同意了。输入:y.
复制代码
  1. Please enter your Adobe Flash Media Server 4.5 serial number.


好吧。Flash Media Server 4.5它不是免费的。所以,我们需要一个序列号。 方便大家安装,我提供一个:
复制代码
  1. 1462-5565-3675-7609-8958-9364


输入序列号之后,会问我们要将FMS软件安装在哪个位置。默认位置是:/opt/adobe/fms 我输入的是:/data/fms 这时候会出现:
复制代码
  1. The administrative user name and password you provide here is required to usethe Adobe Flash Media Server Management Console foradministration, monitoring, and debugging.Please enter the administrative username:


这是问我们管理FMS服务器的账号。随便你输入。但是,要记住。比如:admin. 接着要求我们输入密码,我依然是:12345678.密码最少是8位。 紧接着重复输入一次密码。
复制代码
  1. [font=微软雅黑]When the Adobe Flash Media Server service is started, [/font]
  2. [font=微软雅黑]the servicecan be run as a user other than "root". [/font]
  3. [font=微软雅黑]The server would change to this userwhen the server is started and has acquired its ports.[/font]
  4. [font=微软雅黑]Please enter the user that the Adobe Flash Media Server service will run asDefault user [fms]:[/font]





这是问我们:FMS服务将以什么用户微分进行运行。默认就行,输入:fms 如果这个用户不存在,如提示如下:
复制代码
  1. User "fms" does not exist. Do you want to create it?(y/n)


直接输入y,让它帮我们自动创建一个fms的用户。 接着会提示我们,要创建一个用户所归属的组:
复制代码
  1. Please enter a valid user group for the "fms" user.


直接输入fms,自动创建。
复制代码
  1. Please enter a valid user group for the "fms" user.
  2. Default group [fms]:fmsGroup "fms" does not exist!.  
  3. This installer will create one ...User "fms" created and added to group "fms"Do you want to install apache? (y/n)

如果你的服务器没有安装web服务器。如apache或nginx,那么,这个时候你输入y会自动安装apache。因为,我已经安装了nginx,所以,我输入了:n.
复制代码
  1. The Adobe Flash Media Server communicates on the IANA assignedport of 1935,
  2. which is the port most Flash applications expect,and can also communicate on port 80over RTMPT,
  3. HTTP webserver proxy, and for HTTP Dynamic Streaming origin services.Please enter the Adobe Flash Media Server port(s), comma-separatedDefault [1935,80]:

这个时候是提示我们设置FMS服务的端口和web服务所需要的端口。为了避免与我服务器上的nginx 80端口冲突,我把这个80改成了8888。
复制代码
  1. Default [1935,80]: 1935,8888
  2. Please enter the port to use for the Admin service.
  3. You can only specify oneadmin port.Default [1111]:

这是设置管理FMS的服务端口。通过这个端口,我们可以通过FMS提供的flash应用界面登录并管理FMS系统。 直接输入:1111。回车即可。
复制代码
  1. Do you want the Adobe Flash Media Server service to run as adaemon? (y/n)Default [y]:

问我们是否要以守护进程的形式运行。当然是OK了。输入y回车。
复制代码
  1. Do you want to start the Adobe Flash Media Serverafter the installation is done? (y/n)Default [y]:

问我们是否安装完成运行FMS。必须的。输入y回车。 OK。到这一步我们的所有配置都已经完成了。这时候,会提示我们确认配置是否有误。如果有误的话,请输入n重新来一遍。如果不想继续安装下去,输入q退出安装,输入y立即安装。
复制代码
  1. ----------- Install Action Summary -----------

  2. Installation directory         = /data/fms
  3. Adobe Flash Media Server Port        = 1935,8888
  4. Adobe Flash Media Admin Server Port  = 1111
  5. Interface (IP address) FMS will listen on  = auto-detect

  6. Administrative username        = admin
  7. Administrative password        = (suppressed)
  8. service owner                  = fms
  9. service user                   = fms
  10. service group                  = fms
  11. Run as daemon                  = Yes
  12. Start Adobe Flash Media Server       = Yes
  13. Proceed with the installation? (y/n/q):





请根据自己的情况进行选择。如果一切无误,输入y立即安装。 安装过程有些慢,稍等一会。
复制代码
  1. Admin server:fmsadmin command:start

  2. WARNING: Your Linux distribution, RedHat x86_64  is not supported by this

  3.           installer.

  4. Starting Adobe Flash Media Admin Server (please check /var/log/messages)

  5. The Adobe Flash Media Server installation is complete.





如果看到以上信息,恭喜您,说明已经安装成功。




三、认识FMS目录结构。
1、配置文件目录 因为我安装在了/data/fms目录下面。所以,FMS的配置文件全部在/data/fms/conf文件夹下面。
复制代码
  1. drwxr-x--- 3 fms fms  4096 9月   4 22:48 _defaultRoot_
  2. -rw-r----- 1 fms fms  5076 9月   4 22:49 fms.ini
  3. -rw-r----- 1 fms fms 43801 9月   4 22:48 Logger.xml
  4. -rw-r----- 1 fms fms 47364 9月   4 22:48 Server.xml
  5. -rw-r----- 1 fms fms  3301 9月   4 22:50 Users.xml



配置文件有部分信息是我们在安装FMS时输入的一些信息。大家可自行查看。关于fms.ini配置的说明,可以参考互联网相关文章。 2、查看FMS示例视频 @把/data/fms/webroot目录设置一个网站根目录。访问里面的index.html文件,可以看到相关的视频示例。 @如果  ,想通过WEB管理FMS相关的信息。那么该文件夹下面还有一个文件:fms_adminConsole.htm。大家可以自行试试。 @fms_adminConsole.htm 这个页面要求输入的账号密码是我们安装时候配置的。账号是:admin,密码:12345678。 @视频放置的目录是:/data/fms/webroot/vod,这下面有index.html中播放的几个示例视频:


复制代码
  1. -rwxr-xr-x 1 root root      397 9月   4 22:48 hds_sample1_manifest.f4m
  2. -rwxr-xr-x 1 root root      432 9月   4 22:49 hls_sample1_manifest.m3u8
  3. -rwxr-xr-x 1 root root     3093 9月   4 22:49 readme.htm
  4. -rwxr-xr-x 1 root root      473 9月   4 22:48 rtmp_sample1_manifest.f4m
  5. -rwxr-xr-x 1 root root 13733568 9月   4 22:49 sample1_1000kbps.f4v
  6. -rwxr-xr-x 1 root root 19699010 9月   4 22:48 sample1_1500kbps.f4v
  7. -rwxr-xr-x 1 root root  2389780 9月   4 22:48 sample1_150kbps.f4v
  8. -rwxr-xr-x 1 root root  7110864 9月   4 22:48 sample1_500kbps.f4v
  9. -rwxr-xr-x 1 root root  9831197 9月   4 22:48 sample1_700kbps.f4v
  10. -rwxr-xr-x 1 root root 13733568 9月   4 22:48 sample2_1000kbps.f4v



其他的目录我们使用得比较少。想了解更多请自行查看或百度谷歌。 四、启动、停止、卸载FMS 进入/data/fms目录,然后执行:./server --help,会输出相关的使用说明,如下:
复制代码
  1. Usage: ./server {start|stop|restart}

从而得知相关的命令使用方式如下:
复制代码
  1. [color=#333333][font=微软雅黑]// 启动[/font][/color]
  2. [font=微软雅黑]./server start[/font][color=#333333][font=微软雅黑]// 停止[/font][/color]
  3. [font=微软雅黑]./server stop[/font][color=#333333][font=微软雅黑]// 重启[/font][/color]



./server restart 卸载的命令程序在/data/fms/目录下面:uninstallFMS 直接输入: ./uninstallFMS 就会执行卸载,此时会提示我们是否真的要执行卸载操作。
复制代码
  1. Uninstalling Adobe Flash Media Server...
  2. Installation directory to remove:   /data/fms
  3. Server-side source files to remove: /data/fms
  4. All files, including config files, will be deleted!
  5. Proceed with the uninstallation? (y/n):



输入y执行卸载,输入n退出卸载。




五、对外提供视频点播或直播的初始化工作以及相关注意事项(持续更新)
1、开启端口


复制代码
  1. /sbin/iptables -I INPUT -p tcp --dport 1935 -j ACCEPT
  2. /sbin/iptables -I INPUT -p tcp --dport 1111 -j ACCEPT
  3. /etc/init.d/iptables save
  4. service iptables restart



2、视频格式。
并不是所有的视频格式都支持点播的。比如,同样是MP4格式。但是,MP4内部的编码却有多种多样。这个时候,我们可能需要在服务器安装FFMPEG等软件转换视频。

本文大概是前年前写的,经过多次网站改版一直没有发上来。现在补上。希望能到大家。

转自:http://bbs.php100.com/read-htm-tid-513678.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值