-
-
Save billsimon/f66636f83de8e1162ea318ccd7a9b576 to your computer and use it in GitHub Desktop.
FreePBX 16, Asterisk 16 on Debian 11 - package-based install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run all commands logged in as root or "sudo su - " | |
# Start from a base Debian 11 install and update it to current. | |
apt update | |
apt upgrade | |
# Install all prerequisite packages | |
apt install -y util-linux cron wget apache2 mariadb-server mariadb-client php php-curl php-cli php-pdo php-mysql php-pear php-gd php-mbstring php-intl php-bcmath curl sox mpg123 lame ffmpeg sqlite3 git unixodbc sudo dirmngr postfix asterisk odbc-mariadb php-ldap nodejs npm pkg-config libicu-dev | |
# Prepare asterisk | |
systemctl stop asterisk | |
systemctl disable asterisk | |
cd /etc/asterisk | |
mkdir DIST | |
mv * DIST | |
cp DIST/asterisk.conf . | |
sed -i 's/(!)//' asterisk.conf | |
touch modules.conf | |
touch cdr.conf | |
# Configure Apache | |
sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php/7.4/apache2/php.ini | |
sed -i 's/\(^memory_limit = \).*/\1256M/' /etc/php/7.4/apache2/php.ini | |
sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf | |
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf | |
a2enmod rewrite | |
service apache2 restart | |
rm /var/www/html/index.html | |
# Configure odbc | |
cat <<EOF > /etc/odbcinst.ini | |
[MySQL] | |
Description = ODBC for MySQL (MariaDB) | |
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmaodbc.so | |
FileUsage = 1 | |
EOF | |
cat <<EOF > /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 | |
EOF | |
# Finally we get to install FreePBX | |
cd /usr/local/src | |
wget http://mirror.freepbx.org/modules/packages/freepbx/7.4/freepbx-16.0-latest.tgz | |
tar zxvf freepbx-16.0-latest.tgz | |
cd /usr/local/src/freepbx/ | |
./start_asterisk start | |
./install -n | |
# Get the rest of the modules | |
fwconsole ma installall | |
# NOTE: digiumaddoninstaller, firewall, and xmpp will not install. Firewall will not work without sysadmin; xmpp will not work without | |
# mongodb. If you want XMPP, install mongodb from their repo first. | |
# Reload to apply config so far | |
fwconsole r | |
# Use the sound files freepbx installed instead of the sound files from the Debian repo | |
cd /usr/share/asterisk | |
mv sounds sounds-DIST | |
ln -s /var/lib/asterisk/sounds sounds | |
# Need to restart in order to load Asterisk modules that weren't configured yet | |
fwconsole restart | |
# Set up systemd startup script | |
cat <<EOF > /etc/systemd/system/freepbx.service | |
[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 | |
# Asterisk and FreePBX 16 are installed! Go to the web interface at http://YOUR-IP to finish setup. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the great job!
Can one start using this script already?