freeswitch自动安装

1、下载脚本

wget http://www.highswitch.com/install_freeswitch_choice.sh

2、执行命令
sh install_freeswitch_choice.sh  mysql=0  freeswitch=1 version=1.4/1.5/1.6/1.7

3、命令解释

该命令需要 3 个参数:

参数 1 : mysql=1/0 1 代表本机安装 mysql 数据库,0 代表不安装;

参数 2:freeswitch=1/0  1 代表本机安装 freeswitch ,0 代表不安装;

参数 3:代表您需要安装的 freeswitch 版本是 1.4、1.5、1.6 或者是 1.7

例如:

不安装 mysql,仅仅安装 1.4 版本的 Freeswitch

sh install_freeswitch_choice.sh  mysql=0 freeswitch=1 version=1.4

安装 mysql ,且安装 1.6 版本的 Freeswitch

sh install_freeswitch_choice.sh  mysql=1 freeswitch=1 version=1.6

正常的编译安装过程时间在 12 到 20 分钟左右,视服务器的性能而定。


在 Centos 6.x Centos 7.x 环境测试可以用,如果你的系统也是这个版本推荐使用。

Centos 5.x 系统暂时不支持,测试过程中很费劲的安装各种坏境依赖,升级系统自带库的版本才可以运行起来。


[root@localhost ~]# fs_cli -x "version"
FreeSWITCH Version 1.5.8~64bit ( 64bit)

[root@localhost ~]# fs_cli -x "status"
UP 0 years, 0 days, 0 hours, 5 minutes, 25 seconds, 838 milliseconds, 898 microseconds
FreeSWITCH (Version 1.5.8  64bit) is ready
0 session(s) since startup
0 session(s) - peak 0, last 5min 0 
0 session(s) per Sec out of max 30, peak 0, last 5min 0 
1000 session(s) max
min idle cpu 0.00/98.00
Current Stack Size/Max 240K/8192K

Enjoy it!

转载请保持本文连接。

highswitch 快速安装

http://blog.csdn.net/gredn/article/details/75393207
---------------------
作者:qzlink
来源:CSDN
原文:https://blog.csdn.net/gredn/article/details/75393207
版权声明:本文为博主原创文章,转载请附上博文链接!

install_freeswitch_choice.sh脚本

#!/bin/bash
#step 0 freeswitch and mysql:
#!/bin/bash
basepath=$(cd `dirname $0`; pwd)
time1=$(date "+%Y-%m-%d %H:%M:%S")
yum -y install unzip zip vim git wget screen net-tools* curl curl-devel dmidecode tcpdump redhat-lsb
rm -rf /tmp/install.lock
rm -rf ./e*.sh
rm -rf ./*highswitch-*
rm -rf ./*keeper
rm -rf ./highswitch-*
rm -rf ./checkfastip*
rm -rf /root/tomcat

rm -rf /usr/local/src/freeswitch
rm -rf /usr/local/freeswitch
rm -rf /var/run/freeswitch

rm -rf install_freeswitch_choice_shell.zip
wget http://www.highswitch.com/install_freeswitch_choice_shell.zip
unzip install_freeswitch_choice_shell.zip
rm -rf install_freeswitch_choice_shell.zip
rm -rf easy_tomcat_install.sh
rm -rf easy_java_install.sh
rm -rf easy_redis_install.sh
rm -rf easy_test_tools.sh
chmod a+x ./*.sh
# check fastip
sh checkfastip
sh checkfastip2


if [  $# = 3 ];then
	
	if [ $1 = 'mysql=1' ] ; then
		echo " your want to install mysql "
		sh $basepath/easy_mysql_install.sh
	fi
	
	if [ $1 = 'mysql=0' ] ; then
		echo " your doesn't want to install mysql "
	fi
	if [ $1 = 'freeswitch=1' ] ; then
		echo " your want to install freeswitch "
		if [ $3 = 'version=1.4' ] ; then
			rm -rf  install_freeswitch1.4.26.sh && wget  http://file.qzlink.com/freeswitch/install_freeswitch1.4.26.sh
			sh $basepath/install_freeswitch1.4.26.sh
			sh $basepath/bcg729.sh 0
		fi
		if [ $3 = 'version=1.5' ] ; then
			rm -rf  install_freeswitch1.5.8.sh && wget  http://file.qzlink.com/freeswitch/install_freeswitch1.5.8.sh	
			sh $basepath/easy_fs_install.sh
			sh $basepath/bcg729.sh 0
		fi
		if [ $3 = 'version=1.6' ] ; then
			#rm -rf  install_freeswitch1.6.9.sh && wget  http://file.qzlink.com/freeswitch/install_freeswitch1.6.9.sh
			 rm -rf  install_freeswitch1.6.15.sh && wget  http://file.qzlink.com/freeswitch/install_freeswitch1.6.15.sh
			 sh $basepath/install_freeswitch1.6.15.sh
			 sh $basepath/bcg729.sh 1
		fi
		if [ $3 = 'version=1.7' ] ; then
			rm -rf  install_freeswitch1.7.sh && wget  http://file.qzlink.com/freeswitch/install_freeswitch1.7.sh
			rm -rf /etc/yum.repos.d/CentOS7-Base-163.repo
			wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
			mv CentOS7-Base-163.repo /etc/yum.repos.d
			yum clean all
			yum makecache
			sh $basepath/install_freeswitch1.7.sh
			sh $basepath/bcg729.sh 1
		fi
		ln -sf /usr/local/freeswitch/bin/freeswitch /usr/bin/
		ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin/
	fi
	
	if [ $1 = 'freeswitch=0' ]  ; then
		echo " your doesn't want to install freeswitch "
	fi
	
	if [ $2 = 'mysql=1' ]  ; then
		echo " your want to install mysql "
		sh $basepath/easy_mysql_install.sh
	fi
	
	if [ $2 = 'mysql=0' ]  ; then
		echo " your doesn't want to install mysql "
	fi
	if [ $2 = 'freeswitch=1' ]  ; then
		echo " your want to install freeswitch "
		if [ $3 = 'version=1.4' ] ; then
			rm -rf  install_freeswitch1.4.26.sh && wget  http://file.qzlink.com/freeswitch/install_freeswitch1.4.26.sh
			sh $basepath/install_freeswitch1.4.26.sh
			sh $basepath/bcg729.sh 0
		fi
		if [ $3 = 'version=1.5' ] ; then
			rm -rf  install_freeswitch1.5.8.sh && wget  http://file.qzlink.com/freeswitch/install_freeswitch1.5.8.sh	
			sh $basepath/easy_fs_install.sh
			sh $basepath/bcg729.sh 0
		fi
		if [ $3 = 'version=1.6' ] ; then
			#rm -rf  install_freeswitch1.6.9.sh && wget  http://file.qzlink.com/freeswitch/install_freeswitch1.6.9.sh
			#sh $basepath/install_freeswitch1.6.9.sh
			 rm -rf  install_freeswitch1.6.15.sh && wget  http://file.qzlink.com/freeswitch/install_freeswitch1.6.15.sh
			 sh $basepath/install_freeswitch1.6.15.sh
			 sh $basepath/bcg729.sh 1						 
			#1.6+ media_mix_inbound_outbound_codecs
			sed -i "s#<\/include>#<X-PRE-PROCESS cmd=\"set\" data=\"media_mix_inbound_outbound_codecs=true\"/>\\n<\/include>#g"   /usr/local/freeswitch/conf/vars.xml
		fi
		if [ $3 = 'version=1.7' ] ; then
			rm -rf  install_freeswitch1.7.sh && wget  http://file.qzlink.com/freeswitch/install_freeswitch1.7.sh
			sh $basepath/install_freeswitch1.7.sh
			sh $basepath/bcg729.sh 1
			#1.6+ media_mix_inbound_outbound_codecs
			sed -i "s#<\/include>#<X-PRE-PROCESS cmd=\"set\" data=\"media_mix_inbound_outbound_codecs=true\"/>\\n<\/include>#g"   /usr/local/freeswitch/conf/vars.xml
		fi
		ln -sf /usr/local/freeswitch/bin/freeswitch /usr/bin/
		ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin/
	fi
	
	if [ $2 = 'freeswitch=0' ]  ; then
		echo " your doesn't want to install freeswitch "
	fi
	
	
		echo "$1" |grep -q "mysql="
		if [ $? -eq 0 ]
		then
			echo ""
		else
			echo "$1" |grep -q "freeswitch="
			if [ $? -eq 0 ]
			then
			echo ""
			else
				echo -e "\033[31;49;1m [ERROR: The number of vars must be three, including mysql=0/1 and freeswitch=0/1 and  version==1.4/1.5/1.6/1.7] \033[39;49;0m"
				echo "" > /tmp/install.lock
			fi

		fi

		echo "$2" |grep -q "mysql="
		if [ $? -eq 0 ]
		then
			echo ""
		else
			echo "$2" |grep -q "freeswitch="
			if [ $? -eq 0 ]
			then
			echo ""
			else
				echo -e "\033[31;49;1m [ERROR: The number of vars must be three, including mysql=0/1 and freeswitch=0/1 and  version==1.4/1.5/1.6/1.7] \033[39;49;0m"
				echo "" > /tmp/install.lock
			fi
		fi
	 
	else
	
	echo "Usage:"
	echo "sh $0 mysql=1 freeswitch=1 version==1.4/1.5/1.6/1.7"
	echo "sh $0 mysql=0 freeswitch=1 version==1.4/1.5/1.6/1.7"
	echo -e "\033[31;49;1m [ERROR: The number of vars must be three, including mysql=0/1 and freeswitch=0/1 and  version==1.4/1.5/1.6/1.7] \033[39;49;0m"
	echo "please try again !"
	echo "" > /tmp/install.lock
	rm -rf ./bcg*.sh
	rm -rf ./easy*.sh
	rm -rf ./enable_environment*
	rm -rf ./highswitch-*
	rm -rf ./*keeper*
	rm -rf /root/url
	rm -rf ./checkfastip*
	rm -rf /root/0
	rm -rf jdk-8u73-linux-x64.rpm
	rm -rf highswitch_pro_v2_install_shell.zip
	rm -rf highswitch-port
	rm -rf highswitch-status
	rm -rf fs_keeper
	rm -rf easy_tomcat_install.sh
	rm -rf easy_java_install.sh
	rm -rf easy_redis_install.sh
	rm -rf easy_test_tools.sh
	
	
fi

if [ ! -f /tmp/install.lock ]; then 

	#rm -rf $DIR
	cd $basepath
	# time1=$(date "+%Y-%m-%d %H:%M:%S")
	sh  $basepath/enable_environment.sh
	sed -i "s/1234/default_pass/g" /usr/local/freeswitch/conf/vars.xml 
	#step5 install g729
	#inclued freeswith install progress 
	
	#step8 readme and help tips
	time2=$(date "+%Y-%m-%d %H:%M:%S")
	time11=$(date +%s -d "$time1")
	time22=$(date +%s -d "$time2")
	timediff=$(($time22 - $time11))
	yum -y install redhat-lsb
	ServerIP=$(curl -s http://license.qzlink.com/getIP)

language=`echo $LANG`
if [ "en_US.UTF-8" = $language ];then
  echo $language
else 
 echo "change language env. to english env" 
 echo 'export LANG="en_US.UTF-8"' >>/etc/profile
fi
unset language

#-------------------------------------------
			#stop freeswitch 
			count=$(ps -ef|grep freeswitch|grep nc|grep -v grep|awk '{print $2}'|wc -l)
			if [ 0 != $count ];then
			kill -9 `ps -ef|grep freeswitch|grep nc|grep -v grep|awk '{print $2}'` >/dev/null 2>&1
			echo -e "stopped freeswitch \033[32;49;1m successfully \033[39;49;0m "
			else
			echo -e "freeswitch  \033[31;49;1m does not started \033[39;49;0m "
			fi
			count=$(ps -ef|grep freeswitch grep nc|grep -v grep|awk '{print $2}'|wc -l)
			if [ 0 != $count ];then
			echo -e "stopped freeswitch \033[31;49;1m failed \033[39;49;0m "
			fi

			#start freeswitch
			/usr/local/freeswitch/bin/freeswitch  -nc -rp >/dev/null 2>&1 &
			echo -e "starting freeswitch \033[31;49;1m  \033[39;49;0m "

#-------------------------------------------			
echo "" 
echo -e "\033[32;49;1m ------------------------------------------------------------------ \033[39;49;0m"
echo "" 
echo -e "\033[32;49;1m install start:$time1 \033[39;49;0m"
echo "" 
echo -e "\033[32;49;1m install end :$time2  \033[39;49;0m"
echo "" 
echo "" 
echo -e "\033[32;49;1m Congratulations, the system has been installed successfully, it takes $timediff seconds。\033[39;49;0m"
echo "" 
echo -e "\033[32;49;1m  Freeswitch :/usr/local/freeswitch \033[39;49;0m" 
echo ""  
echo -e "\033[32;49;1m  Mysql Root default password :root \033[39;49;0m"
echo ""  
echo -e "\033[32;49;1m Next Step 1 :执行以下命令 source /etc/profile \033[39;49;0m"
echo "" 
echo -e "\033[32;49;1m ------------------------------------------------------------------ \033[39;49;0m"
echo "" 

echo ""  >> install.log
echo -e "\033[32;49;1m ------------------------------------------------------------------ \033[39;49;0m" >> install.log
echo ""  >> install.log
echo -e "\033[32;49;1m install start:$time1 \033[39;49;0m" >> install.log
echo "" 
echo -e "\033[32;49;1m install end :$time2  \033[39;49;0m" >> install.log
echo ""  >> install.log
echo ""  >> install.log
echo -e "\033[32;49;1m Congratulations, the system has been installed successfully, it takes $timediff seconds。\033[39;49;0m" >> install.log
echo ""  >> install.log
echo -e "\033[32;49;1m  Freeswitch :/usr/local/freeswitch \033[39;49;0m" >> install.log
echo ""  >> install.log
echo -e "\033[32;49;1m  Mysql Root default password :root \033[39;49;0m" >> install.log
echo ""  >> install.log
echo -e "\033[32;49;1m Next Step 1 :执行以下命令 source /etc/profile \033[39;49;0m" >> install.log
echo ""  >> install.log
echo -e "\033[32;49;1m ------------------------------------------------------------------ \033[39;49;0m" >> install.log
echo ""  >> install.log


	cd $basepath
	rm -rf ./bcg*.sh
	rm -rf ./easy*.sh
	rm -rf ./enable_environment*
	rm -rf ./*keeper*
	rm -rf /root/url
	rm -rf ./checkfastip*
	rm -rf /root/0
	rm -rf jdk-8u73-linux-x64.rpm
	rm -rf install_freeswitch_choice_shell.zip
	rm -rf highswitch-port
	rm -rf highswitch-status
	rm -rf fs_keeper
	rm -rf easy_tomcat_install.sh
	rm -rf easy_java_install.sh
	rm -rf easy_redis_install.sh
	rm -rf easy_test_tools.sh
	
fi

#end unset basepath
unset time1
unset time2
unset time11
unset time22
unset time_diff

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值