1. 下载centos7镜像
sudo docker pull centos:7
2. 启动centos7容器并挂载本地目录
sudo docker -it -v /home/software:/home/package centos:7 /bin/bash
3. 安装Anaconda
bash Anaconda2-4.4.0-Linux-x86_64.sh
4. 安装Opencv
conda install --channel https://conda.anaconda.org/menpo opencv
5. 安装gtk2
安装完OpenCV,在python中导入cv2可能报错:
ImportError: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
安装gtk2解决:
yum install gtk2
6. 安装tensorflow
pip install TensorFlow
7. 安装pip
yum -y install epel-release
yum -y install python-pip
yum clean all
8. 安装gcc
yum install gcc
查看gcc是否安装成功:
which gcc
9. 安装keras
pip install keras
10. 安装git
yum install git-core
在ubuntu上安装git指令为:
apt-get install git
11. 安装torch
git clone https://github.com/torch/distro.git ~/torch --recursive
cd /root/torch
bash install-deps
./install.sh
如果运行 bash install-deps 报错:
sudo: command not found
把 install-deps 文件中所有的sudo删掉后再次运行
bash install-deps 指令
12. 安装pytorch
conda install pytorch torchvision -c soumith
或
conda install pytorch
13. 安装torchvision
conda install torchvision
14. 安装lmdb
pip install lmdb
15. 安装wget
yum install wget
16. 安装oracle Java
查看已安装openjdk版本:
rpm -qa|grep java
删除openjdk:
rpm -qa | grep jdk | xargs rpm -e --nodeps
安装oracle java8:
wget --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie;" http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/jdk-8u162-linux-x64.rpm
安装RPM:
rpm -ivh jdk***.rpm
添加环境变量:
JAVA_HOME=/usr/java/jdk1.8.0_162/
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME PATH CLASSPATH
17. 解决 ‘Cannot find a valid baseurl for repo: base/7/x86_6’不能联网问题:
vi /etc/sysconfig/network-scripts/ifcfg-ethxxx,把ONBOOT=no,改为ONBOOT=yes
service network restart
18. 保存镜像修改
sudo commit ID centos7:new