#!/bin/bash if [ ! -e /etc/centos-release ]; then echo Currenly we support only CentOS 7.9+ x64 - exiting... exit 1 fi # centos-release-7-9.2009.0.el7.centos.x86_64 release=`rpm --query centos-release ` if [ "foo`echo $release | grep -e '^centos-release-7-.*x86_64$'`" != "foo" ] && [ `echo $release | cut -d '-' -f 4 | cut -d '.' -f 1` -ge 9 ]; then echo We are at `cat /etc/centos-release` x64 - continue... else echo Currenly we support only CentOS 7.9+ x64 - exiting... echo Please upgrade your server with yum update, reboot and repeat Thirdlane installation. exit 1 fi if [ -e /etc/asterisk/ ]; then echo "Asterisk is already installed - cannot continue - exiting..." exit 1 fi yum clean all yum -y install yum-utils tar wget gzip ntp psmisc rpm -ivh http://mirror-us.thirdlane.com/channels/thirdlane/centos/7/x86_64/thirdlane-release-0.0.2-1.el7.noarch.rpm rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY.thc.txt rpm --import https://mirror.yandex.ru/centos/RPM-GPG-KEY-CentOS-7 systemctl stop ntpd ntpdate 0.centos.pool.ntp.org rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB cat >/etc/yum.repos.d/mariadb.repo <<-EOF [mariadb] name = MariaDB #baseurl = http://yum.mariadb.org/10.3/centos7-amd64 baseurl = https://archive.mariadb.org/mariadb-10.3/yum/centos7-amd64/ gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck = 1 enabled = 1 EOF #yum-config-manager --enable thirdlane-testing >/dev/null 2>&1 #yum-config-manager --disable thirdlane-nightly >/dev/null 2>&1 HOME=/var/thirdlane_load/ LIB=http://lib.thirdlane.com/download/ FILE=pbxm-install-el7.tar.gz mkdir -p $HOME cd $HOME wget $LIB/getpbx-el7/$FILE tar zxf $FILE >/dev/null 2>&1 req=`expr 4 \* 1024 \* 1024` # 4Gb mem=`free | grep Mem: | awk '{print $2}'` swp=`free | grep Swap: | awk '{print $2}'` tot=`expr ${mem} + ${swp}` add=`expr ${req} - ${tot}` echo MEM=${mem} SWAP=${swp} TOTAL=${tot} NEED=${add} if [ ${add} -gt 0 ]; then add=`expr ${add} + 20` # add 20K echo Create extra swap of ${add} Kbytes... dd if=/dev/zero of=/swapfile bs=1024 count=${add} mkswap /swapfile ${add} -f swapon /swapfile echo "/swapfile swap swap defaults 0 0" >>/etc/fstab fi yum -y install epel-release rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 echo Disable EPEL repo to avoid conflicts... yum-config-manager --disable epel >/dev/null 2>&1 PBXTYPE=ast13st echo Install Thirdlane PBX Manager software bash install_parts.sh ${PBXTYPE} 2>&1 | tee /root/thirdlane_install.log