本文基于 Centos 7.9, Freeswitch依赖的epel源,必须联网才可以使用。
官方推荐的rpm安装方式:
yum install -y https://files.freeswitch.org/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm epel-release yum install -y freeswitch-config-vanilla freeswitch-lang-en* freeswitch-sounds-en* systemctl enable freeswitch
说明: 上面是通过Freeswitch官方制作的公开yum源进行安装,只是因为跨洋访问速度太慢了,所以才制作私有仓库。
1. 通过海外主机,使用迅雷下载Freeswitch官方制作的yum源的整个目录,
下载完成后把整个文件目录zip打包,设置主机的http服务8080端口,
再使用迅雷把zip包下载到本地,整个过程大概2小时即可完成;
https://files.freeswitch.org/repo/yum/centos-release/7/x86_64/
Freeswitch官方的yum源打包下载地址: 点击这里。
2. 使用SecureCRT自带的 SecureFX 把 Freeswitch-yum-repo.zip 包上传并解压到centos7的目录:
/home/repo/yum/centos-release/7/x86_64/
mkdir -p /home/repo/yum/centos-release/7/x86_64/
yum -y install lrzsz vim unzip zip
unzip -d /home/repo/yum/centos-release/7/x86_64/ Freeswitch-yum-repo.zip
cd /home/repo/yum/centos-release/7/x86_64/
mv fs/* . # 把所有rpm包转移到 x86_64 目录下
3. 安装httpd服务,并把http文档目录设置为 /home/repo/yum/centos-release/ ,参考上一篇文章;
4. 安装createrepo软件包: yum -y install createrepo
创建仓库: createrepo /home/repo/yum/centos-release/7/x86_64/
此时会在 x86_64 目录下生成 repodata 数据;
5. 在目标主机增加Freeswitch仓库文件配置:
vi /etc/yum.repos.d/freeswitch.repo
[freeswitch] name=freeswitch baseurl=http://192.168.88.118/7/x86_64/ enabled=1 gpgcheck=0
6. 查看yum更新源列表,此时应该可以看到名称为Freeswitch的yum源;
yum repolist
7. 在目标主机安装Freeswitch:
epel 是一个第三方的rpm仓库,扩展了centos默认的yum仓库,参考这篇文章。
【 注意: freeswitch 运行时依赖的第三方库大多都在 epel 仓库中, 而下载 epel 仓库的rpm必须要联网才可以 】
yum install -y epel-release yum install -y freeswitch-config-vanilla freeswitch-lang-en* freeswitch-sounds-en* systemctl enable freeswitch rm -rf /etc/freeswitch/sip_profiles/*ipv6*
编辑全局变量配置文件: vim /etc/freeswitch/vars.xml ,修改 external_rtp_ip 和 external_sip_ip 的值:
<X-PRE-PROCESS cmd="stun-set" data="external_rtp_ip=stun:stun.freeswitch.org"/> <X-PRE-PROCESS cmd="stun-set" data="external_sip_ip=stun:stun.freeswitch.org"/> 替换为: <X-PRE-PROCESS cmd="set" data="external_rtp_ip=$${local_ip_v4}" /> <X-PRE-PROCESS cmd="set" data="external_sip_ip=$${local_ip_v4}" /> 具体ip的值,请设置为虚拟机的真实ip值,也可以使用 $${local_ip_v4} 变量。
另外需要关闭 mod_signalwire 模块: vim /etc/freeswitch/autoload_configs/modules.conf.xml
注释掉: <!-- <load module="mod_signalwire"/> -->
最后启动Freeswitch:
/usr/bin/freeswitch -nonat -nosql
启动完毕后,输入 shutdown 即可关闭
8. 设置服务开机自启动和服务设置参考 这篇文章。