Skip to content

Instantly share code, notes, and snippets.

@dustismo
Last active July 22, 2024 18:51
Show Gist options
  • Save dustismo/6203329 to your computer and use it in GitHub Desktop.
Save dustismo/6203329 to your computer and use it in GitHub Desktop.
How to install leveldb on ubuntu
sudo apt-get install libsnappy-dev
wget https://leveldb.googlecode.com/files/leveldb-1.9.0.tar.gz
tar -xzf leveldb-1.9.0.tar.gz
cd leveldb-1.9.0
make
sudo mv libleveldb.* /usr/local/lib
cd include
sudo cp -R leveldb /usr/local/include
sudo ldconfig
@swapnildavangave
Copy link

worked like a charm

@VladimirCores
Copy link

@aerozoic same problem for me

@nextkitt
Copy link

nextkitt commented Nov 1, 2017

git clone https://github.com/google/leveldb.git
cd 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


man scp

 -r      Recursively copy entire directories.  Note that scp follows symbolic links encountered in the tree traversal.
$ cd leveldb
$ ls -l out-static/lib* out-shared/lib*
lrwxrwxrwx 1 root root     18 Nov  1 16:22 out-shared/libleveldb.so -> libleveldb.so.1.20
lrwxrwxrwx 1 root root     18 Nov  1 16:22 out-shared/libleveldb.so.1 -> libleveldb.so.1.20
-rwxrwxr-x 1 root root 375591 Nov  1 16:22 out-shared/libleveldb.so.1.20
-rw-rw-r-- 1 root root 696422 Nov  1 16:22 out-static/libleveldb.a
-rw-rw-r-- 1 root root  48750 Nov  1 16:22 out-static/libmemenv.a

$ sudo rm -f /usr/local/lib/libleveldb*
$ sudo scp -r out-static/lib* out-shared/lib* /usr/local/lib/


$ ls -l /usr/local/lib/libleveldb*
-rw-r--r-- 1 root root 695164 Nov  1 16:53 /usr/local/lib/libleveldb.a
lrwxrwxrwx 1 root root     18 Nov  1 16:55 /usr/local/lib/libleveldb.so -> libleveldb.so.1.20
lrwxrwxrwx 1 root root     18 Nov  1 16:55 /usr/local/lib/libleveldb.so.1 -> libleveldb.so.1.20
-rwxr-xr-x 1 root root 418437 Nov  1 16:53 /usr/local/lib/libleveldb.so.1.20

@xiaoniu-578fa6bff964d005
Copy link

xiaoniu-578fa6bff964d005 commented Jan 2, 2018

@nextkitt, your solution works for me. Thanks!

@wbolster
Copy link

wbolster commented Jan 4, 2018

thanks, i am using something like this for plyvel (python leveldb lib) builds on travis-ci now!

https://github.com/wbolster/plyvel

@pmgexpo17
Copy link

@nextkitt, thanks for your solution

@madiha95
Copy link

madiha95 commented Apr 6, 2018

Actually when you clone leveldb , there is no more a makefile, so the steps are true @nextkitt but need to add some commands to generate the makefile first !

@Remonell
Copy link

Remonell commented Aug 8, 2018

@madiha95 Did you create one yet? I have no idea of this subject.

@ssbg2
Copy link

ssbg2 commented Jan 10, 2019

git clone https://github.com/google/leveldb.git
cd 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

man scp

 -r      Recursively copy entire directories.  Note that scp follows symbolic links encountered in the tree traversal.
$ cd leveldb
$ ls -l out-static/lib* out-shared/lib*
lrwxrwxrwx 1 root root     18 Nov  1 16:22 out-shared/libleveldb.so -> libleveldb.so.1.20
lrwxrwxrwx 1 root root     18 Nov  1 16:22 out-shared/libleveldb.so.1 -> libleveldb.so.1.20
-rwxrwxr-x 1 root root 375591 Nov  1 16:22 out-shared/libleveldb.so.1.20
-rw-rw-r-- 1 root root 696422 Nov  1 16:22 out-static/libleveldb.a
-rw-rw-r-- 1 root root  48750 Nov  1 16:22 out-static/libmemenv.a

$ sudo rm -f /usr/local/lib/libleveldb*
$ sudo scp -r out-static/lib* out-shared/lib* /usr/local/lib/


$ ls -l /usr/local/lib/libleveldb*
-rw-r--r-- 1 root root 695164 Nov  1 16:53 /usr/local/lib/libleveldb.a
lrwxrwxrwx 1 root root     18 Nov  1 16:55 /usr/local/lib/libleveldb.so -> libleveldb.so.1.20
lrwxrwxrwx 1 root root     18 Nov  1 16:55 /usr/local/lib/libleveldb.so.1 -> libleveldb.so.1.20
-rwxr-xr-x 1 root root 418437 Nov  1 16:53 /usr/local/lib/libleveldb.so.1.20

thanks for your help!

@pieman64
Copy link

Actually when you clone leveldb , there is no more a makefile, so the steps are true @nextkitt but need to add some commands to generate the makefile first !

What commands are required to generate the (missing) makefile?

@phananh1010
Copy link

you can install leveldb on ubuntu using libleveldb-dev instead. Work for me:
sudo apt-get install libleveldb-dev

@Kolomiits
Copy link

sudo apt-get install python3-pip python3-dev && python3 -m pip install -U leveldb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment