Cài đặt các gói cần thiết:
yum install epel-release -y && yum update -y
yum install git nano httpd mariadb-server php php-common php-pdo php-soap php-xml php-xmlrpc php-mysql php-cli php-imap php-mcrypt mysql-connector-odbc memcached ghostscript libtiff-devel libtiff-tools at -y
Tắt Selinux
sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config
Đặt múi giờ
timedatectl set-timezone Asia/Ho_Chi_Minh
Cấu hình Memcached
nano /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1"
Reboot server để apply các cấu hình.
Tiến hành cài đặt
Freeswitch
rpm -Uvh http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm
yum install freeswitch-config-vanilla freeswitch-sounds* freeswitch-lang* freeswitch-lua freeswitch-xml-cdr -y
Database, không đặt password cho user root
systemctl start mariadb
mysql
From mysql prompt >
CREATE DATABASE freeswitch;
GRANT ALL PRIVILEGES ON freeswitch.* TO fusionpbx@localhost IDENTIFIED BY 'somepassword';
flush privileges;
\q
ODBC
nano /etc/odbc.ini
[freeswitch]
Driver = MySQL
SERVER = 127.0.0.1
PORT = 3306
DATABASE = freeswitch
OPTION = 67108864
Socket = /var/lib/mysql/mysql.sock
threading=0
MaxLongVarcharSize=65536
[fusionpbx]
Driver = MySQL
SERVER = 127.0.0.1
PORT = 3306
DATABASE = fusionpbx
OPTION = 67108864
Socket = /var/lib/mysql/mysql.sock
threading=0
Test odbc driver
odbcinst -s -q
Test odbc connection
isql -v freeswitch fusionpbx somepassword
quit
Tải Fusionpbx
cd /var/www/html
git clone -b 4.2 https://github.com/powerpbx/fusionpbx.git .
Copy conf Directory
mv /etc/freeswitch /etc/freeswitch.orig
mkdir /etc/freeswitch
cp -R /var/www/html/resources/templates/conf/* /etc/freeswitch
Apache config
usermod -a -G apache freeswitch
# Đăt user/group là Freeswitch
sed -i "s/User apache/User freeswitch/" /etc/httpd/conf/httpd.conf
sed -i "s/Group apache/Group daemon/" /etc/httpd/conf/httpd.conf
sed -i ':a;N;$!ba;s/AllowOverride None/AllowOverride All/2' /etc/httpd/conf/httpd.conf
nano /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html/fusionpbx"
Cấp quyền cho thư mục và các file
chown -R freeswitch.daemon /etc/freeswitch /var/lib/freeswitch \
/var/log/freeswitch /usr/share/freeswitch /var/www/html
# Directory permissions to 770 (u=rwx,g=rwx,o='')
find /etc/freeswitch -type d -exec chmod 770 {} \;
find /var/lib/freeswitch -type d -exec chmod 770 {} \;
find /var/log/freeswitch -type d -exec chmod 770 {} \;
find /usr/share/freeswitch -type d -exec chmod 770 {} \;
find /var/www/html -type d -exec chmod 770 {} \;
# File permissions to 664 (u=rw,g=rw,o=r)
find /etc/freeswitch -type f -exec chmod 664 {} \;
find /var/lib/freeswitch -type f -exec chmod 664 {} \;
find /var/log/freeswitch -type f -exec chmod 664 {} \;
find /usr/share/freeswitch -type f -exec chmod 664 {} \;
find /var/www/html -type f -exec chmod 664 {} \;
Systemd config
nano /etc/systemd/system/freeswitch.service
[Unit]
Description=FreeSWITCH
Wants=network-online.target
After=syslog.target network-online.target
After=mariadb.service httpd.service
[Service]
Type=forking
User=freeswitch
ExecStartPre=/usr/bin/mkdir -m 0750 -p /run/freeswitch
ExecStartPre=/usr/bin/chown freeswitch:daemon /run/freeswitch
WorkingDirectory=/run/freeswitch
PIDFile=/run/freeswitch/freeswitch.pid
EnvironmentFile=-/etc/sysconfig/freeswitch
ExecStart=/usr/bin/freeswitch -ncwait -nonat $FREESWITCH_PARAMS
ExecReload=/usr/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
Tạo tệp $ FREESWITCH_PARAMS cho các tham số bổ sung. Nếu freeswitch được cài đặt từ RPM, điều này có thể sẽ tồn tại.
nano /etc/sysconfig/freeswitch
## Type: string
## Default: ""
## Config: ""
## ServiceRestart: freeswitch
#
# if not empty: parameters for freeswitch
#
FREESWITCH_PARAMS=""
Enable services
systemctl daemon-reload
systemctl enable mariadb
systemctl enable httpd
systemctl restart httpd
systemctl enable freeswitch
systemctl enable memcached
systemctl restart freeswitch
Fix fs_cli
If fs_cli
command does not work with freeswitch running change the following config line.
nano /etc/freeswitch/autoload_configs/event_socket.conf.xml
<param name="listen-ip" value="127.0.0.1"/>
systemctl restart freeswitch
Khởi động lại server và truy cập địa chỉ IP của server
Tiến hành cài đặt các thông số:
fusionpbx
fusionpbx
root
Đặt mật khẩu cho mysql
mysql_secure_installation
systemctl restart mariadb
Enable freeswitch database connection
This sets Freeswitch to use mysql instead of sqlite.
nano /etc/freeswitch/autoload_configs/switch.conf.xml
<param name="core-db-dsn" value="freeswitch:fusionpbx:123qwe" />
systemctl restart freeswitch
Configure firewall nếu server có sử dụng firewall
firewall-cmd --permanent --zone=public --add-service={http,https}
firewall-cmd --permanent --zone=public --add-port={5060,5061,5080,5081}/tcp
firewall-cmd --permanent --zone=public --add-port={5060,5061,5080,5081}/udp
firewall-cmd --permanent --zone=public --add-port=16384-32768/udp
firewall-cmd --reload
Video hướng dẫn