自学内容网 自学内容网

centos9编译安装opensips 二【进阶篇-定制目录+模块】

环境:centos9 last

opensips -V
version: opensips 3.6.0-dev (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, DBG_MALLOC, CC_O0, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
git revision: b113db6de
main.c compiled on 13:39:41 Jan 21 2025 with cc 11

opensips模块dialplan,regex,json

dnf update -y
dnf groupinstall "Development Tools" -y
dnf install epel-release -y
dnf install expat-devel # opensips xml模块需要
dnf install net-snmp-devel # snmpstats模块需要  提供 SNMP(Simple Network Management Protocol)统计信息,适用于监控和管理
dnf install openldap-devel -y
dnf install -y lynx
dnf install -y git wget curl 
dnf install -y ncurses-devel 
dnf install -y libxml2-devel 
dnf install -y libpcap-devel libuuid-devel 
dnf install -y libcurl-devel 
dnf install -y sqlite-devel 
dnf install -y pcre-devel 
dnf install -y bzip2-devel 
dnf install -y flex bison 
dnf install -y perl 
dnf install -y openssl-devel 
dnf install -y libevent-devel 
dnf install -y automake 
dnf install -y libtool 
dnf install -y postgresql-devel 
dnf install -y zlib-devel 
dnf install -y cmake 

ls /usr/include/ncurses.h
ls /usr/include/curses.h
ls /usr/lib64/libncurses.so

export CFLAGS="-I/usr/include/ncurses"
export LDFLAGS="-L/usr/lib64 -lncurses"
#mmgeoip模块
https://github.com/maxmind/libmaxminddb.git
git submodule update --init --recursive
dnf install pandoc
mkdir build
cd build 
cmake ..
make
make install 
#json模块
git clone https://github.com/json-c/json-c.git
cd json-c   
mkdir build
cd build
cmake ..
make
make install
ls /usr/local/include/json-c/
export CFLAGS="-I/usr/local/include/json-c"
export LDFLAGS="-L/usr/local/lib"

# ln -s /usr/local/include/json-c /usr/include/json-c  #不推荐
# ln -s /usr/local/lib/libjson-c.so /usr/lib64/libjson-c.so#不推荐


# 克隆 AWS SDK for C++ 的源码
git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp.git

cd aws-sdk-cpp

# 创建构建目录并进入
mkdir build
cd build

# 配置编译选项
### 从这里开始不推荐
# cmake3 .. -DCMAKE_BUILD_TYPE=Release \
#          -DCMAKE_INSTALL_PREFIX=/usr/local/aws-sdk-cpp \
#         -DBUILD_SHARED_LIBS=ON \
#          -DENABLE_UNITY_BUILD=ON \
#          -DENABLE_TESTING=OFF \
#          -DCUSTOM_MEMORY_MANAGEMENT=OFF
# ls /usr/local/aws-sdk-cpp/include/aws/core/Aws.h
# ls /usr/local/aws-sdk-cpp/lib

# export C_INCLUDE_PATH=/usr/local/aws-sdk-cpp/include:$C_INCLUDE_PATH
# export CPLUS_INCLUDE_PATH=/usr/local/aws-sdk-cpp/include:$CPLUS_INCLUDE_PATH
# export LIBRARY_PATH=/usr/local/aws-sdk-cpp/lib:$LIBRARY_PATH
# export LD_LIBRARY_PATH=/usr/local/aws-sdk-cpp/lib:$LD_LIBRARY_PATH
#######到这里结束了

cmake ..   # 推荐
# 开始编译
make -j$(nproc)

# 安装编译好的库
make install


cd ~
git clone https://github.com/OpenSIPS/opensips.git
cd opensips
make menuconfig  # 会弹出来选项窗口 选择第二个 默认安装
make all
make install

在这里插入图片描述
看到上图 标识安装成功
在这里插入图片描述
操作系统环境

操作系统下载地址 https://mirrors.aliyun.com/centos-stream/9-stream/BaseOS/x86_64/iso/?spm=a2c6h.25603864.0.0.8d45460dBKuGTE在这里插入代码片


原文地址:https://blog.csdn.net/weixin_44213550/article/details/145280980

免责声明:本站文章内容转载自网络资源,如侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!