Steps followed on Ubuntu Server 16.04, CPU-only install, with pycaffe.
sudo apt install build-essential python-dev python-pip libprotobuf-dev libleveldb-dev\
libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler libhdf5-dev libgflags-dev\
libgoogle-glog-dev liblmdb-dev libatlas-base-dev