Instalación de Kamailio 5.8 y RTPEngine en Amazon EC2 – Rocky Linux 9

Esta entrada no va a tener muchas explicaciones para reducir el tamaño y porque en la mayoría de los casos no hacen falta. Una vez creada la Instancia de EC2 con Rocky Linux 9, se accede a ella y:

 

sudo su

 

dnf install nano -y

 

Memoria de SWAP:

 

dd if=/dev/zero of=/swapfile bs=2040 count=1024k

mkswap /swapfile

swapon /swapfile

 

nano /etc/fstab

 

/swapfile swap swap defaults 0 0

 

chmod 0600 /swapfile

 

dnf install epel-release -y

 

dnf config-manager --set-enabled crb

dnf update -y

dnf install wget git -y

timedatectl set-timezone America/Bogota

dnf install chrony -y

systemctl enable chronyd

systemctl start chronyd

 

nano /root/.bash_profile

 

export EDITOR=/usr/bin/nano

export PS1='\[\033[0;35m\]\H\[\033[0;33m\] \w\[\033[00m\]: '

alias free="free -m"

alias kacfg="nano /etc/kamailio/kamailio.cfg"

alias kalog="nano /var/log/kamailio.log"

alias katail="tail -500f /var/log/kamailio.log"

alias mysql="mysql -u root -pKLuJUE3NEwTaSH6S"

 

source /root/.bash_profile

 

nano /etc/selinux/config

 

dnf update -y

 

reboot

 

dnf config-manager --set-enabled crb

 

 

dnf group install 'Development Tools' -y

 

dnf install bison-devel mariadb-devel mariadb-server net-tools libgcrypt-devel net-snmp-devel xmlto libmicrohttpd-devel xmlrpc-c-devel lynx \

libxml2-devel expat-devel ncurses-devel net-snmp net-snmp-devel net-snmp-libs net-snmp-utils jansson-devel pcre-devel \

libuuid-devel uuid uuid-devel ruby-devel spandsp-devel gperf sqlite sqlite-devel postgresql-devel postgresql-server ngrep \

lksctp-tools-devel python3-devel libjwt-devel openldap openldap-clients openldap-devel openldap libmemcached-devel systemd-devel \

unixODBC unixODBC-devel mariadb-connector-odbc libtool-ltdl-devel libtool mono-devel hiredis-devel perl-ExtUtils-Embed libpurple-devel \

lua-devel libdb-cxx-devel libunistring-devel thrift-devel libevent-devel json-c-devel librabbitmq-devel libmaxminddb-devel bind bind-devel \

libev-devel libmnl-devel expat-devel libwebsockets-devel iptables-devel iptables-services libpcap-devel json-glib-devel libevent-devel perl-IPC-Cmd \

kernel-modules-extra pandoc iptables-legacy-devel libnftnl-devel zeromq libavc1394 opus-devel cmake iptables-utils libnl3-devel tcpdump -y

 

wget -q -O - https://updates.atomicorp.com/installers/atomic | sh

 

dnf install GeoIP-devel -y

 

dnf install --nogpgcheck https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-9.noarch.rpm -y

 

dnf install ffmpeg ffmpeg-devel libavdevice -y

 

dnf config-manager --add-repo https://rpm.kamailio.org/centos/kamailio.repo

 

dnf install kamailio* -y

 

systemctl enable kamailio.service

 

nano /etc/kamailio/kamailio.cfg

 

auto_aliases=no

 

listen=udp:IP_PRIVADA:5060 advertise IP_ELASTICA:5060

 

nano /etc/rsyslog.conf

 

local0.* /var/log/kamailio.log

 

touch /var/log/kamailio.log

 

systemctl restart rsyslog

 

nano /etc/logrotate.d/kamailio

 

/var/log/kamailio.log {

missingok

rotate 7

daily

postrotate

/bin/kill -HUP `cat /var/run/rsyslogd.pid 2>/dev/null` 2>/dev/null || true

endscript

}

 

systemctl enable mariadb

systemctl start mariadb

mysqladmin -u root password KLuJUE3NEwTaSH6S

mysql_secure_installation

 

Primeras dos preguntas se contesta con NO, las siguientes todas con YES

 

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -pKLuJUE3NEwTaSH6S mysql

 

nano /etc/my.cnf.d/mariadb-server.cnf

 

default-time-zone = America/Bogota

 

systemctl restart mariadb

 

mv /etc/kamailio/kamctlrc /etc/kamailio/kamctlrc.old

 

nano /etc/kamailio/kamctlrc

 

SIP_DOMAIN=miodominio.org

DBENGINE=MYSQL

DBHOST=localhost

DBNAME=kamailio

DBRWUSER=kamailio

DBRWPW="kamailiorw"

DBROUSER="kamailioro"

DBROPW="kamailioro"

DBROOTUSER="root"

INSTALL_EXTRA_TABLES=ask

INSTALL_PRESENCE_TABLES=ask

INSTALL_DBUID_TABLES=ask

ALIASES_TYPE="DB"

FIFOPATH="/var/run/kamailio/kamailio_fifo"

VERIFY_ACL=1

STORE_PLAINTEXT_PW=0

PID_FILE=/var/run/kamailio/kamailio.pid

 

kamdbctl create

 

MySQL password for root: KLuJUE3NEwTaSH6S

INFO: test server charset

INFO: creating database kamailio ...

INFO: granting privileges to database kamailio ...

INFO: creating standard tables into kamailio ...

INFO: Core Kamailio tables succesfully created.

Install presence related tables? (y/n): y

INFO: creating presence tables into kamailio ...

INFO: Presence tables succesfully created.

Install tables for imc cpl siptrace domainpolicy carrierroute

drouting userblacklist htable purple uac pipelimit mtree sca mohqueue

rtpproxy rtpengine secfilter? (y/n): y

INFO: creating extra tables into kamailio ...

INFO: Extra tables succesfully created.

Install tables for uid_auth_db uid_avp_db uid_domain uid_gflags

uid_uri_db? (y/n): y

INFO: creating uid tables into kamailio ...

INFO: UID tables succesfully created.

 

cd /usr/src

git clone https://github.com/BelledonneCommunications/bcg729.git

cd bcg729/

cmake .

make

make install

 

cd /usr/src

git clone -b mr12.4 https://github.com/sipwise/rtpengine.git

cd /usr/src/rtpengine/daemon

make

cp rtpengine /usr/local/bin/

cd /usr/src/rtpengine/kernel-module

make

 

uname -r

5.14.0-427.42.1.el9_4.x86_64

 

cp xt_RTPENGINE.ko /lib/modules/5.14.0-427.42.1.el9_4.x86_64/extra/xt_RTPENGINE.ko

 

nano /etc/modules-load.d/rtpengine.conf

 

xt_RTPENGINE

 

depmod -a

modprobe xt_RTPENGINE

echo 'add 0' > /proc/rtpengine/control

rtpengine --codecs

 

cd /usr/src

git clone -b 2.1-config https://github.com/etamme/federated-sip.git

cd federated-sip/scripts

cp rtpengine.service /etc/systemd/system/

systemctl enable rtpengine.service

mkdir -p /var/spool/rtpengine

cp rtpengine.sysconfig /etc/sysconfig/rtpengine

 

nano /etc/sysconfig/rtpengine

 

OPTIONS="--interface=pub/IP_PRIAVADA!IP_ELASTICA -n 127.0.0.1:2223 -m 20000 -M 30000 -L 7 --log-facility=local1 --table=0 --nftables-chain="

 

nano /etc/rsyslog.d/rtpengine.conf

 

:programname, startswith, "rtpengine" -/var/log/rtpengine.log

 

& ~

 

touch /var/log/rtpengine.log

systemctl restart rsyslog

systemctl start rtpengine

nano /etc/logrotate.d/rtpengine

 

/var/log/rtpengine.log {

missingok

rotate 7

daily

postrotate

/bin/kill -HUP `cat /var/run/rsyslogd.pid 2>/dev/null` 2>/dev/null || true

endscript

}

 

cd /usr/src/rtpengine/recording-daemon/

make

cp rtpengine-recording /usr/local/bin/

nano /etc/systemd/system/rtpengine-recording.service

 

[Unit]

Description=NGCP RtpEngine - RTP Recording Daemon

Wants=network-online.target

After=network-online.target

 

[Service]

Type=forking

Environment=CFGFILE=/etc/rtpengine-recording.conf

EnvironmentFile=/etc/sysconfig/rtpengine-recording

PIDFile=/var/run/rtpengine-recording.pid

ExecStart=/usr/local/bin/rtpengine-recording --config-file=${CFGFILE} --pidfile=/var/run/rtpengine-recording.pid

Restart=on-failure

 

[Install]

WantedBy=multi-user.target

 

systemctl enable rtpengine-recording

nano /etc/rtpengine-recording.conf

 

[rtpengine-recording]

table = 0

output-format = wav

spool-dir = /var/spool/rtpengine

output-dir = /tmp

resample-to = 8000

output-mixed = true

output-single = false

 

nano /etc/sysconfig/rtpengine-recording

 

SET_USER=root

SET_GROUP=root

 

kamailio -c /etc/kamailio/kamailio.cfg

systemctl start kamailio

nano /var/log/kamailio.log

kamailio -V

version: kamailio 5.8.2 (x86_64/linux) 3fa5f4

 

Vota el Articulo: 

Sin votos (todavía)
Evalúa la calidad del articulo

2 comentarios

Compilacion RTPEngine

En mi instalación de prueba me faltaron dos pasos para compilar el módulo de kernel del RTPEngine

1. El paquete dwarves (dnf install dwarves)

2. El path para vmlinux (ln -sf /sys/kernel/btf/vmlinux /usr/lib/modules/`uname -r`/build/)

Suscribirse a Comentarios de "Instalación de Kamailio 5.8 y RTPEngine en Amazon EC2 – Rocky Linux 9" Suscribirse a VozToVoice - Todos los comentarios