深度学习环境训练搭建

apt-get update 失败 

深度学习环境训练搭建_第1张图片

apt-get update 失败 
vim  /etc/resolv.conf

更改下面的选项

nameserver 172.1.0.200
search 10011016-name.svc.cluster.local. svc.cluster.local. cluster.local.
options ndots:5
nameserver 8.8.8.8
nameserver 223.5.5.5
nameserver 223.6.6.6

然后运行

apt-get update 
root@pytorch-9wzbx:/# apt-get update
Get:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease [15.9 kB]
Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic InRelease [242 kB]
Get:4 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 Packages [36.5 kB]
Get:5 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [894 kB]
Get:6 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:7 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:8 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [186 kB]
Get:9 http://archive.ubuntu.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]
Get:10 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [839 kB]
Get:11 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages [1344 kB]
Get:12 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [46.8 kB]
Get:13 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [8213 B]
Get:14 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
Get:15 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1376 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [12.9 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [62.7 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [1200 kB]
Get:19 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [8286 B]
Get:20 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [7671 B]
Fetched 17.9 MB in 33s (536 kB/s)

 更新成功,下面给主机安装ssh,并开启服务器的ssh服务。

apt-get install openssh-server  

启动ssh服务

/etc/init.d/ssh start     #启动SSH服务
/etc/init.d/ssh restart   #重启SSH服务
/etc/init.d/ssh stop      #关闭SSH服务

出现下面表示ssh服务已经启动 

root@pytorch-9wzbx:/etc# /etc/init.d/ssh start
 * Starting OpenBSD Secure Shell server sshd
root@pytorch-9wzbx:/etc# ps -e | grep sshd
 1241 ?        00:00:00 sshd

配置root用户SSH服务

SSH服务安装完成后查看是否允许root用户登陆,若不允许则无法远程登陆root用户,需要修改配置


vim /etc/ssh/sshd_config  
更改Authentication如下

LoginGraceTime 120
PermitRootLogin yes
StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

xshell客户端一直提示密码错误, 经查验发现ubuntu的密码没有设置

passwd root

设置完密码之后,xshell就可以完美的访问了容器了。

深度学习环境训练搭建_第2张图片

下面开始搭建深度学习的训练环境,在xshell客户端进行操作。

在线下载anaconda包,清华源卡的话可以换科大的源 mirrors.ustc.edu.cn

wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-2020.02-Linux-x86_64.sh

切到下载的目录然后,开始安装

bash Anaconda3-2020.02-Linux-x86_64.sh

安装完成之后,将anaconda加入到环境

export PATH=$PATH:/data/anaconda3/bin
source ~/.bashrc

这里面是自己的目录

conda 换源

将配置文件写在~/.condarc

vim ~/.condarc

更换清华源 

channels:
  - https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
  - https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults
show_channel_urls: true

 换回默认源:

conda config --remove-key channels

 

创建虚拟环境

conda create -n ccnet  python=3.6

激活虚拟环境

 source activate ccnet
apt-get install screen # 安装screen 环境

下面开始安装环境所需要的依赖包:

如果有requirement.txt 的话直接
pip install -r requirement.txt
# 安装pytorch
conda install pytorch torchvision cudatoolkit=10.0 -c pytorch
# 安装 apex
$ git clone https://github.com/NVIDIA/apex
$ cd apex
$ python setup.py install --cpp_ext --cuda_ext
pip install opencv-python==3.4.0.12
pip install torchsummary
pip install tensorboard      
pip install tensorboardX
pip install scipy
pip install tqdm 

查看tensorboard

tensorboard --logdir=./
git clone --recursive https://github.com/apache/incubator-mxnet.git incubator-mxnet --branch 0.11.0
cp rcnn/CXX_OP/* incubator-mxnet/src/operator/
cd incubator-mxnet
make -j USE_BLAS=openblas USE_CUDA=1 USE_CUDA_PATH=/usr/local/cuda USE_CUDNN=1
cd ..

安装visual studio

wget https://vscode.cdn.azure.cn/stable/c6e592b2b5770e40a98cb9c2715a8ef89aec3d74/code_1.30.0-1544567151_amd64.deb

安装 

sudo dpkg -i dpkg -i code_1.30.0-1544567151_amd64.deb 

运行 

code

 

你可能感兴趣的:(环境搭建,深度学习)