文章目录
上篇博文主要写了在Ubuntu18.04下安装配置深度学习环境的有关操作过程,考虑到很多同学还是使用ubuntu16.04,因此这里专门补一篇关于16.04的博文,其实在18.04下配置环境跟16.04下差距不大,关键是掌握好ubuntu版本、Nvidia显卡驱动版本、CUDA版本、cuDNN版本、Tensorflow版本之间的兼容关系即可。
目前我们采用如下环境配置:
- 系统:Ubuntu16.04.5 LTS
- 显卡驱动(1080Ti):Nvidia-384
- CUDA版本:CUDA ToolKit9.0 + 四个update patch
- cuDNN版本:cuDNN v7.3 for CUDA 9.0
- Tensorflow版本:Tensorflow-gpu1.12
一、Ubuntu16.04 LTS系统的安装
安装过程跟上一篇博文关于18.04系统的安装完全一致,请参考上篇博文,这里不赘述。
二、设置软件源的国内镜像
1. 设置方法
Ubuntu在安装软件的过程中,默认从其官方源下载,但由于国内网络的原因,往往很慢。因此为了加快安装速度,建议设置国内镜像。在ubuntu系统中,软件源记录在/etc/apt/source.list文件中,因此,我们只需要将要加入的国内镜像的地址写入这个文件即可,在写入之前记得备份一下原始的内容。
sudo cp /etc/apt/source.list /etc/apt/source.list.bak # 备份
sudo gedit /etc/apt/source.list # 用gedit打开source.list文件
将下述内容全部拷贝到source.list文件的头部,保存退出。
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
然后,在命令行执行如下命令更新软件源
sudo apt-get update
等待片刻,软件源更新完成,这样采用apt-get install方式安装软件时将优先从上述国内镜像地址寻找软件源,速度将快不少。到此,如果你不想了解关于国内镜像的知识,可以直接进入下一节开始显卡驱动的安装,如果想了解ubuntu的镜像知识,可以继续往下看。
2.关于ubuntu镜像的小知识
首先,简单介绍下关于Ubuntu的source.list文件的内容,该文件在/etc/apt/目录下,它记录了ubuntu软件更新的源的地址及目录,默认是ubuntu的官方源,source.list文件内容的具体含义如下:
1 | 2 | 3 | 4 | 5 | 6 | 7 |
---|---|---|---|---|---|---|
deb | url | 版本代号(比如xenial) | main | restricted | universe | multiverse |
deb-src | url | 版本代号(比如xenial) | main | restricted | universe | multiverse |
上述格式中,第1列为deb或deb-src,分别代表直接通过.deb文件进行安装和通过source code源文件进行安装两种方式;第2列为URL地址,比如ubuntu官方源的地址为http://archive.ubuntu.com/ubuntu/,第3列为版本代号,具体见下表(这里只给出.04版本的,其它版本可以自己取查看),一般只取代号的第一个单词(比如16.04版本只取Xe