系统版本:CentOS Linux release 7.3.1611 (x64)
(理论上 CentOS 7.x x64 通用)
安装的freeswitch可以实现音视频通话、以及视频录制、直播推流等功能(视频模块的功能较多可以参考一下)。要实现视频录制功能的逻辑需要自己去修改dialplan,这一块我就不说多了,大家可以去看下我另外一个博客( freeswitch之视频录制)
首先需要保证你的计算机能够连上网!!能上网!!要是连不上yum源,那就不太方便了。
废话不多说先帖步骤(中途需要说明的会简单注明一下,如果有不明白的地方,欢迎和我讨论)
准备工作:
sed -i '/SELINUX/s/enforcing/disable/g' /etc/selinux/config
systemctl disable wpa_supplicant.service
systemctl stop wpa_supplicant.service
systemctl disable dbus-org.fedoraproject.FirewallD1.service
systemctl disable dbus-org.freedesktop.NetworkManager.service
systemctl disable dbus-org.freedesktop.nm-dispatcher.service
systemctl disable firewalld.service
systemctl disable irqbalance.service
systemctl disable NetworkManager-dispatcher.service
systemctl disable NetworkManager.service
systemctl disable tuned.service
systemctl stop dbus-org.fedoraproject.FirewallD1.service
systemctl stop dbus-org.freedesktop.NetworkManager.service
systemctl stop dbus-org.freedesktop.nm-dispatcher.service
systemctl stop firewalld.service
systemctl stop irqbalance.service
systemctl stop NetworkManager-dispatcher.service
systemctl stop NetworkManager.service
systemctl stop tuned.service
这些具体就不细说,百度一下就可以知道。目的就是让你后边少遇到麻烦(完事记得重启电脑)
_____________________________需要使用数据库的可以看,不需要的跳过去吧_________________________________________
使用的时候有需要数据库的,可以参考一下这块。没有的就跳过去吧(数据库的话 freeswitch支持ODBC)
yum -y install mariadb mariadb-devel mariadb-server mariadb-libs
覆盖复制 目录 db/conf/my.cnf 到 /etc/my.cnf (可以使用 WinSCP / pscp 之类的)
*** 数据库配置未做优化,实际应用需要优化 ***
systemctl enable mariadb.service
systemctl restart mariadb.service
/usr/bin/mysqladmin -u root password"test123456" 为数据库建立用户及密码。
mysql -u root -ptest123456
mysql 命令:
CREATE DATABASE IF NOT EXISTS live default charset utf8 COLLATE utf8_general_ci;
GRANT ALL PRIVILEGES ON live.* TO live@localhost IDENTIFIED BY 'live-PW' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON live.* TO
[email protected] IDENTIFIED BY 'live-PW' WITH GRANT OPTION;
exit
yum -y install unixODBC unixODBC-devel mysql-connector-odbc
echo "UsageCount =1" >> /etc/odbcinst.ini
echo "Threading =0" >> /etc/odbcinst.ini
/etc/odbc.ini 配置DSN(不同的数据库配置不同 酌情处理)
参考如下:
[live]
Driver = /usr/lib64/libmyodbc5.so
Database = live (你要用的数据库)
Server = localhost (你要连接的数据库的计算机ip——这里是本机)
Username = root (连接数据库的用户)
Password = test123456 (连接数据库的密码)
Port = 6868 (我数据库运行的端口 自己看看自己的是多少)
Threading = 0
OPTION = 67108864
Socket = /var/lib/mysql/mysql.sock
测试ODBC输入:isql live root test123456
出现Connected!,说明ODBC成功连接
___________________________________________________________________________________________
接下来就开始安装freeswitch了
yum -y install git gcc-c++ autoconf automake libtool wget python ncurses-devel zlib-devel libjpeg-devel openssl-devel e2fsprogs-devel \
sqlite-devel libcurl-devel pcre-devel speex-devel ldns-devel libedit-devel vim-common vim-enhanced \
postgresql-devel libsndfile libsndfile-devel libsndfile-utils net-tools psmisc \
minizip minizip-devel unzip zip gzip bzip2-devel bzip2 libzip libzip-devel gdb \
libnotify libnotify-devel libibmad libibmad-devel libxcb-devel alsa-lib-devel libgcrypt-devel \
openssl-devel nasm* lua-devel lua net-snmp net-snmp-devel net-snmp-utils \
libpng-devel openjpeg-devel libtool-ltdl libtool-ltdl-devel flex bison
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig
echo "/usr/local/lib" >> /etc/ld.so.conf
echo "/usr/local/lib64" >> /etc/ld.so.conf
ldconfig
之后安装一些依赖包(源码安装——之后我也会上传到这边:资源包下载地址)
automake
xz -d automake-1.14.tar.xz
tar -xf automake-1.14.tar
cd automake-1.14
./configure --prefix=/usr/local
make
make install
opus
tar -zxf opus-1.1.4.tar.gz
cd opus-1.1.4
./configure --prefix=/usr/local
make
make install
yasm
yasm
tar -zxf yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix=/usr/local
make
make install
x264
tar -jxf last_x264.tar.bz2
cd x264-snapshot-20170329-2245/
./configure --prefix=/usr/local --enable-shared
make
make install
libfdk aac
tar -zxf fdk-aac-0.1.5.tar.gz
cd fdk-aac-0.1.5
export PATH=/usr/bin:$PATH
./autogen.sh
./configure --prefix=/usr/local
make
make install
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
flite
tar -jxf flite-2.0.0-release.tar.bz2
cd flite-2.0.0-release
./configure --prefix=/usr/local --with-pic --with-lang --with-lex
make
make install
openh264
tar -zxf openh264-1.4.0.tar.gz
cd openh264-1.4.0
make
make install
FFmpeg
tar -zxf FFmpeg-n2.6.8.tar.gz
cd FFmpeg-n2.6.8
./configure --prefix=/usr/local --enable-avresample --enable-pic --enable-shared --enable-libopenh264 --enable-libx264 --enable-gpl --enable-libfdk_aac --enable-nonfree --enable-libflite
make
make install
libvpx
tar -zxf libvpx-1.5.0.tar.gz
cd libvpx-1.5.0
./configure --prefix=/usr/local --enable-pic --disable-static --enable-shared
make
make install
libyuv
tar -zxf libyuv.tar.gz
cd libyuv
make -f linux.mk CXXFLAGS="-fPIC -O2 -fomit-frame-pointer -Iinclude/"
make install
libmad
tar -zxf libmad-0.15.1b.tar.gz
cd libmad-0.15.1b
./configure --prefix=/usr/local
sed -i 's/-fforce-mem//g' Makefile
make
make install
vlc
xz -d vlc-2.2.3.tar.xz
tar -xf vlc-2.2.3.tar
cd vlc-2.2.3
./configure --prefix=/usr/local --disable-a52
make
make install
mp4v2
tar -jxf mp4v2-2.0.0.tar.bz2
cd mp4v2-2.0.0
./configure --prefix=/usr/local
make
make install
freeswitch
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig
export PATH=/usr/bin:$PATH
ldconfig
cd /usr/src (FREESWITCH 必须在这个目录编译,不成功没准就是这了)
结果目录为: /usr/src/freeswitch-1.6.8
tar -zxf freeswitch-1.6.8.tar.gz
cd freeswitch-1.6.8
./rebootstrap.sh
./configure --prefix=/opt/fs168 --enable-core-odbc-support --enable-core-pgsql-support --with-openssl --enable-sctp
make
make install
echo "/opt/fs168/lib/freeswitch/mod" >> /etc/ld.so.conf (FREESWITCH安装目录,根据实际修改)
ldconfig
好了 具体的安装步骤就到这了。
之后 我会讲一下freeswitch基础的使用以及相关配置,最后也会简单的说说源码