1. #General dependencies
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
2. #install ATLAS
sudo apt-get install libatlas-base-dev
2. sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
3. sudo apt-get install git
4. git clone https://github.com/BVLC/caffe.git
5. cp Makefile.config.example Makefile.config
6. for cold-brewed CPU-only Caffe uncomment the CPU_ONLY := 1 flag in Makefile.config
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
LIBRARY_DIRS := $(PYTHON_LIB) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/hdf5/serial
refer to: http://blog.youkuaiyun.com/md_learning/article/details/53185992
7. sudo make all
sudo make test
sudo make runtest
Ps. Ubuntu 14 or 16 may be better.