Installer Asterisk et FreePBX sur CentOS 7

En cours de rédaction, à vos risques et périls

Configuration des dépôts

Le dépôt tucny contient les RPMS nécessaires:

cat <<'_EOF' > /etc/yum.repos.d/tucny-asterisk.repo [asterisk-common] name=Asterisk Common Requirement Packages @ tucny.com #baseurl=https://ast.tucny.com/repo/asterisk-common/el$releasever/$basearch/ mirrorlist=https://ast.tucny.com/mirrorlist.php?release=$releasever&arch=$basearch&repo=asterisk-common enabled=1 gpgcheck=1 gpgkey=https://ast.tucny.com/repo/RPM-GPG-KEY-dtucny [asterisk-13] name=Asterisk 13 Packages @ tucny.com #baseurl=https://ast.tucny.com/repo/asterisk-13/el$releasever/$basearch/ mirrorlist=https://ast.tucny.com/mirrorlist.php?release=$releasever&arch=$basearch&repo=asterisk-13 enabled=1 gpgcheck=1 gpgkey=https://ast.tucny.com/repo/RPM-GPG-KEY-dtucny _EOF rpm --import https://ast.tucny.com/repo/RPM-GPG-KEY-dtucny

Installation des paquets

Asterisk et ses composants

yum install asterisk asterisk-sounds-core-{en,fr}-{siren14,siren7,sln16,ulaw,wav} asterisk-voicemail-plain asterisk-pjsip asterisk-mysql asterisk-ael asterisk-iax2

Dépendances pour FreePBX

yum install mariadb-server php-mysql php-fpm httpd mod_ssl php-mbstring php-xml php-cli php-pear
pear install Console_Getopt

Démarrer les services

systemctl start mariadb.service systemctl enable mariadb.service systemctl start httpd systemctl enable httpd systemctl start php-fpm systemctl enable php-fpm

Configurer la partie web

mkdir /var/lib/php/ast-sessions chown asterisk:asterisk /var/lib/php/ast-sessions chmod 770 /var/lib/php/ast-sessions cat <<'_EOF' > /etc/php-fpm.d/www.conf [www] listen = /run/php-fpm/www.sock listen.owner = apache listen.group = apache listen.mode = 0660 user = asterisk group = asterisk pm = dynamic pm.max_children = 50 pm.start_servers = 5 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 php_admin_value[error_log] = syslog php_admin_flag[log_errors] = on php_value[session.save_handler] = files php_value[session.save_path] = /var/lib/php/ast-sessions php_admin_value[memory_limit] = 256M _EOF cat <<'_EOF' > /etc/httpd/conf.d/php-fpm.conf <FilesMatch \.php$> SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost" </FilesMatch> cat <<'_EOF' > /etc/httpd/conf.d/freepbx.conf <Directory /var/www/html> DirectoryIndex index.php Options +FollowSymlinks AllowOverride All </Directory> _EOF systemctl restart httpd systemctl restart php-fpm

</code>

Configurer MariaDB

mysql_secure_installation

Télécharger FreePBX

cd /usr/src wget http://mirror.freepbx.org/modules/packages/freepbx/freepbx-13.0-latest.tgz tar xfz freepbx-13.0-latest.tgz rm -f freepbx-13.0-latest.tgz cd freepbx

Créer les bases de données

mysql
CREATE DATABASE freepbx; CREATE DATABASE asteriskcdrdb; GRANT ALL privileges ON freepbx.* TO 'freepbx'@'localhost' IDENTIFIED BY 'p@ssw0rd'; GRANT ALL privileges ON asteriskcdrdb.* TO 'freepbx'@'localhost' IDENTIFIED BY 'p@ssw0rd';

Éditer /etc/asterisk/asterisk.conf et enlever (!) sur la première ligne

Lancer l'installation

systemctl start asterisk ./install