centos下安装red5


1)安装java6的环境
 这个直接yum就可以了
 
 
 
 
 
 
 
 
 
 
1
 
yum -y install java-1.6.0-openjdk java-1.6.0-openjdk-devel
 
 
2)安装subversion
 为得到合适的版本,里面我用到svn,先安装svn:
 
 
 
 
 
 
 
 
 
 
1
 
yum install svn
 
 
这个看你的发布源中有没有了,我是没有,就用了
 
 
 
 
 
 
 
 
 
 
1
 
yum install subversion
 
 
3)安装ant和ivy,apache的项目
 需要说明的是,yum可以安装ant的,但是安装后用起来总是出问题的,可能是不完整吧!
 还是用下载项目文件的方式进行安装,源文件放在usr的src目录下面:
 
 
 
 
 
 
 
 
 
 
1
 
cd /usr/src
 
 
 
 
 
2
 
wget http://mirrors.isu.net.sa/pub/apache//ant/binaries/apache-ant-1.8.2-bin.tar.bz2
 
 
 
 
 
3
 
tar jxvf apache-ant-1.8.2-bin.tar.bz2
 
 
 
 
 
4
 
mv apache-ant-1.8.2 /usr/local/ant
 
 
 
 
 
5
 
svn co https://svn.apache.org/repos/asf/ant/ivy/core/trunk ivy
 
 
 
 
4)修改环境配置,因为下面要用ant进行编译
 在/etc/profile末尾为Ant 和Java 设置变量
 
 
 
 
 
 
 
 
 
 
1
 
export ANT_HOME=/usr/local/ant
 
 
 
 
 
2
 
export JAVA_HOME=/usr/lib/jvm/java
 
 
 
 
 
3
 
export PATH=$PATH:/usr/local/ant/bin
 
 
 
 
 
4
 
export CLASSPATH=.:$JAVA_HOME/lib/classes.zip
 
 
 
 
 
5
 
保存
 
 
 
 
 
6
 
reboot重启下
 
 
5)进行ivy的jar编译
 
 
 
 
 
 
 
 
 
 
1
 
cd /usr/local/ant/ivy
 
 
 
 
 
2
 
ant jar
 
 
 
 
 
3
 
cp build/artifact/jars/ivy.jar /usr/local/ant/lib/
 
 
6)写环境变量给shell配置,为以后使用ant和java方便
 
 
 
 
 
 
 
 
 
 
1
 
echo "export ANT_HOME=/usr/local/ant" >> /etc/bashrc
 
 
 
 
 
2
 
echo "export JAVA_HOME=/usr/lib/jvm/java" >> /etc/bashrc
 
 
 
 
 
3
 
echo "export PATH=$PATH:/usr/local/ant/bin" >> /etc/bashrc
 
 
7)下载安装red5
 
 
 
 
 
 
 
 
 
 
1
 
cd /usr/src
 
 
 
 
 
2
 
svn checkout http://red5.googlecode.com/svn/java/server/trunk/ red5
 
 
 
 
 
3
 
mv red5 /usr/local/
 
 
 
 
 
4
 
cd /usr/local/red5
 
 
 
 
 
5
 
ant prepare
 
 
 
 
 
6
 
ant dist
 
 
如果最后出现了BUILD SUCCESSFUL ,表示成功
 
8)复制配置文件,并初始化
 
 
 
 
 
 
 
 
 
 
1
 
cp -r dist/conf .
 
 
 
 
 
2
 
./red5.sh
 
 
最后出现了Installer service created ,表示成功 ,按下ctrl+C 中断运行
 
9)配置系统服务
 vi /etc/init.d/red5
 
 
 
 
 
 
 
 
 
 
01
 
#!/bin/sh
 
 
 
 
 
02
 
# For RedHat and cousins:
 
 
 
 
 
03
 
# chkconfig: 2345 85 85
 
 
 
 
 
04
 
# description: Red5 flash streaming server
 
 
 
 
 
05
 
# processname: red5
 
 
 
 
 
06
 
PROG=red5
 
 
 
 
 
07
 
RED5_HOME=/usr/local/red5
 
 
 
 
 
08
 
DAEMON=$RED5_HOME/$PROG.sh
 
 
 
 
 
09
 
PIDFILE=/var/run/$PROG.pid
 
 
 
 
 
10
 
# Source function library
 
 
 
 
 
11
 
. /etc/rc.d/init.d/functions
 
 
 
 
 
12
 
[ -r /etc/sysconfig/red5 ] && . /etc/sysconfig/red5
 
 
 
 
 
13
 
RETVAL=0
 
 
 
 
 
14
 
case “$1″in
 
 
 
 
 
15
 
start)
 
 
 
 
 
16
 
echo -n $”Starting $PROG: ”
 
 
 
 
 
17
 
cd $RED5_HOME
 
 
 
 
 
18
 
$DAEMON >/dev/null 2>/dev/null &
 
 
 
 
 
19
 
RETVAL=$?
 
 
 
 
 
20
 
if [ $RETVAL -eq 0 ]; then
 
 
 
 
 
21
 
echo $! > $PIDFILE
 
 
 
 
 
22
 
touch /var/lock/subsys/$PROG
 
 
 
 
 
23
 
fi
 
 
 
 
 
24
 
[ $RETVAL -eq 0 ] && success $”$PROG startup” || failure $”$PROG startup”
 
 
 
 
 
25
 
echo
 
 
 
 
 
26
 
;;
 
 
 
 
 
27
 
stop)
 
 
 
 
 
28
 
echo -n $”Shutting down $PROG: ”
 
 
 
 
 
29
 
killproc -p $PIDFILE
 
 
 
 
 
30
 
RETVAL=$?
 
 
 
 
 
31
 
echo
 
 
 
 
 
32
 
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$PROG
 
 
 
 
 
33
 
;;
 
 
 
 
 
34
 
restart)
 
 
 
 
 
35
 
$0 stop
 
 
 
 
 
36
 
$0 start
 
 
 
 
 
37
 
;;
 
 
 
 
 
38
 
status)
 
 
 
 
 
39
 
status $PROG -p $PIDFILE
 
 
 
 
 
40
 
RETVAL=$?
 
 
 
 
 
41
 
;;
 
 
 
 
 
42
 
*)
 
 
 
 
 
43
 
echo $”Usage: $0 {start|stop|restart|status}”
 
 
 
 
 
44
 
RETVAL=1
 
 
 
 
 
45
 
esac
 
 
 
 
 
46
 
exit $RETVAL
 
 
或者wget http://www.sohailriaz.com/downloads/red5.txt
 
10)授予运行权限
 
 
 
 
 
 
 
 
 
 
1
 
chmod +x /etc/init.d/red5
 
 
11)服务安装并启动
 
 
 
 
 
 
 
 
 
 
1
 
/sbin/chkconfig –-add red5
 
 
 
 
 
2
 
/sbin/chkconfig red5 on
 
 
 
 
 
3
 
/sbin/service red5 start
 
 
12)检测系统
 
 
 
 
 
 
 
 
 
 
1
 
/etc/init.d/red5 status
 
 
在网页中访问http://IP:5080 能正常打开页面就表示安装配置成功了!
 
13)进一步的问题
 
http://ip:5080/demos/port_tester.html
 
测试网站的端口情况,如果发现都是失败,或许还有问题:
 
 
 
 
 
 
 
 
 
 
01
 
But if you went to port_tester.swf using demos above or your application shows connections FAILS, this is an issue of RTMPT and RTMPTS. You can see it by running
 
 
 
 
 
02
 
/usr/local/red5/red5.sh
 
 
 
 
 
03
 
output trancated
 
 
 
 
 
04
 
[INFO] [main] org.red5.server.tomcat.TomcatLoader – RTMPT server bean was not found
 
 
 
 
 
05
 
[INFO] [main] org.red5.server.tomcat.TomcatLoader – RTMPS server bean was not found
 
 
 
 
 
06
 
output truncated
 
 
 
 
 
07
 
If you see this you have to uncomment the RTMPT and RTMPTS TomcatLoader in/usr/local/red5/conf/red5-core.xml
 
 
 
 
 
08
 
vi /usr/local/red5/conf/red5-core.xml
 
 
 
 
 
09
 
Search for a lines
 
 
 
 
 
10
 
<!– RTMPT –>
 
 
 
 
 
11
 
<!–
 
 
 
 
 
12
 
<bean id=”rtmpt.server” class=”org.red5.server.net.rtmpt.TomcatRTMPTLoader” init-method=”init” lazy-init=”true”>
 
 
 
 
 
13
 
Remove the <!– from start of <bean and –> from end of
 
 
 
 
 
14
 
Same goes for RTMPS
 
 
 
 
 
15
 
<!– RTMPS –>
 
 
 
 
 
16
 
<!–
 
 
 
 
 
17
 
<bean id=”rtmps.server” class=”org.red5.server.net.rtmps.TomcatRTMPSLoader” init-method=”init” lazy-init=”true”>
 
 
 
 
 
18
 
Remove the <!– from start of <bean and –> from end of
 
 
 
 
 
19
 
Restart the red5 services and connection fails problem will be fixed.
 
 
 
 
 
20
 
If you any question please use comments.
 
 
14)设置防火墙
 在/etc/sysconfig/iptables文件中增加以下内容:
 
 
 
 
 
 
 
 
 
 
1
 
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1935 -j ACCEPT -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5080 -j ACCEPT
 
 
重启防火墙
 
 
 
 
 
 
 
 
 
 
1
 
/sbin/service iptables restart
 
 
查看端口是否开放
 
 
 
 
 
 
 
 
 
 
1
 
/sbin/iptables -L -n
 
 
15)进一步测试
 
* 注意Red5中所有Demo需要先安装后才能正常运行
 
下载http://red5.googlecode.com/files/admin.jsp
 上传到red5/webapps/root
 下载http://red5.googlecode.com/files/AdminPlugin-1.0.zip
 解压到red5/plugins
 重启Red5 /etc/init.d/red5 restart
 访问http://www.2cto.com /admin.jsp

摘自 yezi 's blog

相关内容

    暂无相关文章