建议 CentOS7.9 最小安装,不然容易冲突
#!/bin/bash
### 更换 repo
mkdir /root/repo
mv /etc/yum.repos.d/*.repo /root/repo
cat <<"EOF" > /etc/yum.repos.d/ali.repo
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=0
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=0
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
EOF
#!/bin/bash
### 编译工具,开发库等
yum install -y --skip-broken epel-release \
git curl wget autoconf automake bison wget \
curl-devel \
gdbm-devel \
gcc-c++ \
lua-devel \
gnutls-devel \
libcurl-devel \
libjpeg-devel \
libogg-devel \
libtiff-devel \
libtool \
libuuid-devel \
libxml2-devel \
ncurses-devel \
opus-devel \
pcre-devel \
pkgconfig \
portaudio-devel \
postgresql-devel \
python3-devel \
sqlite-devel \
unixODBC-devel \
zlib-devel \
yasm \
nasm \
libedit-devel \
libatomic
cat <<"EOF" > /etc/yum.repos.d/okay.repo
[okay]
name=Extra OKay Packages for Enterprise Linux - $basearch
baseurl=http://repo.okay.com.mx/centos/$releasever/$basearch/release
failovermethod=priority
enabled=1
gpgcheck=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OKAY
[okay-debuginfo]
name=Extra OKay Packages for Enterprise Linux - $basearch - Debug
baseurl=http://repo.okay.com.mx/centos/$releasever/$basearch/debug
failovermethod=priority
enabled=0
#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-OKAY
#gpgcheck=1
EOF
yum install -y openssl11-devel --skip-broken
ln -s /usr/lib64/pkgconfig/openssl11.pc /usr/lib64/pkgconfig/openssl.pc
ln -sf /usr/include/openssl11/openssl /usr/include/openssl
yum install -y cmake3 --skip-broken
ln -s /usr/bin/cmake3 /usr/bin/cmake
yum localinstall -y --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://download1.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-7.noarch.rpm
yum install -y --skip-broken ffmpeg-devel speex-devel speexdsp-devel libshout-devel libmpg123-devel lame-devel libsndfile-devel
#!/bin/bash
### 编译 libks,sofia-sip, spandsp 以及 freeswitch
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib
# libks
git clone https://github.com/signalwire/libks.git /usr/src/libks
cd /usr/src/libks
cmake .
make && make install
# sofia-sip
git clone https://github.com/freeswitch/sofia-sip /usr/src/sofia-sip
cd /usr//src/sofia-sip
./bootstrap.sh
./configure
make && make install
# spandsp
git clone https://github.com/freeswitch/spandsp /usr/src/spandsp
cd /usr/src/spandsp
# https://github.com/signalwire/freeswitch/issues/2248
git checkout 0d2e6ac
./bootstrap.sh
./configure
make && make install
# freeswitch
git clone https://github.com/signalwire/freeswitch.git -b v1.10.12 /usr/src/freeswitch
cd /usr/src/freeswitch
./bootstrap.sh
sed -i '/mod_signalwire/d' modules.conf
sed -i '/mod_enum/d' modules.conf
sed -i '/mod_opus/d' modules.conf
sed -i 's+#formats/mod_shout+formats/mod_shout+g' modules.conf
./configure
make && make install
make cd-sounds-install && make cd-moh-install
echo '/usr/local/lib' >> /etc/ld.so.conf
ldconfig
ln -s /usr/local/freeswitch/bin/freeswitch /usr/bin
ln -s /usr/local/freeswitch/bin/fs_cli /usr/bin
#!/bin/bash
### 编译 mod_unimrcp
### 以下步骤仅供参考
wget https://www.unimrcp.org/project/component-view/unimrcp-deps-1-6-0-tar-gz/download -O /usr/src/unimrcp-deps-1.6.0.tar.gz
cd /usr/src
tar xvzf unimrcp-deps-1.6.0.tar.gz
git clone https://github.com/unispeech/unimrcp.git /usr/src/unimrcp
git clone https://github.com/freeswitch/mod_unimrcp.git /usr/src/mod_unimrcp
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig/:/usr/local/freeswitch/lib/pkgconfig:/usr/local/unimrcp/lib/
cd /usr/src/unimrcp-deps-1.6.0 && cd libs/apr && ./configure --prefix=/usr/local/apr && \
make && make install && cd .. && cd apr-util && ./configure --prefix=/usr/local/apr --with-apr=/usr/local/apr && make && make install
cd /usr/src/unimrcp && ./bootstrap && ./configure && make && make install
cd /usr/src/mod_unimrcp && export PKG_CONFIG_PATH=/usr/local/freeswitch/lib/pkgconfig:/usr/local/unimrcp/lib/pkgconfig && ./bootstrap.sh && ./configure && make && make install
CentOS7.9 确实非常旧,但还是有很多人在使用,不要轻言放弃
还可以进一步优化:
1. sqlite-devel 升级,CentOS7.9 自带的的版本太旧了
2. lua5.1-devel 升级到 lua 5.2
3. 编译 mod_mariadb
4. 编译 mod_opus
等等
这些其实不难,以后如果有机会,我再慢慢补充