Bootstrap

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 libmicrohttpd-devel -y # http模块依赖
dnf install expat-devel -y # opensips xml模块依赖
dnf install net-snmp-devel -y # snmpstats模块依赖 用途:统计信息,适用于监控和管理
dnf install openldap-devel -y
dnf install mysql-devel -y  # 数据库选择mysql时安装
dnf install librdkafka librdkafka-devel -y # event_kafka 
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 #sqlite数据库使用
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
dnf install pandoc -y
dnf install json-c-devel -y #json-c 与下边的编译安装二选一
yum install gperftools-devel -y  # gperftools/profiler.h报错时安装

# 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模块
git clone https://github.com/maxmind/libmaxminddb.git
cd libmaxminddb
git submodule update --init --recursive
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++ 的源码  先安装opensips  如果不报错  这一步可以不操作
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  # 会弹出来选项窗口 选择第二个 默认安装
# 第一个 编译配置
# 1.阅读:[https://blog.csdn.net/weixin_44213550/article/details/145294032](https://blog.csdn.net/weixin_44213550/article/details/145294032)
# 2. 阅读:[https://blog.csdn.net/weixin_44213550/article/details/145293955]
(https://blog.csdn.net/weixin_44213550/article/details/145293955)
……
#第二个  安装
#第三个  清空脚本
#第四个  模式

#第五个  退出

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

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

;