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的默 ...
随机推荐
- iOS开发-带Placeholder的UITextView实现
iOS中UITextField带有PlaceHolder属性,可以方便用于提示输入.但是同样可以进行文本输入的UITextView控件则没有PlaceHolder属性,还是有些不方便的,尤其是对于略带 ...
- 【xsy2504】farm 容斥原理
题目大意:给你三个数$n,m,s$,满足$n,m,s≤10^{18}$且最大质因数均不大于$10^6$. 问你存在多少个整数$k$,满足$0≤k≤m$,且$(k,0)$,$(0,n)$,$(x,y)$ ...
- POJ 2578
#include<iostream> #include<stdio.h> #include<vector> using namespace std; int mai ...
- (转)Linux 系统监控、诊断工具之 top命令详解
原文:https://www.linuxidc.com/Linux/2014-12/110563.htm 目录 (1)系统.任务统计信息:(2)进程. cpu 统计信息:(3)最后两行为内存信息:3. ...
- Bash算术运算
使用let命令 let let let let let let let 使用expr命令 - ` # + ` # \* ` # / ` # / ` # − \* ` # +` # + -*· # -* ...
- apt 下载安装包
1) Try both without sudo, apt-get download will pass and apt-get -d install will fail (root required ...
- js获取客户端ip地址
<script type="text/javascript" src="http://www.coding123.net/getip.ashx?js=1" ...
- “声讨”高云的《jQuery技术内幕》
1. 前言: 其实本文有点太标题党了,哈哈,见谅.说“声讨”,就是说说我作为一个<jQuery技术内幕>一个忠实读者,读本书的一些想法和建议. 2014年2月20日,我收到了<jQu ...
- 24-hadoop-hiveserver2&jdbc-正则数据导入
hive 可以 类似jdbc链接, 但启动的必须是hiveserver2, 才可以使用 hiveserver2 默认监听 10000 端口 1, 启动: nohup $HIVE_HOME/bin/hi ...
- SpringBoot入门 (十二) 定时任务
本文记录在SpringBoot中使用定时任务. 在我们的项目中,经常需要用到定时任务去帮我们做一些事情,比如服务状态监控,业务数据状态的更改等,SpringBoot中实现定时任务有2中方案,一种是自带 ...