#!/bin/bash if [ ! -e /etc/almalinux-release ]; then echo Currenly we support only AlmaLinux release 8.7+ x64 - exiting... exit 1 fi # almalinux-release-8.8-1.el8.x86_64 release=`rpm --query almalinux-release ` if [ "foo`echo $release | grep -e '^almalinux-release-8.*x86_64$'`" != "foo" ] && [ `echo $release | cut -d '-' -f 3 | cut -d '.' -f 1` -ge 8 ]; then echo We are at `cat /etc/almalinux-release` x64 - continue... else echo Currenly we support only AlmaLinux 8.8+ 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 # fix minor EL8 bug sed -i "s/^ConditionCPUs=/#ConditionCPUs/" /usr/lib/systemd/system/irqbalance.service # disable IPV6 IP=`which ip 2>/dev/null || echo /usr/sbin/ip` ADDR=`$IP address show dev lo | grep inet6 | awk '{print $2}'` CONF=/etc/sysctl.conf if [ "$ADDR" == "::1/128" ]; then echo Disable IPV6 echo "Disable IPv6 at $CONF" sed -i '/net.ipv6.conf.all.disable_ipv6/d' $CONF sed -i '/net.ipv6.conf.default.disable_ipv6/d' $CONF echo 'net.ipv6.conf.all.disable_ipv6 = 1' >> /etc/sysctl.conf echo 'net.ipv6.conf.default.disable_ipv6 = 1' >> /etc/sysctl.conf sysctl -p for f in `ls /etc/sysconfig/network-scripts/ifcfg-*`; do sed -i 's/^IPV6INIT=.*$/IPV6INIT=no/' $f; done systemctl restart NetworkManager.service else echo IPV6 is already disabled fi echo Fix localhost at /etc/hosts sed -i /^::1/d /etc/hosts echo '127.0.0.1 localhost' >>/etc/hosts #yum clean all #yum update -y # disable SELINUX if [ `sestatus | grep 'SELinux status' | awk '{print $3}'` == "enabled" ]; then echo Disable SELINUX setenforce Permissive sed -i /etc/selinux/config -e 's/^SELINUX=.*$/SELINUX=disabled/' cat <<-EOF ******************************************************* * We have disabled SELINUX at your server * * In order to continue system installation * * you MUST reboot your server * ******************************************************* EOF echo "Press ENTER to reboot or Ctrl-C to abort..." read REPLY echo "Rebooting - please relogin and start installation script againt." /sbin/reboot fi echo Sync time with NTP /usr/bin/systemctl stop chronyd /usr/sbin/chronyd -q 'server 0.north-america.pool.ntp.org iburst' /usr/bin/systemctl start chronyd /usr/bin/systemctl enable chronyd yum clean all yum -y install yum-utils tar wget gzip psmisc rpm -ivh http://mirror-us.thirdlane.com/channels/thirdlane/centos/8/x86_64/thirdlane-release-0.0.2-2.el8.noarch.rpm http://mirror-us.thirdlane.com/channels/thirdlane/centos/8/x86_64/thirdlane-systemd-overrides-0.0.1-5.el8.noarch.rpm if [ ! -e /etc/yum.repos.d/thirdlane.repo ]; then echo "!!! Cannot install Thirdlane repository - installation cannot continue !!!" echo "Fix the problem and run installation script again" exit 1 fi rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY.thc.txt rpm --import http://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux-8 yum-config-manager --enable powertools plus ha >/dev/null 2>&1 #yum-config-manager --enable thirdlane-testing >/dev/null 2>&1 HOME=/var/thirdlane_load/ LIB=http://lib.thirdlane.com/download/ FILE=pbxm-install-el8.tar.gz mkdir -p $HOME cd $HOME wget $LIB/getpbx-el8/$FILE tar zxf $FILE >/dev/null 2>&1 req=`expr 8 \* 1024 \* 1024` # 8Gb 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 chmod 0600 /swapfile 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-8 echo Disable EPEL repo to avoid conflicts... yum-config-manager --disable epel >/dev/null 2>&1 PBXTYPE=ast13mt echo Install Thirdlane PBX Manager software bash install_parts.sh ${PBXTYPE} 2>&1 | tee /root/thirdlane_install.log