Automating the build of Asterisk on Oracle 8

At some point in our company there was a need to simplify the deployment of Asterisk software

The main problem arose when building Asterisk from source, as it was necessary to select the necessary / unnecessary modules, and simple copying of the menuselect.makeopts file did not always work when switching from version to version

Before the heap, they decided to move from CentOS 6/7 to Oracle 8 (this, as it turned out, is still that quest 8), since the version is fresh and the instructions that wander from site to site on these Internet sites do not always correspond to reality. In particular, we spent almost the whole day installing libedit-devel – it was not in the repositories, the PowerTools repository, which is referenced by instructions on the Internet, is absent in Oracle 8. It turned out that in Oracle it is necessary to activate the ol8_codeready_builder repository 🙂

So let’s go.

1. Install Oracle 8, configure the network

2. We perform the actions necessary to install Asterisk without dancing with a tambourine:

firewall systemctl stop firewalld ; systemctl disable firewalld

sudo setenforce 0

sudo sed -i 's/(^SELINUX=).*/SELINUX=permissive/' /etc/selinux/config

dnf in --nogpgcheck https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm 

yum -y groupinstall "Development Tools" 

dnf config-manager --set-enabled ol8_codeready_builder

dnf install mc wget curl bind-utils net-tools mlocate man  mutt tcpdump sysstat rsync unzip rsyslog net-snmp mailx lsof chrony

dnf install git dnsmasq svn nfs-utils patch gdb gcc gcc-c++ ncurses-devel libxml2-devel sqlite-devel unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel libtiff-devel libuuid-devel jansson-devel pjproject-devel ImageMagick ghostscript openssl-devel bzip2  mariadb-connector-odbc libedit-devel 

rm -rf /etc/localtime ; ln -s /usr/share/zoneinfo/Europe/Moscow /etc/localtime

systemctl enable chronyd ; systemctl start chronyd

3. In the directory / usr / src / asterisk, download your favorite version of asterisk from the official website or clone it from github (currently the current LTS is 18)

https://downloads.asterisk.org/pub/telephony/asterisk/
https://github.com/asterisk/asterisk

4. If you downloaded the archive, then expand it and go to the created directory

tar zxvf asterisk-18-current.tar.gz ; cd asterisk-18.8.0

5. We start preparing for the assembly

./configure

6. Run the menuselect build

make menuselect.makeopts

7. Let’s create a file with a list of all modules

menuselect / menuselect –list-options> ../options.conf

8. As a result of execution, we get a file with the following content

+ chan_mobile MENUSELECT_ADDONS

- chan_ooh323 MENUSELECT_ADDONS

- format_mp3 MENUSELECT_ADDONS

+ res_config_mysql MENUSELECT_ADDONS

+ app_mysql MENUSELECT_ADDONS

+ cdr_mysql MENUSELECT_ADDONS

+ app_agent_pool MENUSELECT_APPS

+ app_authenticate MENUSELECT_APPS

+ app_bridgeaddchan MENUSELECT_APPS

+ app_bridgewait MENUSELECT_APPS

.....


8. Open the resulting file for editing and put ± in the corresponding modules

9. In / usr / src / asterisk, create a build file that will build and install Asterisk only with the necessary modules

#!/bin/bash

pushd asterisk-18.8.0

./configure --libdir=/usr/lib64 --without-dahdi --without-pri --without-gtk2 
    --without-radius --without-x11 --without-speex --with-pjproject-bundled

# ------------------
n=0
while read line; do
    # reading each line
    n=$((n+1))

    STATE=`echo $line | cut -d' ' -f1`
    OPTION=`echo $line | cut -d' ' -f2`
    CATEGORY=`echo $line | cut -d' ' -f3`

    echo "Line No. $n"
    echo "$line"
    echo "state=$STATE cat=$CATEGORY values=$OPTION"

    action='enable'
    if [[ "$state" == '-' ]] ; then
        action='disable'
    fi

    menuselect/menuselect --$action $OPTION menuselect.makeopts

    echo "-------------------"
done < ../options.conf

make

make install

popd

10. Push the build and options.conf files into git

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *