Skip to main content
RocksDB provides comprehensive support for Linux distributions, with optimized builds for various package managers and architectures.

Prerequisites

Compiler Requirements

RocksDB requires a modern C++ compiler with C++20 support:
  • GCC: Version 11 or higher
  • Clang: Version 10 or higher
While RocksDB can compile without any dependencies, installing compression libraries significantly improves performance:
  • zlib: General-purpose compression
  • bzip2: High compression ratio
  • lz4: Extremely fast compression
  • snappy: Fast compression optimized for speed
  • zstandard: Fast real-time compression algorithm
Optional dependencies:
  • gflags: Required for command-line tools
  • clang-format: Required for code formatting checks

Ubuntu / Debian

1

Update compiler

Ensure you have GCC 11 or higher:
sudo apt-get update
sudo apt-get install build-essential
gcc --version  # Should show 11 or higher
2

Install dependencies

Install compression libraries and tools:
sudo apt-get install libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev
3

Clone repository

git clone https://github.com/facebook/rocksdb.git
cd rocksdb
4

Build RocksDB

make static_lib
Don’t use make or make all for production builds. These compile in debug mode, which is significantly slower than release mode.
5

Run tests (optional)

make check

CentOS / RHEL / Fedora

1

Update compiler

Ensure you have GCC 11 or higher:
sudo yum install gcc gcc-c++
gcc --version  # Should show 11 or higher
2

Install gflags from source

git clone https://github.com/gflags/gflags.git
cd gflags
git checkout v2.2.0
./configure && make && sudo make install
cd ..
After installation, add the include and library paths:
export CPATH=/usr/local/include:$CPATH
export LIBRARY_PATH=/usr/local/lib:$LIBRARY_PATH
3

Install compression libraries

sudo yum install snappy snappy-devel
sudo yum install zlib zlib-devel
sudo yum install bzip2 bzip2-devel
sudo yum install lz4-devel
sudo yum install libzstd-devel
4

Clone and build

git clone https://github.com/facebook/rocksdb.git
cd rocksdb
make static_lib

Installing zstandard on older systems

If zstandard is not available through your package manager:
sudo yum install epel-release
sudo yum install libzstd-devel

Build Options

Portable Build

By default, RocksDB optimizes for your specific CPU (-march=native). To build a binary compatible with different architectures:
PORTABLE=1 make static_lib
For a reasonable compromise between optimization and compatibility on x86_64:
PORTABLE=haswell make static_lib
This supports most processors made since 2013 while maintaining good performance.

Debug vs Release

Production builds: Always use make static_lib or make shared_lib (release mode).Development builds: Use make all or make check (debug mode).

Verification

Verify your installation:
# Check library was built
ls -lh librocksdb.a

# Run a simple test
make check

Next Steps

Getting Started

Learn the basics of using RocksDB

API Reference

Explore the complete API documentation

Build docs developers (and LLMs) love