Для этого отредактируем файл sources.list с основной информацией о базовых репозиториях Debian 12 Bookworm. Добавляем репозитории contrib и non-free
Далее все команды, в приведенной инструкции, выполняются из под root пользователя.
nano /etc/apt/sources.list
apt update
sudo apt -y upgrade
firewall-cmd --zone=public --add-port=80/tcp --permanent &&
firewall-cmd --zone=public --add-port=443/tcp --permanent &&
firewall-cmd --zone=public --add-port=5060/udp --permanent &&
firewall-cmd --zone=public --add-port=5061/tcp --permanent &&
firewall-cmd --zone=public --add-port=8001/tcp --permanent &&
firewall-cmd --zone=public --add-port=8003/tcp --permanent &&
firewall-cmd --zone=public --add-port=8088-8089/tcp --permanent &&
firewall-cmd --reload
apt install locales
dpkg-reconfigure locales
reboot
apt -y install mariadb-server mariadb-client
systemctl enable --now mariadb
mysql_secure_installation
Switch to unix_socket authentication [Y/n] n
Change the root password? [Y/n] n
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
apt install -y unixodbc odbcinst odbc-mariadb
nano /etc/odbcinst.ini
[MySQL]
Description = ODBC for MySQL (MariaDB)
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so
FileUsage = 1
nano /etc/odbc.ini
[MySQL-asteriskcdrdb]
Description = MySQL connection to 'asteriskcdrdb' database
Driver = MySQL
Server = localhost
Database = asteriskcdrdb
Port = 3306
Socket = /var/run/mysqld/mysqld.sock
Option = 3
#odbcinst -q -d
[MySQL]
# odbcinst -q -s
[MySQL-asteriskcdrdb]
apt -y install git vim curl wget libnewt-dev libssl-dev libncurses5-dev subversion software-properties-common libsqlite3-dev build-essential libjansson-dev libxml2-dev uuid-dev sox mpg123 lame ffmpeg
cd /usr/src/
cd /usr/src &&
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-18-current.tar.gz &&
tar zxf asterisk-18-current.tar.gz &&
cd asterisk-18.*/
sudo ./contrib/scripts/install_prereq install &&
sudo ./contrib/scripts/get_mp3_source.sh
./configure --with-jansson-bundled --with-pjproject-bundled
make menuselect
Add-ons (See README-addons.txt)
+--> Select format_mp3
Applications
+--> Select app_macro
Bridging Modules
Channel Event Logging
Channel Drivers
Codec Translators
+---> Select all External Codecs
Format Interpreters
Dialplan Functions
PBX Modules
Resource Modules
Test Modules
Compiler Flags
Utilities
AGI Samples
Core Sound Packages
+--> Select WAV, ULAW, ALAW, GSM, G729, G722
Music On Hold File Packages
+--> Select WAV, ULAW, ALAW, GSM, G729, G722
MENUSELECT_EXTRA_SOUNDS
+--> Select WAV, ULAW, ALAW, GSM, G729, G722
make &&
make install
make basic-pbx &&
make config &&
ldconfig
groupadd asterisk
useradd -r -d /var/lib/asterisk -g asterisk asterisk
usermod -aG audio,dialout asterisk
sed -i 's/#AST_USER="asterisk"/AST_USER="asterisk"/' /etc/default/asterisk &&
sed -i 's/#AST_GROUP="asterisk"/AST_GROUP="asterisk"/' /etc/default/asterisk &&
sed -i 's/;runuser = asterisk/runuser = asterisk/' /etc/asterisk/asterisk.conf &&
sed -i 's/;rungroup = asterisk/rungroup = asterisk/' /etc/asterisk/asterisk.conf &&
chown -R asterisk:asterisk {/etc,/var/lib,/var/spool,/var/log,/var/run}/asterisk &&
systemctl restart asterisk && systemctl enable asterisk && systemctl status asterisk
asterisk -rvvvvv
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - &&\
apt-get install -y nodejs
# node -v
v20.11.1
# npm -v
10.2.4
apt -y install apache2 && \
cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf_orig && \
sed -i 's/export APACHE_RUN_USER=www-data/export APACHE_RUN_USER=asterisk/' /etc/apache2/envvars && \
sed -i 's/export APACHE_RUN_GROUP=www-data/export APACHE_RUN_GROUP=asterisk/' /etc/apache2/envvars && \
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf && \
rm -f /var/www/html/index.html && \
unlink /etc/apache2/sites-enabled/000-default.conf
apt install -y lsb-release && \
apt install -y ca-certificates apt-transport-https software-properties-common gnupg2 wget curl
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg && \
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php.list && \
apt update && apt install -y php7.4 libapache2-mod-php7.4 && \
apt install -y php7.4-{mysql,cli,common,imap,ldap,xml,fpm,curl,mbstring,zip,gd,gettext,xml,json} && \
php -v
Если выдает ошибку, то репозиторий блокирует доступ из вашей страны
Выход:
mcedit /etc/apt/sources.list.d/php.list
#deb https://packages.sury.org/php/ bookworm main
deb https://ftp.mpi-inf.mpg.de/mirrors/linux/mirror/deb.sury.org/repositories/php/ bookworm main
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/apache2/php.ini && \
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/cli/php.ini && \
sed -i 's/\(^memory_limit = \).*/\1256M/' /etc/php/7.4/apache2/php.ini
apt install -y sox mpg123 lame ffmpeg sqlite3 git dirmngr pkg-config libicu-dev
cd /usr/src && wget http://mirror.freepbx.org/modules/packages/freepbx/7.4/freepbx-16.0-latest.tgz && \
tar xfz freepbx-16.0-latest.tgz && \
cd freepbx && \
./start_asterisk restart
cd /usr/src/asterisk-18.* &&
make basic-pbx &&
make config &&
ldconfig &&
cd /usr/src/freepbx &&
./start_asterisk restart &&
ps aux | grep asterisk &&
rm -f /etc/asterisk/asterisk.conf &&
./install -n
fwconsole ma disablerepo commercial &&
fwconsole ma enablerepo extended &&
fwconsole ma delete firewall &&
fwconsole chown &&
fwconsole reload &&
fwconsole restart &&
a2enmod rewrite &&
systemctl restart apache2
sudo tee /etc/systemd/system/freepbx.service<<EOF
[Unit]
Description=FreePBX VoIP Server
After=mariadb.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/fwconsole start -q
ExecStop=/usr/sbin/fwconsole stop -q
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload && systemctl enable freepbx && systemctl start freepbx
# asterisk -rx "cdr show status"
Call Detail Record (CDR) settings
----------------------------------
Logging: Enabled
Mode: Simple
Log calls by default: Yes
Log unanswered calls: No
Log congestion: No
Ignore bridging changes: No
Ignore dial state changes: No
* Registered Backends
-------------------
Adaptive ODBC
# asterisk -rx "odbc show"
ODBC DSN Settings
-----------------
Name: asteriskcdrdb
DSN: MySQL-asteriskcdrdb
Number of active connections: 1 (out of 5)
Logging: Disabled