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

时间:2025-01-22 12:27:29
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 #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 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++ 的源码 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 # make install DESTDIR=/usr/local/opensips