CentOS7下安装caffe(包括ffmpeg\boost\opencv)
因为有项目想采用深度学习,而caffe是深度学习框架中比较理想的一款,并且跨平台,以及可以采用python/matlab的方式进行调用等优势,所以想在服务器上安装,下面就开始了血泪史。。。
服务器是阿里云的centos7.3,安装caffe,需要安装ffmpeg,boost,opencv等等。本文依照ffmpeg3.3.2 版,boost为1.64版,opencv为2.4.13.2,caffe的版本为最新版为例来说。
本文主要采用自行编译安装各大软件。
首先安装一些依赖包
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel SDL* yasm* python-devel nasm* cmake* git ncurses* *freetype2*
需要提一下,如果将来要采用python调用caffe的话,必须将numpy提前装好,最新的版本为1.13.2, ipython安装5.0版本(python2.7下)
安装Numpy 1.13.2 以及ipython
pip install numpy
pip install pandas
pip install ipython==5.0
ok,装好就可以往下继续安装其他的的包了,先安装ffmpeg
1、安装x264编码器
因为最新版的x264进行编译的时候要求asm的版本较高,此处分享链接
mkdir build
cd build
wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20120718-2245-stable.tar.bz2
tar -jxf x264-snapshot-20120718-2245-stable.tar.bz2 cd x264-snapshot-20120718-2245-stable/
./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/ffmpeg/bin" --enable-static --enable-shared --enable-pic
make
make install
2、安装x265编码器
cd build
git clone https://github.com/videolan/x265.git
cd x265/build/linux
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local/ffmpeg/" -DENABLE_SHARED:bool=off ../../source
make
make install
3、安装libfdk_acc
git clone --depth git://git.code.sf.net/p/opencore-amr/fdk-aac
cd fdk-aac
autoreconf -fiv
./configure --prefix="/usr/local/ffmpeg" --enable-shared --enable-static --with-pic make
make install
4、安装libmp3lame
wget http://iweb.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar zxf lame-3.99..tar.gz
cd lame-3.99.
./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin" --enable-shared --enable-nasm --enable-static --with-pic
make
make install
5、安装libopus
git clone git://git.opus-codec.org/opus.git
cd opus
3 ./autogen.sh
./configure --prefix="/usr/local/ffmpeg" --enable-shared --enable-static --with-pic
make
make install
6、安装libogg库
curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz
tar xzvf libogg-1.3..tar.gz
cd libogg-1.3.
./configure --prefix="/usr/local/ffmpeg" --enable-shared --enable-static --with-pic
make
make install
7、安装libvorbis库
curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz
tar xzvf libvorbis-1.3..tar.gz
cd libvorbis-1.3.
LDFLAGS="-L/usr/local/ffmpeg/lib"
CPPFLAGS="-I/usr/local/ffmpeg/include"
./configure --prefix="/usr/local/ffmpeg" --with-ogg="/usr/local/ffmpeg" --enable-shared --enable-static --with-pic
make
make install
8、安装libvps库
git clone --depth http://git.chromium.org/webm/libvpx.git
cd libvpx
./configure --prefix="/usr/local/ffmpeg" --enable-examples --enable-shared --enable-static --enable-pic
make
make install
9、编译安装ffmpeg
此处我才用的是2.8.12的代码,需要编辑ffplay.c,加上头文件<SDL/SDL_version.h>
修改 /etc/ld.so.conf 添加/usr/local/ffmpeg/lib
git clone --depth git://source.ffmpeg.org/ffmpeg
cd ffmpeg
export PKG_CONFIG_PATH=/usr/local/ffmpeg/lib/pkgconfig/:/usr/lib64/pkgconfig/:/usr/share/pkgconfig/$PKG_CONFIG_PATH
./configure --prefix="/usr/local/ffmpeg" --extra-cflags="-I/usr/local/ffmpeg/include" --extra-ldflags="-L/usr/local/ffmpeg/lib" --bindir="/usr/local/bin" --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-avresample --enable-pic --enable-static --enable-shared
make
make install
10、编译安装boost
wget https://dl.bintray.com/boostorg/release/1.64.0/source/boost_1_64_0.tar.gz
tar -zxf boost_1_64_0.tar.gz
cd boost_1_64_0
./boostrap.sh
./b2 install
11、再次安装一些依赖包
yum install a52dec* giflib* imlib* lame* libICE* libXdmcp* *dc1394* *raw1394* *avc1394* *raw1394*
yum groupinstall "Development Tools"
yum install openssl* sqlite* gtk* *java* gstreamer* *v4l* gmp* gimp* *java* libpng*
12、安装opencv2.4.13.2
ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h
echo "/usr/local/ffmpeg/lib" >> /etc/ld.so.conf
ldconfig
export C_INCLUDE_PATH=/usr/local/ffmpeg/include/:/usr/include/:$C_INCLUDE_PATH
export CPLUS_INCLUDE_PATH=/usr/local/ffmpeg/include/:/usr/include/:$CPLUS_INCLUDE_PATH
export LD_LIBRARY_PATH=/usr/local/ffmpeg/lib/:/usr/loca/lib/:/usr/lib/:$LD_LIBRARY_PATH
wget https://github.com/opencv/opencv/archive/2.4.13.2.zip
unzip 2.4.13.2.zip
cd opencv-2.4.13.2/
mkdir build
cmake –D CMAKE_BUILD_TYPE=RELEASE–D CMAKE_INSTALL_PREFIX=./build/ ../opencv-2.4.13.2
make
make install
13、再次安装依赖包
yum install protobuf* leveldb* snappy* hdf5* lmdb* libunwind*
wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/google-glog/glog-0.3.3.tar.gz
tar -zxf glog-0.3..tar.gz
cd glog-0.3./
./configure --enable-static --enable-shared --with-pic
make
make install
wget https://github.com/schuhschuh/gflags/archive/master.zip
unzip master.zip
cd gflags-master/
mkdir build && cd build
export CXXFLAGS="-fPIC" && cmake .. && make VERBOSE=
make
14、安装BLAS,CBLAS,OpenBLAS
wget http://www.netlib.org/blas/blas-3.7.1.tgz
tar -zxf blas-3.7..tgz
cd BLAS-3.7./
gfortran -c -O3 *.f
ar rv libblas.a *.o
wget http://www.netlib.org/blas/blast-forum/cblas.tgz
tar -zxf cblas.tgz
cd CBLAS/
cp Makefile.LINUX Makefile.in
cp ../BLAS-3.7./libblas.a testing/
cp lib/cblas_LINUX.a /usr/local/lib/libcblas.a
cp testing/libblas.a /usr/local/lib/libblas.a
cp include/cblas.h /usr/local/include/
wget http://github.com/xianyi/OpenBLAS/archive/v0.2.19.tar.gz
tar -zxf v0.2.19.tar.gz
cd OpenBLAS-0.2./
make
make PREFIX=/usr/local install
git clone https://github.com/BVLC/caffe.git
cd caffe
cp Makefile.config.example Makefile.config
15、编辑Makefile.config
CPU_ONLY := # CUDA_DIR := /usr/local/cuda
# On Ubuntu 14.04, if cuda tools are installed via
# "sudo apt-get install nvidia-cuda-toolkit" then use this instead:
# CUDA_DIR := /usr # CUDA architecture setting: going with all of them.
# For CUDA < 6.0, comment the *_50 through *_61 lines for compatibility.
# For CUDA < 8.0, comment the *_60 and *_61 lines for compatibility.
#CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
# -gencode arch=compute_20,code=sm_21 \
# -gencode arch=compute_30,code=sm_30 \
# -gencode arch=compute_35,code=sm_35 \
# -gencode arch=compute_50,code=sm_50 \
# -gencode arch=compute_52,code=sm_52 \
# -gencode arch=compute_60,code=sm_60 \
# -gencode arch=compute_61,code=sm_61 \
# -gencode arch=compute_61,code=compute_61 BLAS := open
# Custom (MKL/ATLAS/OpenBLAS) include and lib directories.
# Leave commented to accept the defaults for your choice of BLAS
# (which should work)!
BLAS_INCLUDE := /usr/local/include
BLAS_LIB := /usr/local/lib
16、安装caffe
cd python
for req in $(cat requirements.txt); do pip install $req; done
cd ..
make all
make test
make runtest
make pycaffe
cp -r python/caffe/ /usr/lib64/python2./site-packages/
echo "/root/build/caffe/.build_release/lib" >> /etc/ld.so.conf
pip uninstall numpy
wget https://pypi.python.org/packages/1a/5c/57c6920bf4a1b1c11645b625e5483d778cedb3823ba21a017112730f0a12/numpy-1.11.0.tar.gz#md5=bc56fb9fc2895aa4961802ffbdb31d0b
tar -zxf numpy-1.11..tar.gz
cd numpy-1.11.
python setup.py build
python setup.py install
CentOS7下安装caffe(包括ffmpeg\boost\opencv)的更多相关文章
- docker(一) Centos7下安装docker
docker(一) Centos7下安装dockerdocker(二) windows10下安装dockerdocker(三) 镜像和容器常用命令 docker(四) 使用Dockerfile构建镜像 ...
- centos7 下 安装部署nginx
centos7 下 安装部署nginx 1.nginx安装依赖于三个包,注意安装顺序 a.SSL功能需要openssl库,直接通过yum安装: #yum install openssl b.gzip模 ...
- CentOS7 下安装 iSCSI Target(tgt) ,使用 Ceph rbd
目录 一.iSCSI 介绍 1. iSCSI 定义 2. 几种常见的 iSCSI Target 3. 优缺点比较 二.安装步骤 1. 关闭防火墙 2. 关闭selinux 3. 通过 yum 安装 t ...
- Centos7下安装Seafile实现私有网盘
Seafile是一个开源.专业.可靠的云存储平台:解决文件集中存储.共享和跨平台访问等问题,由北京海文互知网络有限公司开发,发布于2012年10月:除了一般网盘所提供的云存储以及共享功能外,Seafi ...
- Windows和Linux(Centos7)下安装Nginx
安装Nginx 这篇记录只不过做了一个简单总结,如果对这块没什么概念的话可以看一下知乎的这篇文章 https://zhuanlan.zhihu.com/p/83890573 window下安装 win ...
- CentOS7 下 安装 supervisor以及使用
CentOS7 下 安装 supervisor 以及使用 手动安装 [注] linux环境必须安装 python 1.获取supervisor包:[https://pypi.python.org/py ...
- Linux CentOs7 下安装 redis
Linux CentOs7 下安装 redis 请将以下命令放入linux命令行中运行 如果安装过程前没有安装GCC请先安装 命令如下 $ yum install gcc-c++ $ wget ht ...
- Centos7下安装配置Redsocks
Redsocks是一个开源的网络程序,代码依赖开源的libevent网络库.Redsocks允许你将所有TCP连接重定向到SOCKS或HTTPS代理,比如Shadowsocks(Centos7下安装配 ...
- CentOS7下安装SVN服务端
CentOS7下安装SVN服务 1. yum命令即可方便的完成安装# sudo yum install subversion 测试安装是否成功:# svnserve --version 更改svn的默 ...
随机推荐
- WebSocket集成XMPP网页即时通讯3:二进制文件收发
WebSocket支持二进制的发送,见jetty官网: http://www.eclipse.org/jetty/documentation/current/jetty-websocket-api-s ...
- switch...case... 语句中的类型转换
switch语句对case表达式的结果类型有如下要求: 要求case表达式的结果能转换为switch表示式结果的类型 并且如果switch或case表达式的是无类型的常量时,会被自动转换为此种常量的默 ...
- tkinter的grid布局中合并单元格
rowspan 合并多行,比如:Label(root,text="table",width=10,height=2,),grid(row=0,column=0,rowspan=2 ...
- [Umbraco] Data Types介绍
Data Types是在建立document type时需要用到的,系统自带了很多用于开发的类型,如常用的下拉列表dropdown, textbox, radiobox, checkbox以及上传,h ...
- 课程一(Neural Networks and Deep Learning),第四周(Deep Neural Networks)—— 1.Practice Questions: Key concepts on Deep Neural Networks
[解释] [解释] 比如算法中的learing rateα(学习率).iterations(梯度下降法循环的数量).L(隐藏层数目).n[l] (隐藏层单元数目).choice of activati ...
- 微信web开发者工具、破解文件、开发文档和开发Demo下载
关注,QQ群,微信应用号社区 511389428 下载: Win: https://pan.baidu.com/s/1bHJGEa Mac: https://pan.baidu.com/s/1slhD ...
- iOS Round Double value to 2 decimal digits and round 3rd decimal digit up
I have I double value like this one 17.125. It should be rounded up to 17.13 If I use the simple met ...
- Vue笔记:webpack项目vue启动流程
VUE启动流程 1. package.json 在执行npm run dev的时候,会在当前目录中寻找 package.json 文件, 有点类似 Maven 的 pom.xml 文件,包含项目的名称 ...
- redis集群报Jedis does not support password protected Redis Cluster configurations异常解决办法
解决spring-data-redis操作redis集群报“Jedis does not support password protected Redis Cluster configurations ...
- 记一次解决CSS定位bug思路
事因 网站中的遮罩层大都有一个问题,就是在这个遮罩层中滑动,里面的内容也会跟着滑动,我是这样想的,既然都有这个问题,干脆写一个通用的插件出来,省的每个还得单独处理.如果是单独处理这个问题是比较好解决的 ...