一、yum替换
Centos7在2024.7月已停止yum服务,需替换为国内yum
1、先备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
2、替换成yum阿里源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3、清空并重新生产yum缓存
yum clean all
yum makecache
注:可更换为其他国内yum源,自行选择
//腾讯云yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
//华为云yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://repo.huaweicloud.com/repository/conf/CentOS-7-reg.repo
//网易云yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
二、正式开始安装freeswitch
安装freeswitch (亲测建议先把需要yum的全部先yum)
1、升级
yum install -y https://files.freeswitch.org/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm epel-release
yum install -y yum-utils --enablerepo=extras
yum install -y yum-plugin-ovl centos-release-scl rpmdevtools yum-utils git wget vim devtoolset-7-gcc* devtoolset-7 libtiff-devel cmake3 libatomic unixODBC unixODBC-devel.x86_64 postgresql-libs postgresql-devel libpqxx-devel
yum install -y gcc-c++ autoconf automake libtool ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel libxml2-devel libyuv-devel libvpx-devel libvpx2* libdb4* libidn-devel opus-devel unbound-devel libuuid-devel lua-devel libsndfile-devel yasm-devel
注:以下2个yum成功后,后面编译libks和libav时无需重复yum,忽略即可。
yum install libuuid-devel libatomic
yum install -y ffmpeg-devel
2、下载源码
cd /usr/local/src
git clone -b v1.10.8 https://github.com/signalwire/freeswitch
cd /usr/local/src/freeswitch
git clone https://github.com/freeswitch/spandsp.git
git clone https://github.com/freeswitch/sofia-sip.git
3、安装cmake
cd /usr/local/src/freeswitch
wget https://cmake.org/files/v3.14/cmake-3.14.0.tar.gz
tar vzxf cmake-3.14.0.tar.gz
cd cmake-3.14.0
./configure
make
make install
4、编译依赖库
#编译spandsp,注意要用旧版本
cd /usr/local/src/freeswitch/spandsp
git checkout -b finecode20230705 0d2e6ac65e0e8f53d652665a743015a88bf048d4
./bootstrap.sh -j
./configure
make
make install
#编译sofia-sip
cd /usr/local/src/freeswitch/sofia-sip
./bootstrap.sh
./configure
make
make install
#添加库的路径到系统
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:${PKG_CONFIG_PATH}
ldconfig
#编译libks,注意要旧版,直接下载1.8.0版本
cd /usr/local/src/freeswitch
yum install libuuid-devel libatomic
wget https://github.com/signalwire/libks/archive/refs/tags/v1.8.0.tar.gz
tar xvfz v1.8.0.tar.gz
cd libks-1.8.0
cmake .
make
make install
ldconfig
#编译signalwire,注意要旧版本
cd /usr/local/src/freeswitch
wget https://github.com/signalwire/signalwire-c/archive/refs/tags/1.3.0.tar.gz
tar xvfz 1.3.0.tar.gz
cd signalwire-c-1.3.0
cmake .
make
make install
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig:${PKG_CONFIG_PATH}
sudo ldconfig
#编译opus
cd /usr/local/src/freeswitch
yum remove opus
wget https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
tar xvfz opus-1.3.1.tar.gz
cd opus-1.3.1
./configure
make
make install
cp /usr/local/lib/pkgconfig/opus.* /usr/local/lib64/pkgconfig/
#编译libav
cd /usr/local/src/freeswitch
rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
yum install -y ffmpeg-devel
wget -c http://files.freeswitch.org/downloads/libs/libx264.tar.bz2
cd libx264
./configure --enable-static --enable-shared --prefix=/usr
make
make install
sudo cp /usr/lib/pkgconfig/x264.pc /usr/lib64/pkgconfig/
sudo cp /usr/lib/libx264.so /usr/lib64/
sudo cp /usr/lib/libx264.a /usr/lib64/
wget -c http://files.freeswitch.org/downloads/libs/libav-12.tar.bz2
tar -jxvf libav-12.tar.bz2
cd libav
./configure --enable-pic --enable-shared --enable-libx264 --enable-gpl --extra-libs=“-ldl” --extra-cflags=-I/usr/include --extra-ldflags=-L/usr/lib64
make
make install
sudo cp /usr/local/lib/pkgconfig/libavcodec.pc /usr/local/lib/pkgconfig/libavdevice.pc /usr/local/lib/pkgconfig/libavfilter.pc /usr/local/lib/pkgconfig/libavformat.pc /usr/local/lib/pkgconfig/libavresample.pc /usr/local/lib/pkgconfig/libavutil.pc /usr/local/lib/pkgconfig/libswscale.pc /usr/lib64/pkgconfig/
修改module.conf
由于freeswitch支持动态编译和动态加载,一些不需要的模块可以不编译,如:mod_signalwire、mod_av,修改方法:
找到module.conf文件,找到mod_signalwire和mod_av注释掉,修改如下(注意:步骤五中执行完./bootstrap.sh后才会出来):
#applications/mod_signalwire
#applications/mod_av
#endpoints/mod_verto
五、编译freeswitch
cd /usr/local/src//freeswitch
./bootstrap.sh
./configure --enable-portable-binary --prefix=/usr/local/freeswitch --with-gnu-ld --with-python --with-openssl --enable-core-odbc-support --enable-zrtp
(安装至指定目录/usr/local/freeswitch/etc/freeswitch/)
./configure
(安装至默认目录usr/local/freeswitch)
configure二选一,自行选择安装至哪个目录
make
make install
#安装声音文件
make cd-sounds-install
make cd-moh-install
#设置链接符号,便于使用
ln -sf /usr/local/freeswitch/bin/freeswitch /usr/local/bin/
ln -sf /usr/local/freeswitch/bin/fs_cli /usr/local/bin/
六.启动freeswitch
cd /usr/local/freeswitch/bin
./freeswitch -nonat
启动成功如下:
查看freeswitch版本:
version
show codec
标签:1.10,make,devel,Centos7,yum,usr,freeswitch,local From: https://blog.csdn.net/weixin_50642196/article/details/141184409