Hướng dẫn cài đặt Asterisk13 Freepbx14 trên centos7

Hướng dẫn kết nối trunk tổng đài FreePBX

Tiếp tục bài viết tìm hiểu tổng đài voip mã nguồn mở hôm nay mình xin chia sẻ bài viết cài đặt tổng đài asertisk13 Freepbx14 trên Centos7

1. Chuẩn bị

Máy ảo vps hoặc VMvare,Virtuabox.

Hệ điều hành: Centos 7

Ram: 512MB-1G

HDD: 10-20G hoặc hơn

2. Cài đặt

2.1 Cập nhập hệ thống.

  • Tắt selinux.
setenforce 0
sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
ln -sf /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime
  • Cập nhập hệ thống đảm bảo các gói update mới nhất.
yum -y update && yum -y groupinstall core && yum -y groupinstall base && yum -y install epel-release && yum -y install automake gcc gcc-c++ ncurses-devel openssl-devel libxml2-devel unixODBC-devel libcurl-devel libogg-devel libvorbis-devel speex-devel spandsp-devel freetds-devel net-snmp-devel iksemel-devel corosynclib-devel newt-devel popt-devel libtool-ltdl-devel lua-devel sqlite-devel radiusclient-ng-devel portaudio-devel libresample-devel neon-devel libical-devel openldap-devel gmime-devel mysql-devel bluez-libs-devel jack-audio-connection-kit-devel gsm-devel libedit-devel libuuid-devel jansson-devel libsrtp-devel git subversion libxslt-devel kernel-devel audiofile-devel gtk2-devel libtiff-devel libtermcap-devel bison php php-mysql php-process php-pear php-mbstring php-xml php-gd tftp-server httpd sox tzdata mysql-connector-odbc mysql-server fail2ban xmlstarlet

 

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

yum remove php*
yum install -y php56w php56w-pdo php56w-mysql php56w-mbstring php56w-pear php56w-process php56w-xml php56w-opcache php56w-ldap php56w-intl php56w-soap

curl -sL https://rpm.nodesource.com/setup_8.x | bash -
yum install -y nodejs

#Khở động mariadb.

systemctl enable mariadb.service
systemctl start mariadb

#Khở động httpd.

systemctl enable httpd.service
systemctl start httpd.service
#Tắt firewall.

systemctl stop firewalld
systemctl mask firewalld

Reboot lại hệ thống

2.2 Cài đặt Asterisk Freepbx

  •  Cài dahdi
cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-2.10.2+2.10.2.tar.gz
tar zxvf dahdi-linux-complete-2.10*
cd /usr/src/dahdi-linux-complete-2.10*/
make all && make install && make config
systemctl restart dahdi
  •  Cài dặt Libpri
cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz
tar xvfz libpri-current.tar.gz
cd /usr/src/libpri-*
make
make install
  •  Cài đặt PJSIP
cd /usr/src
wget http://www.pjsip.org/release/2.5.5/pjproject-2.5.5.tar.bz2
tar -xjvf pjproject-2.5*
cd /usr/src/pjproject-2.5*/
make distclean
./configure --prefix=/usr --libdir=/usr/lib64 --enable-shared --disable-sound --disable-resample \
--disable-video --disable-opencore-amr CFLAGS='-O2 -DNDEBUG'
make uninstall && ldconfig && make dep && make && make install && ldconfig
  • Cài Asterisk13

# Downloading Asterisk source files.

cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-13-current.tar.gz

# Compiling and Installing Asterisk

cd /usr/src
tar xvfz asterisk-13-current.tar.gz
rm -f asterisk-13-current.tar.gz
cd asterisk-*
contrib/scripts/install_prereq install
./configure --libdir=/usr/lib64 --with-pjproject-bundled
contrib/scripts/get_mp3_source.sh

# Making some configuration of installation options, modules, etc. After selecting ‘Save & Exit’ you can then continue

make menuselect

# Installation itself

adduser asterisk -s /sbin/nologin -c "Asterisk User"
make && make install
systemctl disable asterisk

# Setting Asterisk ownership permissions.

chown asterisk. /var/run/asterisk
chown -R asterisk. /etc/asterisk
chown -R asterisk. /var/{lib,log,spool}/asterisk
chown -R asterisk. /usr/lib64/asterisk
chown -R asterisk. /var/www/

# Preparing for FreePBX installation. A few small modifications to Apache and PHP.

sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php.ini
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/httpd/conf/httpd.conf
sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf
systemctl restart httpd.service
  • Cài Freepbx
cd /usr/src
wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-14.0-latest.tgz
tar xfz freepbx-14.0-latest.tgz
rm -f freepbx-14.0-latest.tgz
cd freepbx
touch /etc/asterisk/modules.conf
./start_asterisk start
 ./install -n
cat > /etc/systemd/system/freepbx.service <<EOF
[Unit]
Description=Freepbx
After=mariadb.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/fwconsole start
ExecStop=/usr/sbin/fwconsole stop

[Install]
WantedBy=multi-user.target
EOF
systemctl enable freepbx

# Opening TCP port 80 fro administration interface access

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --permanent --zone=public --add-service={http,https}
firewall-cmd --permanent --zone=public --add-port=5060-5061/tcp
firewall-cmd --permanent --zone=public --add-port=5060-5061/udp
firewall-cmd --permanent --zone=public --add-port=10000-20000/udp
firewall-cmd --reload

Chúc các bạn thành công!

2 thoughts on “Hướng dẫn cài đặt Asterisk13 Freepbx14 trên centos7

  1. Phuoc Hau says:

    anh ơi, em cài tới lệnh pear install Console_Getopt này thì nó báo lỗi thế này Package “Console_Getopt” does not have REST info xml available install failed
    Hướng dẫn em fix lỗi này với. Cảm ơn anh!

Để lại bình luận

Đê lại tên và email của bạn bên dưới.

hng-dn-ci-t-asterisk13-freepbx14-trn-centos7-vietcalls