Skip to content

Instantly share code, notes, and snippets.

@artmouse
Forked from alexcr-telecom/install_freepbx.sh
Created October 23, 2018 08:48
Show Gist options
  • Save artmouse/f7d47d23e3adb3f34a63ae48ae6f8a28 to your computer and use it in GitHub Desktop.
Save artmouse/f7d47d23e3adb3f34a63ae48ae6f8a28 to your computer and use it in GitHub Desktop.
yum -y update
yum -y groupinstall core base "Development Tools"
yum -y install epel-release
yum -y install fail2ban mc htop iftop vim iptables
yum -y install lynx mysql mysql-server mariadb-server mariadb php php-mysql php-mbstring tftp-server httpd ncurses-devel sendmail sendmail-cf sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion kernel-devel git php-process crontabs cronie cronie-anacron wget vim php-xml uuid-devel sqlite-devel net-tools gnutls-devel php-pear
pear install Console_Getopt
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
# Enable MariaDB
systemctl enable mariadb.service
# Start MariaDB
systemctl start mariadb
mysql_secure_installation
systemctl enable httpd.service
systemctl start httpd.service
adduser asterisk -M -c "Asterisk User"
# Download Asterisk
cd /usr/src
#wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
#wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-15-current.tar.gz
wget -O jansson.tar.gz https://github.com/akheron/jansson/archive/v2.7.tar.gz
#wget http://www.pjsip.org/release/2.4/pjproject-2.4.tar.bz2
#cd /usr/src
#tar -xjvf pjproject-2.4.tar.bz2
#rm -f pjproject-2.4.tar.bz2
#cd pjproject-2.4
#CFLAGS='-DPJ_HAS_IPV6=1' ./configure --prefix=/usr --enable-shared --disable-sound\
# --disable-resample --disable-video --disable-opencore-amr --libdir=/usr/lib64
#make dep
#make
#make install
cd /usr/src
tar vxfz jansson.tar.gz
rm -f jansson.tar.gz
cd jansson-*
autoreconf -i
./configure --libdir=/usr/lib64
make
make install
# Install Asterisk
cd /usr/src
tar xvfz asterisk-15-current.tar.gz
#rm -f asterisk-15-current.tar.gz
cd asterisk-*
contrib/scripts/install_prereq install
./configure --libdir=/usr/lib64 --with-pjproject-bundled
contrib/scripts/get_mp3_source.sh
make menuselect
make
make install
make config
make install-logrotate
ldconfig
chkconfig asterisk off
# Download Asterisk Sounds
cd /var/lib/asterisk/sounds
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en-wav-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-wav-current.tar.gz
tar xvf asterisk-core-sounds-en-wav-current.tar.gz
rm -f asterisk-core-sounds-en-wav-current.tar.gz
tar xfz asterisk-extra-sounds-en-wav-current.tar.gz
rm -f asterisk-extra-sounds-en-wav-current.tar.gz
cd /var/lib/asterisk/sounds
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-ru-wav-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-ru-wav-current.tar.gz
tar xvf asterisk-core-sounds-ru-wav-current.tar.gz
rm -f asterisk-core-sounds-ru-wav-current.tar.gz
tar xfz asterisk-extra-sounds-ru-wav-current.tar.gz
rm -f asterisk-extra-sounds-ru-wav-current.tar.gz
# Wideband Audio download
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-core-sounds-en-g722-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-g722-current.tar.gz
tar xfz asterisk-extra-sounds-en-g722-current.tar.gz
rm -f asterisk-extra-sounds-en-g722-current.tar.gz
tar xfz asterisk-core-sounds-en-g722-current.tar.gz
rm -f asterisk-core-sounds-en-g722-current.tar.gz
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/
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
# Install 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
./start_asterisk start
./install -n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment