Advertisement
load-net

kamailio + postgress install

May 22nd, 2023 (edited)
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.78 KB | None | 0 0
  1. ########################## install rtpengine #######################################
  2. timedatectl set-timezone Asia/Yekaterinburg
  3. apt-get update && apt-get upgrade
  4. dpkg-reconfigure tzdata
  5. mcedit /etc/default/locale
  6. # File generated by update-locale
  7. LANG=ru_RU.UTF-8
  8. dpkg-reconfigure locales
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15. apt-get remove --auto-remove nftables -y
  16. apt-get purge nftables -y
  17. apt-get update
  18. apt-get install iptables iptables-persistent -y
  19. iptables -L -v
  20. cd /usr/src/
  21. apt-get autoremove -y
  22. apt-get update && apt-get dist-upgrade -y --allow-unauthenticated --allow-downgrades --allow-remove-essential --allow-change-held-packages gnupg gnupg2 git mc
  23. git clone https://github.com/sipwise/rtpengine.git
  24. cd /usr/src/rtpengine
  25. apt install -y dpkg-dev
  26. dpkg-checkbuilddeps
  27. apt install -y debhelper-compat default-libmysqlclient-dev gperf libavcodec-dev libavfilter-dev libavformat-dev libavutil-dev libbcg729-dev libbencode-perl libcrypt-openssl-rsa-perl libcrypt-rijndael-perl libcurl4-openssl-dev libdigest-crc-perl libdigest-hmac-perl libevent-dev libglib2.0-dev libhiredis-dev libio-multiplex-perl libio-socket-inet6-perl libiptc-dev libjson-glib-dev libjson-perl libmosquitto-dev libnet-interface-perl libpcap0.8-dev libpcre3-dev libsocket6-perl libspandsp-dev libssl-dev libswresample-dev libsystemd-dev libwebsockets-dev libxmlrpc-core-c3-dev libxtables-dev markdown python3-websockets zlib1g-dev dh-sequence-dkms libopus-dev libtest2-suite-perl pandoc
  28. dpkg-buildpackage -d
  29. cd /usr/src/
  30. dpkg -i *.deb
  31. apt --fix-broken install -y
  32.  
  33. service ngcp-rtpengine-daemon enable
  34. service ngcp-rtpengine-daemon stop
  35. service ngcp-rtpengine-daemon start
  36. service ngcp-rtpengine-daemon status
  37.  
  38.  
  39.  
  40. sudo modprobe xt_multiport
  41.  
  42. echo net.ipv4.ip_nonlocal_bind=1 >> /etc/sysctl.conf
  43. sysctl -p
  44.  
  45. service ngcp-rtpengine-daemon stop
  46. service ngcp-rtpengine-daemon start
  47. service ngcp-rtpengine-daemon status
  48.  
  49. ps -ax | grep rtp
  50.  
  51. rtpengine-ng-client ping
  52.  
  53. echo 'add 0' > /proc/rtpengine/control
  54. iptables -I INPUT -p udp -j RTPENGINE --id 0
  55. ip6tables -I INPUT -p udp -j RTPENGINE --id 0
  56.  
  57. netfilter-persistent save
  58.  
  59. iptables -nvL --line-number
  60.  
  61. ########################## rtpengine #######################################
  62.  
  63.  
  64. ##################### install kamailio ##########################################
  65. cd /usr/src/
  66.  
  67. apt-get install -y libpq-dev pkg-config build-essential bison make libperl-dev git linux-headers-$(uname -r) libunistring-dev flex libjson-c-dev libevent-dev gcc g++ autoconf pkg-config libssl-dev libcurl4-openssl-dev libxml2-dev libpcre3-dev
  68.  
  69. git clone --depth 1 --no-single-branch https://github.com/kamailio/kamailio kamailio
  70. cd kamailio
  71.  
  72. make include_modules="db_postgres" cfg
  73.  
  74. make all
  75. make install
  76.  
  77. make install-initd-debian
  78. /etc/init.d/kamailio start
  79. /etc/init.d/kamailio stop
  80.  
  81. make install-systemd-debian
  82. systemctl start kamailio
  83. systemctl stop kamailio
  84.  
  85. /usr/local/sbin/kamailio -P /var/run/kamailio/kamailio.pid -m 128 -M 12
  86.  
  87. systemctl daemon-reload
  88.  
  89.  
  90.  
  91. ############################# по дебиановски ##################################
  92. apt install -y kamailio kamailio-postgres-modules
  93. ############################# end install #######################################
  94. apt install -y kamailio kamailio-mysql-modules
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125. ####################################################################################################################################
  126.  
  127. groupadd -g 6001 kamailio
  128. useradd -u 6001 -g 6001 -d /usr/local/kamailio -M -s /bin/false kamailio
  129.  
  130. #####################################################################################################
  131.  
  132. cat >/etc/default/kamailio <<EOT
  133.  
  134. cat >/etc/default/kamailio <<EOT
  135. RUN_KAMAILIO=yes
  136. USER=kamailio
  137. GROUP=kamailio
  138. SHM_MEMORY=64
  139. PKG_MEMORY=8
  140.  
  141. # Config file
  142. CFGFILE=/etc/kamailio/kamailio.cfg
  143.  
  144. #DUMP_CORE=yes
  145. EOT
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152. ######################################################################################################
  153.  
  154. cat >/etc/systemd/system/kamailio.service<<EOT
  155. [Unit]
  156. Description=Kamailio (OpenSER) - the Open Source SIP Server
  157. Documentation=man:kamailio(8)
  158. Wants=network-online.target
  159. After=network-online.target
  160.  
  161. [Service]
  162. Type=forking
  163. User=kamailio
  164. Group=kamailio
  165. Environment='CFGFILE=/etc/kamailio/kamailio.cfg'
  166. Environment='SHM_MEMORY=64'
  167. Environment='PKG_MEMORY=8'
  168. EnvironmentFile=-/etc/default/kamailio
  169. EnvironmentFile=-/etc/default/kamailio.d/*
  170. # PIDFile requires a full absolute path
  171. PIDFile=/run/kamailio/kamailio.pid
  172. # ExecStart requires a full absolute path
  173. ExecStart=/usr/sbin/kamailio -P /run/kamailio/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
  174. Restart=on-failure
  175. # /run/kamailio in tmpfs
  176. RuntimeDirectory=kamailio
  177. RuntimeDirectoryMode=0770
  178.  
  179. [Install]
  180. WantedBy=multi-user.target
  181.  
  182. EOT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement