Ubuntu 16.04 装机指南(分区 + 显卡驱动 + Cuda9.0 + CUDNN7.0)

Ubuntu 16.04 装机指南

1. 制作引导盘

借助 ultroISO 制作启动盘很简单,这里就不在赘述,可以参考 制作Ubuntu16.04系统安装的U盘(附资源).

2. 系统分区

关于分区的说法很多,而且基本都还是针对很老旧的配置的,下面说说我自己的做法,经过多次测试暂时没有发现什么不妥。我有一个固态和一个机械硬盘,机械硬盘直接全部划分为主分区。

  • EFI 2G primary Beginning of this space EFI
  • swarp 32G primary Beginning of this space ext4 swap
  • boot 固态硬盘的剩余空间 Beginning of this space ext4 /boot
  • / 整个机械硬盘 Beginning of this space ext4 /

3. 将 python3 设置为默认项

ubuntu16.04 自带 python2.7 和 python3.5, 但是默认项是2.7。把 python3.5 设置为默认的方式如下:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

4. 安装中文输入法

参考 ubuntu 16.04中文输入法安装
注意命令不要直接 copy, 原文中的命令之间少了空格,无法识别。

5. 更换系统源

参考 Ubuntu 更换国内源
需要注意的是,版本要对应,16.04不要弄成了18.04了。
更换之后更新源和软件。

更新源

sudo apt-get update

更新软件

sudo apt-get upgrade

6. 安装 vim

sudo apt-get install vim

参考 ubuntu16.04下vim的安装与配置 进行 vim 设置。

7. 安装 VS Code

安装参考 Ubuntu 16.04 安装VSCode
另外如果你需要用 vscode 写 markdown 的话,可能需要用到 paste image 这个插件,而这个插件需要安装 xclip。

sudo apt-get install xclip

8. 安装 git

sudo apt-get install git

9. 安装 CMake-gui

sudo apt-get install cmake-qt-gui

10. 安装 chrome 浏览器

chrome 下载地址 chrome-64bit

安装参考 在Ubuntu16.04上安装Chrome浏览器
安装完成之后直接在 terminal 输入如下命令就可以启动 chrome 浏览器了。

google-chrome

11. 安装显卡驱动

这个不是必须,根据需要选择,我因为需要用 Cuda 和 Cudnn, 这里必须要安装 N 卡的驱动。
安装显卡参考 Ubuntu16.04安装NVIDIA驱动、实现GPU加速

需要注意的是,上面的参考文章中是先执行下面的 stop,再进入命令行的。这里建议先进入命令行(Ctrl+Alt+F1),再执行 stop。

sudo service lightdm stop

在安装的时候有一些选项,可能不同的驱动版本会略有不同,我下载的是最新的版本 430.50,选项大致如下:

  • the distribution-provided pre-install script failed! Are you sure you want to continue?
    选择 yes 继续。
  • Would you like to register the kernel module souces with DKMS? This will allow DKMS to automatically build a new module, if you install a different kernel later?
    选择 No 继续。
  • Nvidia’s 32-bit compatibility libraries? 选择 No 继续。
    Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? Any pre-existing x confile will be backed up.
    选择 Yes 继续

12. CUDA9.0

安装可以参考 Ubuntu16.04 + cuda9.0 + cudnn_v7 + tensorflow-gpu + opencv3.4.2

需要注意的是安装的过程中不要安装驱动,因为前面我们已经自己安装了驱动。

安装过程大致和 cuda8 类似。

Do you accept the previously read EULA?accept/decline/quit: accept

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 361.62?(y)es/(n)o/(q)uit: n

Install the CUDA 8.0 Toolkit?(y)es/(n)o/(q)uit: y

Enter Toolkit Location[ default is /usr/local/cuda-8.0 ]:

Do you want to install a symbolic link at /usr/local/cuda?(y)es/(n)o/(q)uit: y

Install the CUDA 8.0 Samples?(y)es/(n)o/(q)uit: y

Enter CUDA Samples Location[ default is /home/textminer ]:

Installing the CUDA Toolkit in /usr/local/cuda-8.0 … 
Installing the CUDA Samples in /home/textminer … 
Copying samples to /home/textminer/NVIDIA_CUDA-8.0_Samples now… 
Finished copying samples.

13. CUDNN7.0

这个安装比较简单,没有什么风险,参考 Ubuntu16.04 + cuda9.0 + cudnn_v7 + tensorflow-gpu + opencv3.4.2

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章