(Last Updated On: September 10, 2018)

LevelDB is a fast key-value storage library written at Google that provides an ordered mapping from string keys to string values. The leveldb library provides a persistent key-value store. Keys and values are arbitrary byte arrays. The keys are ordered within the key-value store according to a user-specified comparator function. Prometheus LevelDB to store indexes

How to install LevelDB on Ubuntu 18.04 / Ubuntu 16.04

Install libsnappy compression/decompression library toolkit.

sudo apt-get install libsnappy-dev

Check LevelDB releases page to see the latest release of the application. Then define it by setting VER variable.

export VER="1.20"
wget https://github.com/google/leveldb/archive/v${VER}.tar.gz
tar xvf v${VER}.tar.gz
rm -f v${VER}.tar.gz

Change your working directory to leveldb.

cd leveldb-${VER}

Install LevelDB

make
sudo scp -r out-static/lib* out-shared/lib* "/usr/local/lib"
cd include
sudo scp -r leveldb /usr/local/include
sudo ldconfig

That’s all, you have LevelDB installed on your Ubuntu 18.04 / Ubuntu 16.04 server.

For Usage, check out LevelDB Library documentation.