Deep learning (TensorFlow) environment construction: (1) Ubuntu16.04+1080Ti graphics card driver

One, placement

  • System: Ubuntu16.04.4 LTS
  • GPU:GTX1080Ti

Second, the overall process steps

  1.   Install Ubuntu16.04
  2.   Install 1080Ti graphics card driver

3. Install Ubuntu16.04

3.1 , download 16.04.4

Visit the official website https://www.ubuntu.com/download/desktop to get it.

There is a small problem when making a U disk to start. After using UltraISO to open it directly, there is only one efi folder. There is naturally a problem with writing the hard disk image.

The workaround I used was to download the latest version of " Universal USB Installer"

The download address is: Click to open the link

3.2 , install 16.04.4

I am using the ASUS Z370-p motherboard. According to other people's problems, the GTX1080ti graphics card needs to be removed first, and the integrated graphics card or the old graphics card should be installed. The reason is that Ubutnu16.04.4 does not have a 1080TI driver by default; but I have not encountered this problem. . I installed it directly. See there is a suggestion to install the English version. I also think that installing the English version will have a positive effect on TF.

3.3 , Ubuntu16.04 update source

first use 

cd /etc/apt
sudo cp sources.list sources.list.bak
sudo vi /etc/apt/sources.list

Then paste the following at the very bottom of the text

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

Then 

source /etc/apt/sources.list
finally 
sudo apt-get update
3.4 , modify NTFS disk (volume label)

Because I switched from Win10 to Ubuntu16.04, there are NTFS hard disks to deal with:

Edit ext2/ext3/FAT32/NTFS disk partition volume labels

According to different disk partition types, there are 3 programs to choose from.

Mtools works with FAT32 formatted partitions.
ntfsprogs works with NTFS formatted partitions.
e2label works with ext2 and ext3 format partitions.
1. View all current partitions
sudo fdisk -l

Display results similar to:
Device Boot Start End Blocks Id System
/dev/sda1 * 63 275659334 137829636 7 HPFS/NTFS/exFAT
Partition 1 does not start on physical sector boundary.
/dev/sda2 275659396 1953523711 838932158 f W95 Ext'd (LBA)
Partition 2 does not start on physical sector boundary.
/dev/sda5 275659398 695116484 209728543+ 7 HPFS/NTFS/exFAT
Partition 5 does not start on physical sector boundary.

2. First unmount the partition whose name you want to change:

sudo umount /dev/sda5
3. Modify the name:
sudo ntfslabel /dev/sda5 software
Note: ntfslabel will automatically reload after changing the name, no need to execute the mount command

3.5 . Installation of Wubi Input Method

sudo apt-get install fcitx-table-wubi
#Ubuntu's default input method framework is ibus, we need to enter the following command to switch the Fcitx input method framework
im-config -n fcitx
sudo systemctl restart lightdm.service

Fourth, install the NVIDIA graphics card driver

4.1. Query the NVIDIA version number

  First of all, we can go to the NVIDIA official website to check the appropriate graphics card driver and the corresponding version number. Official website query address ( http://www.nvidia.com/Download/index.aspx?lang=en-us ), the following picture is what I queried according to my graphics card type:



4.2, driver installation

I saw someone on the Internet saying that the BIOS must be modified to turn off secure boot. If it is not turned off, the driver will not take effect. But I am using the ASUS Z370-p motherboard, the secure boot status is still enabled and grayed out and cannot be selected for modification.

So I can only continue to install.

4.1, disable nouveau's own driver

Disabling nouveau is actually because the integrated graphics driver of the Ubuntu system is nouveau, mainly because it is afraid of conflict with the NVIDIA driver, which will cause the system to fail to start.

Console input command, create a file by command

sudo vim /etc/modprobe.d/blacklist-nouveau.conf

and add the following:

blacklist new
options new modeset=0

update again

sudo update-initramfs -u

After modification, the system needs to be restarted. Confirm that nouveau has been killed by you, you can use the command: 

lsmod | grep new
4.2, install the GPU driver

The following demonstration is still in the desktop mode (Ctrl+Alt+F7). In the real environment, in fact, everyone still enters the text mode (Ctrl+Alt+F1), and you need to enter the account and password.

1. Install the ppa library

  可能有时候通过NVIDIA官网下载显卡驱动比较慢,我们可以添加ppa库,通过ppa安装显卡驱动,这步可有可无,用户自行决定,输入代码如下:

sudo add-apt-repository ppa:graphics-drivers/ppa

如图所示:



2、关闭图形化环境

  为了确保驱动能够正常安装,我们需要暂时关闭x-window服务(图形环境),在文本模式下输入命令进行关闭

sudo service lightdm stop

3、安装驱动

注:如果之前你已经安装NVIDIA显卡驱动话,我们需要先卸载旧的显卡驱动,需要输入命令 

sudo apt-get purge nvidia*

输入以下命令,直接安装驱动,这里可以选之前说的390版本的

sudo apt-get update && sudo apt-get install nvidia-390

但我把RUN文件下载下来后,可以直接用命令安装:

sudo ./NVIDIA-Linux-x86_64-390.48.run

如图所示:


根据提示选择即可最后安装完毕后,重新启动X-Window,输入命令:sudo service lightdm start,然后Ctrl+Alt+F7进入图形界面。

至此、安装GPU显卡驱动已经完成,然后重启电脑,这个时候能看到已经顺利的进入系统。

  进入系统,我们要看刚刚的显卡驱动是否已经正确安装成功,通过下面命令查看:

nvidia-smi
正常情况下,我们可以看到具体的驱动信息,如图所示:


4、修改tty的分辨率

重启后使用Ctrl+Alt+F1进入文本模式时,发现字体太大,使用命令:

sudo vim /etc/default/grub

设置成显卡所支持的分辨率,可以参考显示功能所列出的分辨率

GRUB_GFXPAYLOAD_LINUX=1920x1080

然后更新grub:

sudo update-grub 

5虚拟终端(Ctrl+Alt+F1)下显示菱形中文乱码问题

把系统转成英文的:

sudo gedit /etc/default/locale

将内容改为:

LANG="en_US.UTF-8"
LANGUAGE="en_US:en"
再运行
sudo locale-gen

然后重启,会提示是否将文件夹改成英文的,此时选择“Update...”即可。

再安装zhcon软件包:

sudo apt-get install zhcon
它其实就相当于一个Ubuntu的UC-DOS程序,是一个汉字外挂。既然是外挂就必然要占用一定的系统资源,根据实际需求可选用该方法。

至此、NVIDIA显卡驱动已经安装完成了~下篇我们主要讲CUDA和CUDNN的安装

注:推荐一个截屏软件

安装gnome-screenshot。

sudo apt-get install gnome-screenshot

桌面左上角打开dash菜单


然后就可以打开截图窗口



PS:如有疑问,请留言,未经允许,不得私自转载,转载请注明出处:

参考:

https://www.cnblogs.com/EasonJim/p/7163232.html

https://www.cnblogs.com/xuliangxing/p/7569946.html


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324770416&siteId=291194637