mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
auto install depends software for ubuntu or centos.
This commit is contained in:
parent
5d50bdc3fc
commit
bb90881489
4 changed files with 178 additions and 8 deletions
|
@ -59,22 +59,28 @@ step 8: play live stream. <br/>
|
||||||
<pre>
|
<pre>
|
||||||
rtmp url: rtmp://demo:1935/live/livestream
|
rtmp url: rtmp://demo:1935/live/livestream
|
||||||
m3u8 url: http://demo:80/live/livestream.m3u8
|
m3u8 url: http://demo:80/live/livestream.m3u8
|
||||||
|
for android: http://demo:80/live/livestream.html
|
||||||
</pre>
|
</pre>
|
||||||
step 9: play live stream auto transcoded<br/>
|
step 9: play live stream auto transcoded<br/>
|
||||||
<pre>
|
<pre>
|
||||||
rtmp url: rtmp://demo:1935/live/livestream_ld
|
rtmp url: rtmp://demo:1935/live/livestream_ld
|
||||||
m3u8 url: http://demo:80/live/livestream_ld.m3u8
|
m3u8 url: http://demo:80/live/livestream_ld.m3u8
|
||||||
|
for android: http://demo:80/live/livestream_ld.html
|
||||||
rtmp url: rtmp://demo:1935/live/livestream_sd
|
rtmp url: rtmp://demo:1935/live/livestream_sd
|
||||||
m3u8 url: http://demo:80/live/livestream_sd.m3u8
|
m3u8 url: http://demo:80/live/livestream_sd.m3u8
|
||||||
|
for android: http://demo:80/live/livestream_sd.html
|
||||||
</pre>
|
</pre>
|
||||||
step 10: play live stream auto forwarded, the hls dir change to /forward<br/>
|
step 10: play live stream auto forwarded, the hls dir change to /forward<br/>
|
||||||
<pre>
|
<pre>
|
||||||
rtmp url: rtmp://demo:19350/live/livestream
|
rtmp url: rtmp://demo:19350/live/livestream
|
||||||
m3u8 url: http://demo:80/forward/live/livestream.m3u8
|
m3u8 url: http://demo:80/forward/live/livestream.m3u8
|
||||||
|
for android: http://demo:80/forward/live/livestream.html
|
||||||
rtmp url: rtmp://demo:19350/live/livestream_ld
|
rtmp url: rtmp://demo:19350/live/livestream_ld
|
||||||
m3u8 url: http://demo:80/forward/live/livestream_ld.m3u8
|
m3u8 url: http://demo:80/forward/live/livestream_ld.m3u8
|
||||||
|
for android: http://demo:80/forward/live/livestream_ld.html
|
||||||
rtmp url: rtmp://demo:19350/live/livestream_sd
|
rtmp url: rtmp://demo:19350/live/livestream_sd
|
||||||
m3u8 url: http://demo:80/forward/live/livestream_sd.m3u8
|
m3u8 url: http://demo:80/forward/live/livestream_sd.m3u8
|
||||||
|
for android: http://demo:80/forward/live/livestream_sd.html
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
### Architecture
|
### Architecture
|
||||||
|
|
|
@ -3,6 +3,150 @@
|
||||||
# TODO: check gcc/g++
|
# TODO: check gcc/g++
|
||||||
echo "check gcc/g++/gdb/make/openssl-devel"
|
echo "check gcc/g++/gdb/make/openssl-devel"
|
||||||
echo "depends tools are ok"
|
echo "depends tools are ok"
|
||||||
|
#####################################################################################
|
||||||
|
# for Ubuntu
|
||||||
|
#####################################################################################
|
||||||
|
function Ubuntu_prepare()
|
||||||
|
{
|
||||||
|
uname -v|grep Ubuntu >/dev/null 2>&1
|
||||||
|
ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Ubuntu detected, install tools if needed"
|
||||||
|
|
||||||
|
apt-cache show libpcre3; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install libpcre3"
|
||||||
|
require_sudoer "sudo apt-get install -y libpcre3"
|
||||||
|
sudo apt-get install -y libpcre3
|
||||||
|
echo "install libpcre3 success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt-cache show libpcre3-dev; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install libpcre3-dev"
|
||||||
|
require_sudoer "sudo apt-get install -y libpcre3-dev"
|
||||||
|
sudo apt-get install -y libpcre3-dev
|
||||||
|
echo "install libpcre3-dev success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt-cache show zlib1g-dev; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install zlib1g-dev"
|
||||||
|
require_sudoer "sudo apt-get install -y zlib1g-dev"
|
||||||
|
sudo apt-get install -y zlib1g-dev
|
||||||
|
echo "install zlib1g-dev success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt-cache show libfreetype6-dev; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install libfreetype6-dev"
|
||||||
|
require_sudoer "sudo apt-get install -y libfreetype6-dev"
|
||||||
|
sudo apt-get install -y libfreetype6-dev
|
||||||
|
echo "install libfreetype6-dev success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt-cache show gcc; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install gcc"
|
||||||
|
require_sudoer "sudo apt-get install -y gcc"
|
||||||
|
sudo apt-get install -y gcc
|
||||||
|
echo "install gcc success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt-cache show g++; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install g++"
|
||||||
|
require_sudoer "sudo apt-get install -y g++"
|
||||||
|
sudo apt-get install -y g++
|
||||||
|
echo "install g++ success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt-cache show make; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install make"
|
||||||
|
require_sudoer "sudo apt-get install -y make"
|
||||||
|
sudo apt-get install -y make
|
||||||
|
echo "install make success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt-cache show autoconf; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install autoconf"
|
||||||
|
require_sudoer "sudo apt-get install -y autoconf"
|
||||||
|
sudo apt-get install -y autoconf
|
||||||
|
echo "install autoconf success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt-cache show libtool; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install libtool"
|
||||||
|
require_sudoer "sudo apt-get install -y libtool"
|
||||||
|
sudo apt-get install -y libtool
|
||||||
|
echo "install libtool success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
apt-cache show libssl-dev; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install libssl-dev"
|
||||||
|
require_sudoer "sudo apt-get install -y libssl-dev"
|
||||||
|
sudo apt-get install -y libssl-dev
|
||||||
|
echo "install libssl-dev success"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
Ubuntu_prepare
|
||||||
|
#####################################################################################
|
||||||
|
# for Centos
|
||||||
|
#####################################################################################
|
||||||
|
function Centos_prepare()
|
||||||
|
{
|
||||||
|
if [[ ! -f /etc/redhat-release ]]; then
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Centos detected, install tools if needed"
|
||||||
|
|
||||||
|
gcc --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install gcc"
|
||||||
|
require_sudoer "sudo yum install -y gcc"
|
||||||
|
sudo yum install -y gcc
|
||||||
|
echo "install gcc success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
g++ --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install gcc-c++"
|
||||||
|
require_sudoer "sudo yum install -y gcc-c++"
|
||||||
|
sudo yum install -y gcc-c++
|
||||||
|
echo "install gcc-c++ success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
make --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install make"
|
||||||
|
require_sudoer "sudo yum install -y make"
|
||||||
|
sudo yum install -y make
|
||||||
|
echo "install make success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
automake --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install automake"
|
||||||
|
require_sudoer "sudo yum install -y automake"
|
||||||
|
sudo yum install -y automake
|
||||||
|
echo "install automake success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
autoconf --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install autoconf"
|
||||||
|
require_sudoer "sudo yum install -y autoconf"
|
||||||
|
sudo yum install -y autoconf
|
||||||
|
echo "install autoconf success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
libtool --help >/dev/null 2>&1; ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "install libtool"
|
||||||
|
require_sudoer "sudo yum install -y libtool"
|
||||||
|
sudo yum install -y libtool
|
||||||
|
echo "install libtool success"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -d /usr/include/openssl ]]; then
|
||||||
|
echo "install openssl-devel"
|
||||||
|
require_sudoer "sudo yum install -y openssl-devel"
|
||||||
|
sudo yum install -y openssl-devel
|
||||||
|
echo "install openssl-devels success"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
Centos_prepare
|
||||||
|
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
# st-1.9
|
# st-1.9
|
||||||
|
@ -48,6 +192,16 @@ fi
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
# nginx for HLS, nginx-1.5.0
|
# nginx for HLS, nginx-1.5.0
|
||||||
#####################################################################################
|
#####################################################################################
|
||||||
|
function write_nginx_html5()
|
||||||
|
{
|
||||||
|
cat<<END >> ${html_file}
|
||||||
|
<video width="640" height="360"
|
||||||
|
autoplay controls autobuffer
|
||||||
|
src="${hls_stream}"
|
||||||
|
type="application/vnd.apple.mpegurl">
|
||||||
|
</video>
|
||||||
|
END
|
||||||
|
}
|
||||||
if [ $SRS_HLS = YES ]; then
|
if [ $SRS_HLS = YES ]; then
|
||||||
if [[ -f ${SRS_OBJS}/nginx/sbin/nginx ]]; then
|
if [[ -f ${SRS_OBJS}/nginx/sbin/nginx ]]; then
|
||||||
echo "nginx-1.5.7 is ok.";
|
echo "nginx-1.5.7 is ok.";
|
||||||
|
@ -72,6 +226,14 @@ if [ $SRS_HLS = YES ]; then
|
||||||
|
|
||||||
# create forward dir
|
# create forward dir
|
||||||
mkdir -p ${SRS_OBJS}/nginx/html/forward
|
mkdir -p ${SRS_OBJS}/nginx/html/forward
|
||||||
|
|
||||||
|
# generate default html pages for android.
|
||||||
|
html_file=${SRS_OBJS}/nginx/html/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5
|
||||||
|
html_file=${SRS_OBJS}/nginx/html/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5
|
||||||
|
html_file=${SRS_OBJS}/nginx/html/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5
|
||||||
|
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream.html && hls_stream=livestream.m3u8 && write_nginx_html5
|
||||||
|
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_ld.html && hls_stream=livestream_ld.m3u8 && write_nginx_html5
|
||||||
|
html_file=${SRS_OBJS}/nginx/html/forward/live/livestream_sd.html && hls_stream=livestream_sd.m3u8 && write_nginx_html5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $SRS_HLS = YES ]; then
|
if [ $SRS_HLS = YES ]; then
|
||||||
|
@ -87,6 +249,7 @@ if [ $SRS_HTTP = YES ]; then
|
||||||
if [[ -f ${SRS_OBJS}/CherryPy-3.2.4/setup.py ]]; then
|
if [[ -f ${SRS_OBJS}/CherryPy-3.2.4/setup.py ]]; then
|
||||||
echo "CherryPy-3.2.4 is ok.";
|
echo "CherryPy-3.2.4 is ok.";
|
||||||
else
|
else
|
||||||
|
require_sudoer "configure --with-http"
|
||||||
echo "install CherryPy-3.2.4";
|
echo "install CherryPy-3.2.4";
|
||||||
(
|
(
|
||||||
sudo rm -rf ${SRS_OBJS}/CherryPy-3.2.4 && cd ${SRS_OBJS} &&
|
sudo rm -rf ${SRS_OBJS}/CherryPy-3.2.4 && cd ${SRS_OBJS} &&
|
||||||
|
|
|
@ -85,9 +85,9 @@ vhost dev {
|
||||||
hls_path ./objs/nginx/html;
|
hls_path ./objs/nginx/html;
|
||||||
hls_fragment 5;
|
hls_fragment 5;
|
||||||
hls_window 30;
|
hls_window 30;
|
||||||
forward 127.0.0.1:19350;
|
#forward 127.0.0.1:19350;
|
||||||
http_hooks {
|
http_hooks {
|
||||||
enabled on;
|
enabled off;
|
||||||
on_connect http://127.0.0.1:8085/api/v1/clients;
|
on_connect http://127.0.0.1:8085/api/v1/clients;
|
||||||
on_close http://127.0.0.1:8085/api/v1/clients;
|
on_close http://127.0.0.1:8085/api/v1/clients;
|
||||||
on_publish http://127.0.0.1:8085/api/v1/streams;
|
on_publish http://127.0.0.1:8085/api/v1/streams;
|
||||||
|
@ -96,7 +96,7 @@ vhost dev {
|
||||||
on_stop http://127.0.0.1:8085/api/v1/sessions;
|
on_stop http://127.0.0.1:8085/api/v1/sessions;
|
||||||
}
|
}
|
||||||
transcode {
|
transcode {
|
||||||
enabled on;
|
enabled off;
|
||||||
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
||||||
engine dev {
|
engine dev {
|
||||||
enabled on;
|
enabled on;
|
||||||
|
|
11
trunk/configure
vendored
11
trunk/configure
vendored
|
@ -15,14 +15,15 @@ BLACK="\\e[0m"
|
||||||
# parse user options.
|
# parse user options.
|
||||||
. auto/options.sh
|
. auto/options.sh
|
||||||
|
|
||||||
# if specifies http, requires sudo to install the CherryPy.
|
function require_sudoer()
|
||||||
if [ $SRS_HTTP = YES ]; then
|
{
|
||||||
sudo echo "" >/dev/null 2>&1
|
sudo echo "" >/dev/null 2>&1
|
||||||
ret=$?; if [[ 0 -ne $ret ]]; then echo
|
|
||||||
"--with-http requires sudoer, ret=$ret";
|
ret=$?; if [[ 0 -ne $ret ]]; then
|
||||||
|
echo "\"$1\" require sudoer failed. ret=$ret";
|
||||||
exit $ret;
|
exit $ret;
|
||||||
fi
|
fi
|
||||||
fi
|
}
|
||||||
|
|
||||||
# clean the exists
|
# clean the exists
|
||||||
if [[ -f Makefile ]]; then
|
if [[ -f Makefile ]]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue