Có 2 cách để cài đặt được phần mềm FusionPBX là sử dụng script có sẳn để cài đặt cách này chỉ cần chạy 1 file duy nhất là có thể cài đặt, cách thứ 2 là cài đặt từng bước, cài từng gói tốn thời gian hơn nhưng có thể quản lý được những gói đã cài.
apt-get update && apt-get upgradeapt-get install systemd wget apt-get install systemd-sysvapt-get install ca-certificatesrebootGõ 2 dòng lệnh dưới đây: dòng thứ nhất là di chuyển để thư mục /usr/src/ ,dòng 2 là tải file về, dòng 3 là cài đặt
cd /usr/src/wget -O - https://raw.githubusercontent.com/fusionpbx/fusionpbx-install.sh/master/debian/pre-install.sh | sh;cd /usr/src/fusionpbx-install.sh/debian && ./install.sh Chờ tự động cài đặt thôi, quá trình cài đặt khá lâu tầm 15-20 phút
Sau khi cài đặt xong sẽ hiển thị ra thông báo username và password để đăng nhập vào web
Bước 1: Cài đặt các gói cần thiết:
apt update && apt upgrade -y && apt -y remove apache2apt -y install git nano dbus sudo nginx curl lsb-release memcached sqlite3 postgresql-9.4 postgresql-client-9.4 haveged ghostscript libtiff5-dev libtiff-tools at tftpd ssl-cert fail2banBước 2: Cài đặt PHP
Cài từng dòng lệnh một
apt -y install apt-transport-https ca-certificateswget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpgecho "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.listapt update && apt -y install php7.1 php7.1-cli php7.1-common php7.1-curl php7.1-mcrypt php7.1-pgsql php7.1-sqlite3 php7.1-odbc php7.1-xml php7.1-imap php7.1-fpmBước 3: Disabled Selinux
Đầu tiên kiểm tra xem selinux có enable hay không
sestatusNếu có trạng thái là enable thì gõ lệnh sau:
sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/configSau đó reboot server
Bước 4: Tắt Firewall và Iptables
systemctl disable firewalldsystemctl disable iptablessystemctl stop firewalldsystemctl stop iptablesBước 5: Cài đặt múi giờ
timedatectl set-timezone Asia/Ho_Chi_MinhBước 6: Cài đặt Freeswitch
curl https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -echo "deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ $(lsb_release -sc) main" > \/etc/apt/sources.list.d/freeswitch.listapt update && apt -y install freeswitch-all freeswitch-all-dbg freeswitch-sounds* freeswitch-music* gdbBước 7: Cài đặt Databases
Đảm bảo kết nối local không cần xác thực để phục vụ cho việc backup
nano +92 /etc/postgresql/9.4/main/pg_hba.confhost all all 127.0.0.1/32 trustsystemctl restart postgresqlKiểm tra Postgresql
sudo -u postgres psql -lKiểm tra cột Collate và Ctype xem có phải en_US.UTF8 nếu không thì gõ lệnh sau:
sudo -u postgres psqlupdate pg_database set encoding = 6, datcollate = 'en_US.UTF8', datctype = 'en_US.UTF8' where datname = 'template0';update pg_database set encoding = 6, datcollate = 'en_US.UTF8', datctype = 'en_US.UTF8' where datname = 'template1';Tạo databases và user
Tạo user fusionpbx có mật khẩu là 123qwe
cd /tmpsudo -u postgres psql -c "CREATE DATABASE fusionpbx;" sudo -u postgres psql -c "CREATE DATABASE freeswitch;"sudo -u postgres psql -c "CREATE ROLE fusionpbx WITH SUPERUSER LOGIN PASSWORD '123qwe';"sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE fusionpbx to fusionpbx;"sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE freeswitch to fusionpbx;"Bước 8: Cài đặt FusionPBX
mkdir -p /etc/fusionpbxmkdir -p /var/www/fusionpbxgit clone -b 4.4 https://github.com/powerpbx/fusionpbx.git /var/www/fusionpbxCopy file config vào thư mục /etc/freeswitch
mv /etc/freeswitch /etc/freeswitch.origmkdir /etc/freeswitchcp -R /var/www/fusionpbx/resources/templates/conf/* /etc/freeswitchCopy thư mục music đã tải về vào đúng đường dẫn
mkdir -p /usr/share/freeswitch/sounds/music/defaultmv /usr/share/freeswitch/sounds/music/*000/ /usr/share/freeswitch/sounds/music/default/Bước 9: Cấu hình PHP-fpm
sed 's#post_max_size = .*#post_max_size = 80M#g' -i /etc/php/7.1/fpm/php.inised 's#upload_max_filesize = .*#upload_max_filesize = 80M#g' -i /etc/php/7.1/fpm/php.iniRestart php-fpm
systemctl restart php7.1-fpmBước 10: Cấu hình NGINX
mkdir -p /etc/nginx/sslcd /etc/nginx/sites-availablewget https://raw.githubusercontent.com/powerpbx/fusionpbx-install.sh/master/debian/resources/nginx/fusionpbxsed -i /etc/nginx/sites-available/fusionpbx -e 's#unix:.*;#unix:/var/run/php/php7.1-fpm.sock;#g'ln -s /etc/nginx/sites-available/fusionpbx /etc/nginx/sites-enabled/fusionpbxrm /etc/nginx/sites-enabled/default# link to self signed certificateln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/private/nginx.keyln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/certs/nginx.crtmkdir -p /var/www/letsencrypt/Restart nginx
systemctl restart nginxBước 11: Cấu hình Systemd
systemctl stop freeswitchrm -r /run/freeswitchnano /etc/systemd/system/freeswitch.serviceCopy đoạn bên dưới bỏ vào
[Unit]Description=freeswitchAfter=syslog.target network.target local-fs.target postgresql.service[Service]Type=forkingRuntimeDirectory=freeswitchPIDFile=/run/freeswitch/freeswitch.pidEnvironment="DAEMON_OPTS=-ncwait -nonat"EnvironmentFile=-/etc/default/freeswitchExecStart=/usr/bin/freeswitch $DAEMON_OPTSTimeoutSec=45sRestart=alwaysUser=www-dataGroup=www-dataLimitCORE=infinityLimitNOFILE=100000LimitNPROC=60000LimitSTACK=250000LimitRTPRIO=infinityLimitRTTIME=infinityIOSchedulingClass=realtimeIOSchedulingPriority=2CPUSchedulingPriority=89UMask=0007; Comment this out if using OpenVZCPUSchedulingPolicy=rr[Install]WantedBy=multi-user.targetTạo file environment
cat >> /etc/default/freeswitch << EOF# Uncommented variables will override variables in unit file# User=""# Group=""# DAEMON_OPTS=""EOFBước 12: Cấp quyền cho thư mục và file
# Set ownershipchown -R www-data. /etc/freeswitch /etc/fusionpbx /var/lib/freeswitch \/var/log/freeswitch /usr/share/freeswitch /var/www/fusionpbx /var/run/freeswitch## Set directory permissions to 755 (u=rwx,g=rx,o='rx')find /etc/freeswitch -type d -exec chmod 755 {} \;find /etc/fusionpbx -type d -exec chmod 755 {} \;find /var/lib/freeswitch -type d -exec chmod 755 {} \;find /var/log/freeswitch -type d -exec chmod 755 {} \;find /usr/share/freeswitch -type d -exec chmod 755 {} \;find /var/www/html -type d -exec chmod 755 {} \;## Set file permissions to 664 (u=rw,g=rw,o=r)find /etc/freeswitch -type f -exec chmod 664 {} \;find /etc/fusionpbx -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 {} \;## Set misc permissions to 755 (u=rwx,g=rx,o='rx')chmod -R 755 /var/www/fusionpbx/secureBước 13: Enable services
systemctl daemon-reloadsystemctl enable freeswitchsystemctl restart freeswitchBước 14: Mở web để cài đặt
Mở trình duyệt web nhập ip của server vào
Sẻ hiện lênh phần cài đặt, đầu tiên là ngôn ngữ
Tạo user để login web
Cấu hình databases
Databases Username: fusionpbx
Databases Password: 123qwe
Password đã tạo ở bước 7
Sau đó chọn Next để cài đặt
Chờ vài giây để cài đặt
Sau khi cài đặt xong sẽ hiển thị ra màn hình đăng nhập
Nhập user và pass vừa tạo: admin/admin
Giao diện FusionPBX 4.4 như sau
Như vậy bạn đã cài đặt thành công FusionPBX 4.4
Video hướng dẫn: https://www.youtube.com/watch?v=iVKUbrPwj_0&t