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的默 ...
随机推荐
- [原创]K8飞刀20160613 Plesk密码 & 注册表16进制转换 & Html实体解密
K8飞刀 by K8拉登哥哥@[K8搞基大队]博客: http://qqhack8.blog.163.com 简介: K8飞刀是一款多功能的安全测试工具. Hacker Swiss Army Kni ...
- ajaxsubmit 上传文件 在IE中返回的内容 提示下载文件
在ajaxSubmit提交表单的时候,如果表单内有文件上传的话,会判断参数是否配置的iframe为false参数,如果没有,会用创建隐藏iframe方式提交表单,如果设定了iframe为false,则 ...
- Strom的trident小例子
上代码: public class TridentFunc { /** * 类似于普通的bolt */ public static class MyFunction extends BaseFunct ...
- (转) lsof 一切皆文件
原文:https://linuxtools-rst.readthedocs.io/zh_CN/latest/tool/lsof.html lsof(list open files)是一个查看当前系统文 ...
- Intellij添加Jetty远程Debug
步骤一: 步骤二: 步骤三:-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=15005 步骤四: 找到服务器上jetty的b ...
- 记一次cocos项目的加载速度优化
半个月前,我们用cosos creator做了一个简单的小游戏,也许算不上小游戏吧..一边学cocos,一边做,几经波折后终于上线了.然鹅,功能是实现了,但是加载速度十分感人(毕竟没经验嘛,无辜脸). ...
- Java语法糖之内部类
例1: class Outer { public void md1(final int a) { final int b = 1; class LocalA { int c = a; } class ...
- 【JAVA SPRING】IOC与AOP
IOC(注入)有三种类型: 构造函数注入: 属性注入: 接口注入: JAVA反射: JAVA反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法: 对于任意一个对象,都能够调用它的 ...
- 解压cpio.gz、zip类型文件
aix上的oracle介质文件是10gr2_aix5l64_database.cpio.gz 解压方法: gunzip 10gr2_aix5l64_database.cpio.gz cpio -idm ...
- java中数据的传递方式到底是怎样的!
今天早上我了一道有关java的题.主要考点是考java中值得传递方式. 之前我在javaoo里总结的是:基本数据类型中保存的是实际的值,引用数据类型保存的是被引用的内存地址,那么基本数据类型就是按值传 ...