配件终于陆续到齐了。硬件装好。开装软件
1 OS:Ubuntu 18.04.2 LTS
ultraISO制作usb启动盘时,注意写入模式选raw,别选usb+hdd,否则会报错:
Failed to load ldlinux.c32
2 装Nvidia驱动:
加源:
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
查看显卡推荐的驱动:
ubuntu-drivers devices
不错,装呗:
sudo ubuntu-drivers autoinstall
出错:“nvidia-driver-415 : 依赖: xserver-xorg-video-nvidia-415 (= 415.27-0ubuntu0~gpu18.04.1) 但是它将不会被安装 E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。”
强制安装:
sudo apt-get install xserver-xorg-video-nvidia-415=415.27-0ubuntu0~gpu18.04.1
再错“xserver-xorg-video-nvidia-415 : 依赖: xserver-xorg-core (>= 2:1.19.6-1ubuntu2~)
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。”
再强制安装
sudo apt-get install xserver-xorg-core
成了!
重启后:
装cuda:
打开页面:https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=debnetwork
下载deb包,安装:
sudo dpkg -i cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
在文件内加入如下内容:
export PATH=/usr/local/cuda-10.0/bin${PATH:+:$PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
最后检查下安装的版本:
nvcc --version
告成;
装cudnn:
到这里下载,根据cuda下载对应的包(要先注册),我下的是libcudnn7_7.4.2.24-1+cuda10.0_amd64.deb。执行安装:
sudo dpkg -i libcudnn7_7.4.2.24-1+cuda10.0_amd64.deb
安装docker
用的阿里镜像源,看这里:
# step 1:
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
# step 2: 安装GPG证书
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# Step 3: 写入软件源信息
sudo add-apt-repository"deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu$(lsb_release -cs)stable"
# Step 4: 更新并安装 Docker-CE
sudo apt-get -y update
sudo apt-get -y install docker-ce
检查版本
docker -v
sudo systemctl start docker
sudo systemctl enable docker
状态
sudo systemctl status docker
安装NVIDIA-docker:
看这里:
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo pkill -SIGHUP dockerd
docker加国内镜像源
sudo vim /etc/docker/daemon.json,增加内容:
{
"registry-mirrors": [
"https://registry.docker-cn.com",
"https://docker.mirrors.ustc.edu.cn",
“http://hub-mirror.c.163.com”
]
}
阿里云镜像要注册,获得一个专属的镜像加速地址。
设置完一定要重启一下docker:
service docker restart
验证nvidia-docker:
sudo nvidia-docker run --rm nvidia/cuda nvidia-smi
sudo docker rmi nvidia/cuda
打印出如下信息:
deepo镜像
参考这里,
装image,我选的tag是py36-jupyter:
sudo docker pull ufoym/deepo:py36-jupyter
启动:
sudo nvidia-docker run --restart=always -p 8888:8888 ufoym/deepo:py36-jupyter jupyter notebook --no-browser --allow-root --ip=0.0.0.0 --NotebookApp.token= --notebook-dir=/root
网页打开jupyter terminal,
设置jupyer密码:
jupyter notebook --generate-config
jupyter notebook password
装插件:
pip install jupyter_contrib_nbextensions
pip install jupyter_nbextensions_configurator
jupyter contrib nbextension install --user
jupyter nbextension enable execute_time/ExecuteTime
pip install ipywidgets
pip install qgrid
pip install RISE
pip install isort
jupyter-nbextension install rise --py --sys-prefix
jupyter-nbextension enable rise --py --sys-prefix
jupyter terminal不支持命令行历史的解决,在terminal内执行:
rm /bin/sh
ln -s /bin/bash /bin/sh
强制替换为bash,重启terminal好了
完成&P
好麻烦