1.安装相关依赖软件
sudo apt-get install build-essential sudo apt-get install libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev
2.下载源码
git clone https://github.com/facebook/rocksdb.git
cd rocksdb
切换至分支2.8f git checkout 2.8.fb
3.编译源码,后续步骤均在rocksdb文件夹下进行
make shared_lib
4.修改环境变量,头文件库和链接库以及路径(直接在终端命令输入即可)
export CPLUS_INCLUDE_PATH=`pwd`/include export LD_LIBRARY_PATH=`pwd` export LIBRARY_PATH=`pwd`
5.执行如下命令,解决后续步骤中遇到的Fatal error: rocksdb/slice.h: No such file or directory问题
sudo cp librocksdb.so /usr/local/lib sudo mkdir -p /usr/local/include/rocksdb/ sudo cp -r ./include/* /usr/local/include/
6.安装pyrocksdb,在rocksdb文件夹下进行
apt-get install python-virtualenv python-dev virtualenv pyrocks_test cd pyrocks_test .bin/active pip install "Cython>=0.20" pip install git+git://github.com/stephan-hof/pyrocksdb.git@v0.2.1
执行命令,
python >>import rocksdb #不报错,则说明客户端安装成功
参考:rocksdb安装