Linux服务器无权限安装caffe教程
作者:贾金让
前言:服务器上没有root权限,不能使用sudo和apt-get无脑安装caffe需要的各种依赖,因此需要手动安装这些依赖库。核心就是将原来apt-get安装在/usr/include,/usr/lib等位置的库,手动安装在我们自己的路径下,即自定义路径安装依赖。
这些依赖由于版本,交叉依赖等问题,不小心的话会出现各种错误,比较经典的就是opencv和cuda9.0这种错误(下面有处理方法)。因此把我自己的安装流程记录下来,防止重复踩坑。
参考:https://github.com/yosinski/caffe/blob/jason_public/doc/linux-no-root-install-log.md
0.根目录下,终端依次执行:
mkdir temp
mkdir local
用途:以后所有步骤下载的源码都放在temp文件夹中,编译得到的库、头文件和可执行程序都放在local文件夹中。
PS:下面路径中的所有your_root_path都要替换为你自己的根目录路径。
- 安装必备工具m4, autoconf, automake, libtool
安装m4
cd temp
wget http://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz
tar zxvf m4-1.4.18.tar.gz
cd m4-1.4.18
./configure --prefix=/your_root_path/local
make
make install
安装autoconf
cd temp
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
tar zxvf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure --prefix=/your_root_path/local
make
make install
安装automake
cd temp
wget http://ftp.gnu.org/gnu/automake/automake-1.16.1.tar.gz
tar zxvf automake-1.16.1.tar.gz
cd automake-1.16.1
./configure --prefix=/your_root_path/local
make
make install
安装libtool
cd temp
wget http://mirror.csclub.uwaterloo.ca/gnu/libtool/libtool-2.4.6.tar.gz
cd libtool-2.4.6
tar zxvf libtool-2.4.6.tar.gz
./configure --prefix=/your_root_path/local
make
make install
将它们的可执行程序路径写入环境变量中:
vim ~/.bashrc
点击i进入输入模式
将下列代码复制粘贴到文件最后:
export PATH="/your_root_path/local/bin:$PATH"
export LIBRARY_PATH="/your_root_path/local/lib:$LIBRARY_PATH"
export LD_LIBRARY_PATH="/your_root_path/local/lib:$LD_LIBRARY_PATH"
点ESC退出输入模式,输入:wq
进行保存并退出。
命令行输入source ~/.bashrc
激活环境变量。
可分别使用下面的命令进行版本查询并验证是否安装成功:
m4 --version
autoconf --version
automake --version
libtool --version
PS:本部分参考https://blog.csdn.net/qq_30549833/article/details/72955881
2.安装boost库
源码下载地址:https://www.boost.org/users/history/version_1_67_0.html
或使用wget下载。
cd temp
wget https://dl.bintray.com/boostorg/release/1.67.0/source/bo