linux下安装mongodb驱动
2020-09-24 本文已影响0人
草丛里的黄盖
本文章仅作为个人笔记
解压下载的相关文件
相关工具安装
yum install perl-core perl pcre-devel zlib zlib-devel cyrus-sasl cyrus-sasl-devel libtemplate-perl -y
openssl安装
tar -zxvf OpenSSL_1_0_2p.tar.gz
cd openssl-1.0.2p
./config enable-shared
make
make install
添加环境变量
export OPENSSL_ROOT_DIR=/usr/local/ssl
export OPENSSL_CRYPTO_LIBRARY=/usr/local/ssl/lib
export OPENSSL_INCLUDE_DIR=/usr/local/ssl/include
source /etc/profile
libbson安装
tar -zxvf libbson-1.9.5.tar.gz
cd libbson-1.9.5
mkdir cmake_build
cd cmake_build
cmake -fPIC .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/mongodb/libbson
make
make install
mongo-c-driver安装
tar -zxvf mongo-c-driver-1.17.0.tar.gz
cd mongo-c-driver-1.17.0
mkdir cmake_build
cd cmake_build
cmake -fPIC .. -DCMAKE_BUILD_TYPE=Release -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF -DCMAKE_PREFIX_PATH=/home/mongodb/libbson -DCMAKE_INSTALL_PREFIX=/home/mongodb/mongo-c-driver
make
make install
mongo-cxx-driver安装
tar -zxvf mongo-cxx-driver-r3.6.0.tar.gz
cd mongo-cxx-driver-r3.6.0
cd build
cmake -fPIC .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_AND_STATIC_LIBS=ON -DCMAKE_PREFIX_PATH=/home/mongodb/mongo-c-driver -DCMAKE_INSTALL_PREFIX=/home/mongodb/mongo-cxx-driver
make
make install
添加环境变量
export libbsoncxx_DIR=/home/mongodb/mongo-cxx-driver/lib64/cmake/libbsoncxx-3.6.0
export libmongocxx_DIR=/home/mongodb/mongo-cxx-driver/lib64/cmake/libmongocxx-3.6.0
export LIBBSONCXX_LIBRARIES=/home/mongodb/mongo-cxx-driver/lib64
export LIBMONGOCXX_LIBRARIES=/home/mongodb/mongo-cxx-driver/lib64