FreeSwitch源码安装记录
- 系统环境
CentOS7.5.1804 64位 (虚拟机)
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# more /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
- FreeSwitch版本
1.8.2 (2018.11.15当前最新稳定版)
- 工具安装
安装服务器OS时,要进入最小安装模式,选择几项开发环境库。方便后续安装。
安装基本命令工具,比如 locate、ifconfig。
$> yum install mlocate
$>yum install autoconf automake gcc gcc-c++ git-core libtool make which
- 库安装
4.1、说明:
1、编译源码前先安装依赖库文件。
- 安装完重启操作系统。
- 如果在make阶段发现缺依赖库,安装依赖库后仍然不能通过make,需要重新configure。
- 通常安装依赖库仍然不能编译有以下几种方法:
4.1、检查安装后是否有相关库文件、头文件、pc文件。(详见附录①②)也可能是安装的库版本低。要留意观察错误提示 ≥ 还是 = 某某版本。
4.2、重新configure 再make clean; make
4.3、重启操作系统。重新 configure 再 make clean; make
5、搜索库
有时候提示缺libxxx-dev,但是需要安装的包名不一定就是 libxxx-dev。可以上网搜索错误提示,或者yum install *xxx-dev*。附录⑤
6、有一个来自网络上的库列表。见附录④
4.2、安装方法:
以下所提到的库,都需要安装。不同系统可能会缺其他库,可依以下三种方法补全。
4.2.1、yum安装
yum install ldns-devel
yum install libedit-devel
yum install openssl-devel
yum install libtiff-devel
yum install sndfile-devel libsndfile-devel
4.2.2、源码安装
yasm:(汇编编译器)
$>git clone https://github.com/yasm/yasm.git
$>cd ysam
$>./autogen.sh
$>./configure
$>make && make install
opus(据说要1.1以上版本,安装完需重启系统。)
$>git clone https://freeswitch.org/stash/scm/sd/opus.git
$>cd opus
$>./autogen.sh
$>./configure
$>make
$>make install
$>cp /usr/local/lib/pkgconfig/opus.pc /usr/lib64/pkgconfig
$>cp /usr/local/lib/libopus.* /usr/lib64/
4.2.3、拷贝安装
整理了编译过程中,所安装过的库。包括include lib64 pc 三种文件。可于此下载:https://pan.baidu.com/s/1JUrOXXLgt2Jh9aAp_Yd5wA。
使用时,可将include_file目录下的文件拷贝到 /usr/include;
将lib64_files 目录下的文件拷贝到 /usr/lib64;
将pc_file 目录下的文件拷贝到 /usr/lib64/pkgconfig。
(直接拷贝建议记录操作过程,方便回退操作。)
- 源码编译安装
本文所述为倒序操作,以免make之苦。
编译过程:
$>tar zxvf freeswitch-1.8.2.tar.gz
$>cd freeswitch-1.8.2
$>./configure
$>make
$>make install
通常是这样编译。进阶技巧见附录③
如果过程中仍然缺库,可按照上一章节的方法继续安装库。make阶段才发现的库,安装后要重新configure。然后make之前先 make clean。
- 附录
- 一般情况安装一个库,会有头文件在 /usr/local/incude 或者 /usr/include 目录;
会有库文件在 /usr/local/lib 或者 /usr/lib64目录;
会有pc文件在 /usr/local/lib/pkgconfig 或者 /usr/lib64/pkgconfig 目录。
- .pc文件是一个文本文件,记录库的版本、路径等信息。可以more 打开查看。不可轻易修改。
- configure可以指定选项,如:
./configure CFLAGS="-I/usr/include/openssl" LDFLAGS="-L/usr/lib64/openssl"
- FreeSwitch依赖库列表,仅供参考。
libyuv-devel libjpeg-devel ncurses-devel unixODBC-devel openssl-devel libogg-devel libvorbis-devel libcurl-devel libtiff-devel libjpeg-devel python-devel expat-devel zlib zlib-devel bzip2 pcre pcre-devel speex-devel sqlite-devel lua-devel opus-devel sndfile-devel libsndfile-devel libvpx-devel
- 推荐使用www.bing.com 国际版