Ubuntu18.04双系统安装+GPU+CUDA10+CUDNN7+ANACONDA3+PYTHON+PYCHARM

34 篇文章 1 订阅
13 篇文章 0 订阅

Ubuntu18.04双系统安装+GPU+CUDA10+CUDNN7+ANACONDA3+PYTHON+PYCHARM

一、Win10 环境下安装Ubuntu 18.04过程记录


步骤1:下载镜像文件

从Ubuntu官网https://www.ubuntu.com/download/server下载系统的iso镜像文件 ,下载后不用解压,过程如下:


步骤2:格式化U盘

 格式化你的U盘,格式化的时候选择FAT32格式的,具体过程如下:

https://i-blog.csdnimg.cn/blog_migrate/67ff874c37dec469edc25e3583d3006a.png

步骤3:制作启动盘
    从网上https://cn.ultraiso.net/xiazai.html下载UltraISO软件安装,选择“继续试用”打开软件。

点击下图中文件图标,将刚才下载的镜像文件选择。

https://i-blog.csdnimg.cn/blog_migrate/8f82e72527d718b53a3430cbff564991.png

选中后如下图所示界面:

https://i-blog.csdnimg.cn/blog_migrate/3f4170c26bf5a5b58bbc4ed3b64b9872.png
接着进行如下步骤:https://i-blog.csdnimg.cn/blog_migrate/7d31f0cd2cd1965639e6ed196cac2bfd.png

接着设置以下选项:https://i-blog.csdnimg.cn/blog_migrate/a67dfb704dd2a1932b09b6fe2e43f6e0.png

接着点击“是”,最后点击写入,开始写入文件,完成后关闭即可,到此U盘制作完成。

https://i-blog.csdnimg.cn/blog_migrate/4255c8a1aaaf450ee73847aff94d7e42.pnghttps://i-blog.csdnimg.cn/blog_migrate/d7663c6fbe57159f9599697bc2f39220.png

步骤4:为ubuntu进行磁盘分区(本人安装的是双系统,C盘装的是win10,压缩出一个单独的盘将近500G用来装Ubuntu)

我的电脑:总共16g内存,2t机械硬盘 256g固态盘!

 win10 自带分区功能,鼠标放在 此电脑 上 右键  选择  管理  ,打开界面后选择 磁盘管理  ,接下来在你的 机械硬盘  上  找到一个 容量比较大的磁盘  鼠标选中 容量比较大的磁盘  鼠标右键 压缩磁盘  ,至于压缩磁盘的 大小是自己的磁盘可用量而定  ,我的 压缩磁盘 210GB (刚开始只分配了 150GB ,后来发现不够用, 卸载重新 压缩磁盘 安装的,建议:如果磁盘容量足够大,可以压缩空间大于 200G ),如下图所示:(我的分配将近500g)

https://i-blog.csdnimg.cn/blog_migrate/aa4168e692dee73dcc83f43a3b63b564.png

        注意: 压缩的磁盘空间  一定不要分配盘符(即  不要新建卷  ,也即是不需要盘符 D、 E、F这些东西,保持未分配状态)

查看 磁盘1 的分区方式 ,如下图:

https://i-blog.csdnimg.cn/blog_migrate/aa4168e692dee73dcc83f43a3b63b564.png

压缩后的磁盘空间 210GB  状态 : 未分配(不要新建卷,保持未分配状态)

磁盘空间分配完成。

步骤5:开始装系统(在开机的前一定把U盘插上)

①进入BIOS进行Secure Boot设置

每一款电脑的BIOS不一样,所以根据自己的电脑主板的BIOS进行设置。本人所使用的是惠普(HP)暗影精灵II代PLUS,所以,以此为例。

按F10进入BIOS->系统设置.将“安全启动模式”设置为“禁用”,有些英文的,是Secure Boot是disabled状态。

将U盘启动 “U盘/USB硬盘”设置为第一启动顺序。

https://i-blog.csdnimg.cn/blog_migrate/b8419f87c3196bbdc48bf7b7cb97a941.png

②接着将USB HDD启动项放到最上面,意思就是说优先从U盘启动(此过程不同的电脑,内容有一定的差距,这里不再放图,反正自己琢磨一会或者多参考几个网上的博客,本人是试了好几次才进入到了ubuntu的安装界面)。

③设置完后保存退出,重启系统就会进入Ubuntu的界面,选择安装(如果选择试用就是直接进入Ubuntu的试用环境中)。

选中 制作的 U盘  ,按下 Enter ,即可进入安装Ubuntu18.04 界面,会出现  试用不安装  和  直接安装

选择 试用不安装进入下列界面:

https://i-blog.csdnimg.cn/blog_migrate/e5ab3a41ff278ba5082a98f3adc580ab.png

下一步安装:

https://i-blog.csdnimg.cn/blog_migrate/121a33b504ade266c9a3113ed65448a2.png

直接安装  和 试用不安装 进行上面两步操作后,都会进入下面界面:

选择安装语言,按图示操作即可:我选简体中文

https://i-blog.csdnimg.cn/blog_migrate/db0f4ff856b87f2947ee267d97f749f7.png

下一步,选择键盘布局:

https://i-blog.csdnimg.cn/blog_migrate/0513d8ea3cd285a935c29b56fce27ad0.png

下一步,Updates and others software:我选的 最小化安装。节省网络下载安装系统时间。我选 正常安装

https://i-blog.csdnimg.cn/blog_migrate/fc0e3bfd96749ff69662967abfd536a8.png

下一步,安装类型,一定要选择 something else:我选其他

https://i-blog.csdnimg.cn/blog_migrate/0c7498d403ade5277b912e7299307e5f.png

下一步,分区挂载,这一步很关键:

 

 

步骤6、盘符选择

在原有系统上安装双系统有一个基本原则,那就是无论新系统是否安装成功,都不要破坏原系统环境,否则就是赔了夫人又折兵了。注意Ubuntu盘符的命名特点“sdxy”,其中x指物理磁盘号,y指磁盘的逻辑分区号,如sda1指第一块物理磁盘上的第一块逻辑分区,sdb2指第二块物理磁盘上的第二块逻辑分区。只要找准磁盘分区进行安装,原系统环境就不会被破坏,Ubuntu重装个十次八次的都有恃无恐。

我是把上次安装的linux相关分区删除掉,重新分配。一定注意不能删除错误,把ntfs相关分区一定保留 是windows的,linux下的分区,在系统正常时候,可以进入桌面查看,或者用终端命令df查看。)

压缩的分区如下图:

https://i-blog.csdnimg.cn/blog_migrate/fb0c18000451547344d31c584f6b220e.png

下一步

 

步骤7:分区挂载

我的安装方案: (挂载前如果原来安装过系统,需要把对应的分区删除,重新分配,这样保证将来运行空间足够,) 其实我只挂载了 两个分区: 1、 挂载 /   2、 挂载 / home  分别分配空间  48GB 和 380GB ,其他的分区不是必须的,这两个分区就够了.

这时我们需要关注下分区,首先给出我的分区方案 :挂载点:/,分配20G,逻辑分区,空间起始位置,ext4日志文件系统,用于存放系统; 挂载点:swap(交换空间):逻辑分区,设置8G(和内存一样大) ;挂载点:/boot 500M,逻辑分区,空间起始位置,Ext4日志文件系统,存放引导一类东西(这个分区可以不用!!!,我没划分);挂载点:/home 剩余空间大小,逻辑分区,空间起始位置,Ext4日志文件系统,用于存放安装的软件;如下图所示,分区大小请按照我文字描述中执行 
 

 

https://i-blog.csdnimg.cn/blog_migrate/1b23a4e7428e2acdc399b687bca4ab20.pnghttps://i-blog.csdnimg.cn/blog_migrate/b347b5c8d4bf4434cad36b9004295d02.png

https://i-blog.csdnimg.cn/blog_migrate/b987e5b57dff8f14409b767e30d5d489.pnghttps://i-blog.csdnimg.cn/blog_migrate/7606500414bc3cd1d10e7cb11993c2f9.png

 


最后安装启动引导器的设备,选择带有Windows Boot Manager的windows引导efi分区,这样,就可以在windows引导分区下存放一个ubuntu的引导。 

来源:CSDN 
原文:https://blog.csdn.net/u013052326/article/details/81545449 
版权声明:本文为博主原创文章,转载请附上博文链接!

我只挂载了/ 和/home 分别48g,380g 因为unbuntu18版本其他分区都可以不要了

 

 这一步非常重要!非常重要!非常重要!,这一步关系到  Ubuntu系统是否会覆盖掉自带的win10系统  ,也关系到  双系统能否安装成功  ,安装到   Installation type  这一步时,一定要慢慢来,选择   Something else  ,然后再点击   Continue ,(此处点击  Contiue 一定要慎重,并不是如某些教程所说的  一顿  Continue 狂点,狂点  Continue 造成的个人损失 本人概不负责),第一次安装一定要严格,慢慢的按照步骤来操作

                

,下面的挂载分区介绍 仅供参考,想了解看一下,具体操作过程如下图所示:

挂载第一个分区, 挂载分区 / :

https://i-blog.csdnimg.cn/blog_migrate/d7ac567c7a061c80c170260fe17fc0b5.png

下一步,在弹出来的界面,分配  挂载分区 / 大小:

https://i-blog.csdnimg.cn/blog_migrate/b27dd83b8a3273af9c4a8bdd9ab4cd36.png ​ ​https://i-blog.csdnimg.cn/blog_migrate/437ae3d8927033d7a689e2989c4dd34f.png

上面那三个图我自己安装的情况。

https://i-blog.csdnimg.cn/blog_migrate/214f4e7f8f1d57d2f9c7814136a9f182.png

第一个挂载分区 / ,完成,点击 OK

下一步,挂载分区 /home :

下一步,设置 挂载分区 /home 大小:

https://i-blog.csdnimg.cn/blog_migrate/00661f99ceee45e64fd4a04f07518bb4.png

挂载分区 /home 完毕,点击 OK, 还不能安装!!!

下一步,选择 将 Boot 安装在 Windows boot Manager 中:

https://i-blog.csdnimg.cn/blog_migrate/f5804df6455b5dab3779575e455cb558.png

下一步

https://i-blog.csdnimg.cn/blog_migrate/0021c05bcd58cb4e8f5c1bd365adaf9f.png

下一步

https://i-blog.csdnimg.cn/blog_migrate/3ee7f34f216ab59a43951324b4726899.png

下一步

https://i-blog.csdnimg.cn/blog_migrate/1ebf3fe700c1712597ef5b120b862a8e.png

下一步

https://i-blog.csdnimg.cn/blog_migrate/962b6b59c707cbc8e826a370e1623fbd.png

下一步,进入 安装界面:

https://i-blog.csdnimg.cn/blog_migrate/574193c608030e616f48ff2587fd5e3e.png

备注:挂载分区介绍:

1、swap交换空间,这个也就是虚拟内存的地方,选择主分区和空间起始位置。如果你给Ubuntu系统分区容量足够的话,最好是能给到你物理内存的2倍大小,像我8GB内存,就可以给个16GB的空间给它,这个看个人使用情况,太小也不好,太大也没用。(其实我只给了8GB,没什么问题),其实也可以不设置,如果内存足够大,没必要设置

                    2、boot 一定记住,不要单独/boot划分区;是的不要,不然就完蛋了,结果就是只能进一个系统,因为这里是EFI引导替代boot的grub;也请放心efi分区不会不够用,linux内核不在efi分区而在/boot,在你挂载分区,你会发现也是没有 Boot 的 挂载选项的,新教程这一项不需要了!

      在安装和分区界面,看到最下面一个,安装启动器到,换成你的EFI分区,一般有windows boot manager 等标识,就是 /dev/sda1 EFI 这样的(不分配Boot的具体原因参照此贴:http://forum.ubuntu.org.cn/viewtopic.php?p=3200137)

                3、挂载“/home”,类型为EXT4日志文件系统,选中逻辑分区和空间起始位置,这个相当于你的个人文件夹,类似Windows里的User,如果你是个娱乐向的用户,我建议最好能分配稍微大点,因为你的图片、视频、下载内容基本都在这里面,这些东西可不像在Win上面你想移动就能移动的。 
总的来说,最好不要低于32GB ,我Ubuntu分区的总大小是150GB ,这里我给了110GB 给home。 

(这里特别提醒一下,Ubuntu最新发行版不建议强制获取Root权限,因为我已经玩崩过一次。所以你以后很多文档、图片、包括免安装软件等资源不得不直接放在home分支下面。你作为图形界面用户,只对home分支有完全的读写执行权限,其余分支例如usr你只能在终端使用sudo命令来操作文件,不利于存放一些直接解压使用的免安装软件。因此,建议home分支多分配一点空间……)

                    4、挂载“/usr”,类型为EXT4日志文件系统,选中逻辑分区和空间起始位置,这个相当于你的软件安装位置,Linux下一般来说安装第三方软件你是没办法更改安装目录的,系统都会统一地安装到/usr目录下面,因此你就知道了,这个分区必须要大

5、最后,挂载“/”,类型为EXT4日志文件系统,选中逻辑分区和空间起始位置, 
因为除了home和usr还有很多别的目录,但那些都不是最重要的,“/”就把除了之前你挂载的home和usr外的全部杂项囊括了,大小也不要太小,最好不低于8GB。如果你非要挨个仔细分配空间,那么你需要知道这些各个分区的含义(Linux(ubuntu)分区挂载点介绍) 

不过就算你把所有目录都自定义分配了空间也必须要给“/”挂载点分配一定的空间 。          

4、 安装完成 ,重启电脑,默认 Ubuntu 是第一启动项, 重启电脑不能启动 Ubuntu

https://i-blog.csdnimg.cn/blog_migrate/574452b4d41937cc1632fd9f5ec75a80.png

如果启动后报错:BUG soft Lockup,关于这个错误参照下面链接:https://blog.csdn.net/xrinosvip/article/details/80447139 

5、纯英文论文看不懂,翻译软件来帮忙,支持整篇PDF或Word上传,翻译高效准确,首次注册送翻译积分,用于翻译论文:翻译狗

6、Ubuntu 下使用Linux命令简单总结:https://blog.csdn.net/xrinosvip/article/details/80894728

7、Win10 和Ubuntu 启动引导向管理软件解决办法:https://blog.csdn.net/xrinosvip/article/details/80994450

 

二、ubuntu18.04设置代理上网 

 

通过设置代理环境变量:

    1,临时设置:在终端中输入命令export http_proxy=http://usr:pwd@proxy_addr:proxy_port/

    2,永久设置:在~/.bashrc/etc/profile等启动文件中添加export http_proxy=http://usr:pwd@proxy_addr:proxy_port/

sudo gedit /etc/profile

sudo gedit ~/.bashrc

分别执行上面两个语句,打开文件输入下面两行内容:保存

export http_proxy=http://guo:1023@172.23.19.183:808/

 export https_proxy=https://guo:1023@172.23.19.183:808/

执行source语句,后就可以代理上网了。 @后面网址是代理服务器的网址和端口,在ccproxy中可以看到端口;@前面是本地用户名和密码,冒号分割。

 经测试,使用环境变量设置代理,仅root用户可以联网。猜测应该是sudo权限的问题。

 注意:在系统设置中设置代理的原理就是设置代理变量,所以系统设置会覆盖掉此变量,重新启动终端生效。

注意:putty客户端不能使用gedit命令,因为不支持图形窗口。

 

三、用putty 连接 ubuntu 解决中文乱码

 

Ubuntu 电脑上需要安装 openssh-server : 
sudo apt-get install openssh-server 
由于默认Ubuntu采用UTF-8的字符集,所以putty需要做一些设置: 

点击左边的 Windows -> Appearance 设置 Font settings ,点击 Change... 按钮选择为 仿宋体 或者 新宋体。 

点击左边的 Windows -> Translation 设置 Character set translation 为 UTF-8 

然后,点击 Open 连接服务器即可。

 

四、WinSCP连接服务器时中文显示乱码解决办法

 

1.WinSCP连接服务器时“文件名UTF-8编码(U)”选择开启

https://i-blog.csdnimg.cn/blog_migrate/08d70ad042b7569b6a871b9cc538b330.png

2.登录成功后,选择选项菜单下的选项

https://i-blog.csdnimg.cn/blog_migrate/ed3c30827bd29e4c196df56ec48dfa8a.png

3.将编辑器下的选择字体里的字体选择为宋体,中文乱码就没有了

https://i-blog.csdnimg.cn/blog_migrate/940c18e42c19ccb5679fc8e8c5df9560.png

 

 

 

五、ssh远程连接的开启:

ssh–secure shell,提供安全的远程登录。从事嵌入式开发搭建linux开发环境中,ssh的服务的安装是其中必不可少的一步。ssh方便一个开发小组中人员登录一台服务器,从事代码的编写、编译、运行。方便代码的共享及管理。ssh是一种安全协议,主要用于给远程登录会话数据进行加密,保证数据传输的安全。


0. SSH分客户端openssh-client和openssh-server

如果你只是想登陆别的机器的SSH只需要安装openssh-client(ubuntu有默认安装,如果没有则sudo apt-get install openssh-client),如果要使本机开放SSH服务就需要安装openssh-server。

1. 查看当前的ubuntu是否安装了ssh-server服务。默认只安装ssh-client服务。

dpkg -l | grep ssh

2. 安装ssh-server服务

sudo apt-get install openssh-server


再次查看安装的服务:

dpkg -l | grep ssh


然后确认ssh-server是否启动了:

ps -e | grep ssh


如果看到sshd那说明ssh-server已经启动了。
如果没有则可以这样启动:sudo /etc/init.d/ssh start或sudo service ssh start
配置相关:
ssh-server配置文件位于/etc/ssh/sshd_config,在这里可以定义SSH的服务端口,默认端口是22,你可以自己定义成其他端口号,如222。(或把配置文件中的”PermitRootLogin without-password”加一个”#”号,把它注释掉,再增加一句”PermitRootLogin yes”)
然后重启SSH服务:
sudo /etc/init.d/ssh stop
sudo /etc/init.d/ssh start

3. 登陆SSH(Linux)

ssh username@192.168.1.103
其中,username为192.168.1.103机器上的用户,需要输入密码。
断开连接:exit

4. 测试

(1)服务器:192.168.1.103(jackgao用户)

(2)客户端:192.168.1.104(root用户)

(3)客户端远程ssh登录服务器

(4)退出远程登录


另外,如果安装了ssh服务,windows下可以使用xshell或者putty链接这台ubuntu了(但是每次都得输入用户名和密码,即使xshell可以存储用户名和密码但是登陆速度很慢。所以可以使用公共密钥的登陆方式来提高速度和安全性。参考链接:ubuntu SSH配置 以及 与xshell文件传输http://blog.sina.com.cn/s/blog_53683dc20102v3wz.html


参考链接及相关:
1. ubuntu开启SSH服务
http://www.cnblogs.com/xiazh/archive/2010/08/13/1798844.html
2. Ubuntu 14.04远程登录服务器–ssh的安装和配置
http://jingyan.baidu.com/article/9c69d48fb9fd7b13c8024e6b.html
3. ubuntu14.04 ssh的安装及使用方法
http://jingyan.baidu.com/article/0eb457e52e50ad03f1a90518.html
4. ubuntu16.04安装 + xshell连接虚拟机
http://blog.csdn.net/chi_wawa/article/details/52467914
5. ubuntu SSH配置 以及 与xshell文件传输
http://blog.sina.com.cn/s/blog_53683dc20102v3wz.html
6. ssh远程登录命令简单实例
http://www.2cto.com/os/201307/228495.html
7. 菜鸟Linux系列:[4]SSH免密码登陆远程服务器
http://jingyan.baidu.com/article/2fb0ba4043124a00f2ec5f0f.html
8. linux下ssh远程登录服务器入门操作
http://www.cnblogs.com/plwang1990/p/5279451.html

 

 

 

六、ubuntu16.04卸载NVIDIA驱动方法(如果全新安装系统,本步骤不用)

2018年06月24日 15:54:04 Mr_Yoky 阅读数:6129

1.ctrl+alt+f1 进入控制台,同时进行登录,输入sudo service lightdm stop

2.卸载驱动sudo apt-get purge nvidia*,这个可以卸载,但有时候也会卸载不了,如果执行这句话之后再输入nvidia-smi,仍然有Nvidia的驱动信息,则说明没有卸载成功,此时用这句话sh ./nvidia.run --uninstall   ,其中nvidia.run代表是安装驱动时的.run文件,然后根据提示进行操作就行。我的.run文件是NVIDIA-Linux-x86_64-384.111.run。

3、由于之前安装cudnn 时候给gcc降级了,需要恢复到7.3

我当时没有做成功。直接卸载 gcc 和g++

sudo apt-get auto-remove gcc

sudo apt-get auto-remove g++

  236  ls -l g++*

  237  ls -l gcc*

重新安装:自动安装7.3版本。

  238  sudo apt-get install gcc

  239  sudo apt-get install g++

  240  ls -l gcc*

  241  ls -l g++*

 

3.执行完后,输入sudo service lightdm start,然后输入sudo reboot,如果有出现

The system is running in low-graphics mode,则ctrl+alt+f1 进入控制台,下面的操作参考我的另外一篇文章https://blog.csdn.net/WILLIAMMMS/article/details/80786553

How to install the NVIDIA drivers on Ubuntu 18.04 Bionic Beaver Linux

Lubos Rendek

Ubuntu 18.04

30 April 2018

The objective is to install the NVIDIA drivers on Ubuntu 18.04 Bionic Beaver Linux. This article will discuss three methods of Nvidia driver installation in the following order:

  • Automatic Install using standard Ubuntu Repository
  • Automatic Install using PPA repository to install Nvidia Beta drivers
  • Manual Install using the Official nvidia.com driver

 

七、安装显卡驱动

1、先决条件   

 检查自己电脑的gpu是否CUDA-capable

    cyg@cyg-ThinkPad-T450:~$ lspci | grep -i nvidia
    04:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940M] (rev a2)

    禁用nouveau

    cyg@cyg-ThinkPad-T450:~$ lsmod | grep nouveau

如果有输出说明nouveau正在加载

打开禁用列表

    cyg@cyg-ThinkPad-T450:~$ sudo gedit /etc/modprobe.d/blacklist.conf

在打开文本的最后一行添加:

blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

执行以下命令来禁止内核中nouveau

    cyg@cyg-ThinkPad-T450:~$ sudo echo options nouveau modeset=0 | sudo tee -a /etc/modprobe.d/nouveau-kms.conf

更新,重启

    cyg@cyg-ThinkPad-T450:~$ sudo update-initramfs -u

    cyg@cyg-ThinkPad-T450:~$ sudo reboot

再次查看是否禁用nouveau

    cyg@cyg-ThinkPad-T450:~$ lsmod | grep nouveau

 以上步骤可能是Ubuntu18.04的非必要操作,如果是单显卡主机,禁用nouveau驱动重启后可能会导致无法进入Ubuntu图像界面,可以按Ctrl+Alt+F3,Ubuntu18.04好像是F3,16.04是F1进入文本编辑界面安装NVIDI显卡驱动,可以参考这篇文章进行相应的设置。

实际上,博主在执行完以上步骤后,并没有重启电脑,直接执行以下操作,替换为英伟达驱动即完成了显卡的更新。

 

核心的为黑色斜体显示的步骤

 

Installed NVIDIA drivers on Ubuntu 18.04 Bionic Beaver. After installation, optionally run Nvidia graphic card test by following our Benchmark Your Graphics Card On Linux guide.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions

Criteria

Requirements

Operating System

Ubuntu 18.04 Bionic Beaver Linux

Software

Existing Desktop installation such as GNOME, KDE etc.

Other

Privileged access to your Linux system as root or via the sudo command.

Conventions

# - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

Automatic Install using standard Ubuntu Repository

The first method is the easiest to perform and in most cases it is the recommended approach.

 

  1. First, detect the model of your nvidia graphic card and the recommended driver. To do so execute:
  1.  $ ubuntu-drivers devices
  2. == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
  3. modalias : pci:v000010DEd00001180sv00001458sd0000353Cbc03sc00i00
  4. vendor   : NVIDIA Corporation
  5. model    : GP106 [GeForce GTX 1060 6GB]
  6. driver   : nvidia-304 - distro non-free
  7. driver   : nvidia-340 - distro non-free
  8. driver   : nvidia-390 - distro non-free recommended
  9. driver   : xserver-xorg-video-nouveau - distro free builtin
  10.  
  11. == cpu-microcode.py ==
  12. driver   : intel-microcode - distro free

显示的版本有点低,cuda10需要410以上显卡驱动,怎么办呢?更新rep,按下面操作走 Install using PPA repository to install Nvidia Beta drivers

 

From the above output we can conclude that the current system has NVIDIA GeForce GTX 680graphic card installed and the recommend driver to install is nvidia-384.

 

  1.  If you agree with the recommendation feel free to use ubuntu-drivers command again to install all recommended drivers:
  1. $ sudo ubuntu-drivers autoinstall

Alternatively, install desired driver selectively using the apt command. For example:

$ sudo apt install nvidia-340
  1. Once the installation is concluded, reboot your system and you are done.


Automatic Install using PPA repository to install Nvidia Beta drivers

Using graphics-drivers PPA repository allows us to install bleeding edge Nvidia beta drivers at the risk of unstable system.

 

  1.  To proceed first add the ppa:graphics-drivers/ppa repository into your system:
  1. $ sudo add-apt-repository ppa:graphics-drivers/ppa
  2.  
$ sudo apt update
  1. Next, identify your graphic card model and recommended driver:
  1. $ ubuntu-drivers devices
  2. == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
  3. modalias : pci:v000010DEd00001C03sv00001043sd000085ABbc03sc00i00
  4. vendor   : NVIDIA Corporation
  5. model    : GP106 [GeForce GTX 1060 6GB]
  6. driver   : nvidia-driver-390 - third-party free
  7. driver   : nvidia-driver-410 - third-party free recommended
  8. driver   : nvidia-driver-396 - third-party free
  9. driver   : xserver-xorg-video-nouveau - distro free builtin
  1. Same as with the above standard Ubuntu repository example, either install all recommended drivers automatically:
  2. 我能看到最新的415 推荐安装
  1. $ sudo ubuntu-drivers autoinstall

or selectively using the apt command. Example:

$ sudo apt install nvidia-410
  1. Once done, reboot your system.  完成后重启系统,即可成功。

Manual Install using the Official Nvidia.com driver

  1. Identify your NVIDIA VGA card.The below commands will allow you to identify your Nvidia card model:
  1. $  lshw -numeric -C display
  2. or
  3. $ lspci -vnn | grep VGA
  1. Download the Official Nvidia Driver. Using your web browser navigate to the official Nvidiawebsite and download an appropriate driver for your Nvidia graphic card. Save the file into your home directory. Example:
  1. $ ls
  2. NVIDIA-Linux-x86_64-410.73.bin
  1. Install Prerequisites. The following prerequisites are required to compile and install Nvidia driver:
  1. $ sudo dpkg --add-architecture i386
  2. $ sudo apt update
  3. $ sudo apt install build-essential libc6:i386


  1.  Next step is to disable the default nouveau Nvidia driver. Follow this guide on how to disable the default Nouveau Nvidia driver.
  2.  Make sure you reboot your system before you proceed to the next step.
  3. In order to install new Nvidia driver we need to stop the current display server. The easiest way to do this is to change into runlevel 3 using the telinit command. After executing the following linux command the display server will stop, therefore make sure you save all your current work ( if any ) before you proceed:
  1. $ sudo telinit 3

Hit CTRL+ALT+F1 and login with your username and password to open a new TTY1 session.

  1.  To start installation of Nvidia driver execute the following linux command and follow the wizard:
  1. $ bash NVIDIA-Linux-x86_64-410.73.bin

You now need to Accept License and follow the wizard to completed the installation. You man also be asked questions like:

The distribution-provided pre-install script failed!
Are you sure you want to continue? -> CONTINUE INSTALLATION
Would you like to run the nvidia-xconfig utility? -> YES 

The Nvidia driver is now installed.

  1. Reboot your system:
  1. $ sudo reboot
  1. Configure NVIDIA X Server Settings. After reboot you should be able to start NVIDIA X Server Settings app from the Activities menu.


Appendix

Error message:

WARNING: Unable to find suitable destination to install 32-bit compatibility libraries

Depending on your needs, this can be safely ignored. However, if you wish to install steam game platform this issue cannot be ignored. To resolve execute:

$ sudo dpkg --add-architecture i386
$ sudo apt update
$ sudo apt install libc6:i386

and re-run the nvidia driver installation.

ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME or create a JOB ALERT on LinuxCareers.com job portal.

DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

MORE ON LINUXCONFIG.ORG:

YOU MAY ALSO BE INTERESTED IN:

 

八、cuda10和cudnn7.4的安装

安装cuda cudnn 先下载对应支持的版本 18.04支持 cuda10,我下载最新的.run

安装cuda

执行如下命令

授权:chmod u+rw cuda_10.0.130_410.48_linux.run

   sudo sh cuda_10.0.130_410.48_linux.run

然后会出现很多需要选择的,全部选择Y,其他的的就是直接回车键默认。这个时候会自动安装最新并且最合适的显卡驱动(建议选no)。

下面很关键:

安装完毕后,如果提示安装不完全,有问题,需要执行如下过程:

再声明一下环境变量,并将其写入到 ~/.bashrc 的尾部:

sudo gedit ~/.bashrc

尾部添加:

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}}

然后设置环境变量和动态链接库,在命令行输入:

sudo gedit /etc/profile

在打开的文件末尾加入:

export PATH=/usr/local/cuda/bin:$PATH

export  LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64$LD_LIBRARY_PATH

保存之后,创建链接文件:

sudo gedit /etc/ld.so.conf.d/cuda.conf

在打开的文件中添加如下语句:

/usr/local/cuda/lib64

然后执行:

sudo ldconfig

使链接立即生效。

https://www.cnblogs.com/xiaojianliu/p/9292686.html(参考)

 

 

 

安装cudnn7.4.2

.在官网下载

https://developer.nvidia.com/rdp/cudnn-download#a-collapse42-10

要下载四个文件

cuDNN v7.4.2 Library for Linux

cuDNN v7.4.2 Runtime Library for Ubuntu18.04 (Deb)

cuDNN v7.4.2 Developer Library for Ubuntu18.04 (Deb)

cuDNN v7.4.2 Code Samples and User Guide for Ubuntu18.04 (Deb)

三.进入到文件下载目录里,比如download

在终端输入 (一定要按照顺序安装不然会出错)

tar -xzvf cudnn-10.0-linux-x64-v7.4.2.24.tgz

sudo cp cuda/include/cudnn.h /usr/local/cuda/include

sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64

sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

安装其余的包

sudo dpkg -i libcudnn7_7.4.2.24-1+cuda10.0_amd64.deb

sudo dpkg -i libcudnn7-dev_7.4.2.24-1+cuda10.0_amd64.deb

sudo dpkg -i libcudnn7-doc_7.4.2.24-1+cuda10.0_amd64.deb

2.验证cudnn 是否安装成功

cp -r /usr/src/cudnn_samples_v7/ $HOME

cd $HOME/cudnn_samples_v7/mnistCUDNN

make clean && make

./mnistCUDNN

当输出是:

 Result of classification: 1 3 5

 Test passed!

 说明cudnn安装成功!

如果出现错误说 ,出现未知error 或者abocing hp ::73 等错误 卸载cuda 重装 就不会有错!

ubuntu18.04 卸载CUDA10 CUDNN

卸载

sudo apt-get --purge remove cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48

sudo apt-get --purge remove cuda-*-10-0

 

https://developer.nvidia.com/cuda-toolkit-archive 历史版本

 

九、安装ananconda+tensorflow

 

定位到文件路径,先授权,然后安装

sudo chmod u+rw Anaconda3-2018.12-Linux-x86_64.sh

 sudo sh ./ Anaconda3-2018.12-Linux-x86_64.sh

 

使用Anaconda管理多个版本的Python环境:
假设你已安装anaconda环境则往下进行操作,否则去安装该环境

1、查看系统当前已有的Python环境,执行命令:conda info --envs
发现现在环境只有anaconda自带的python2.7环境
可以使python -V常看python版本信息
conda env list 
2、我想添加一个Python3.5的环境,
执行命令:conda create --name python35 python=3.5

source activate python35

conda create --name python27 python=2.7

source activate python27


命令中我制定了环境名称是Python35,指定了Python版本是3.5,执行命令后,
Conda 会自动下载最新版的Python3.5,并自动部署
3、再次查看当前系统已有的Python环境,执行命令:conda info --envs,从图中我们看
到,这里多了一个名字为Python35的Python环境
4、切换Python环境到刚才新添加的Python35,执行命令:source activate python35,然后执行命令:python --version,查看是否切换成功

 

括号里面操作,在ubuntu18.04 cuda10 cudnn7.4下失败。(安装TensorFlow

从:https://mirrors.tuna.tsinghua.edu.cn/help/tensorflow/ 网站选择对应的安装版本。速度比较快,目前只支持tensorflow1.5.0最高版 python2.7对应的。

输入网址:最好是google浏览器 https://mirrors.tuna.tsinghua.edu.cn/help/查找tensorflow,点开链接,然后选择对应的系统及版本,复制下面的语句,命令行执行:比如 

pip install \

  -i https://pypi.tuna.tsinghua.edu.cn/simple/ \

https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/gpu/tensorflow_gpu-1.5.0-cp27-none-linux_x86_64.whl

 

进入python

import tensorflow 实验一下,如果没有出错,说明成功了。)

环境创建完成之后,source activate激活环境。这里又有一个坑,我一开始是用pip安装TensorFlow的,即直接用了清华镜像.然而导入tensorflow的时候报错,说需要cuda9.0。。。。傻眼ing

于是又去骚扰百度。。。。。小哥哥很快给了正解,说需要用conda安装就不会报错!又一次刷新三观,学到新知识。万能的淘宝啊。

 

注意之前要先把conda换成清华镜像啊,不然下载慢到你怀疑人生。具体方法为:

 

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

 

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/

 

conda config --set show_channel_urls yes

 

然后运行指令(运行前先配置镜像channel,否则很慢)

 

conda install tensorflow-gpu=1.5.0  python3.5对应的

 

conda install tensorflow-gpu=0.12.0  python27对应的

短暂的等待后,就完成安装了。接着用spyder的用户注意了,需要重装下spyder才能调用tensorflow

 

conda install spyder

 

至此,基于RTX2080的GPU版tensorflow终于完成了。

 

缺少库的宝宝们,都到清华镜像pip安装去找啊 https://mirror.tuna.tsinghua.edu.cn/help/pypi/

 

 

5、在Python35环境下,完成工作后,切回原来的Python环境,执行命令:source deactivate Python35
6、如果刚才添加的Python27环境,不再使用,可通过执行命令:conda remove --name python27 --all,或 conda remove -n python35 --all 进行删除

注意:某虚拟环境下使用pip安装某模块如果找不到,可能该版本不支持该库;或者指定的镜像通道没有,可以尝试conda install安装,但安装的时候一定要注意安装提示信息,是否会更新虚拟环境的python版本。比如PIL的在python3.5安装,会把版本下降到python2.7,导致原来的虚拟环境变化。这是一定要注意的。

Anaconda安装与使用链接: https://blog.csdn.net/qq_31610789/article/details/80646276

 

清华镜像源download link: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/

 

 

 

十、Ubuntu 卸载 anaconda

如果需要卸载anaconda,执行如下过程:

  1. 进入安装 Anaconda 目录,用下面这个命令 
    sudo rm -r anaconda3 即可删除文件夹。

sudo rm -rf ~/.condarc

sudo rm -rf  ~/.conda

sudo rm -rf  ~/.continuum

  1. 更新路径。输入命令 
    gedit ~/.bashrc 
    注释掉或者删除“ export PATH=/home/usr/anaconda3/bin:$PATH ”,保存文档。 
    输入命令 

    source ~/.bashrc 关闭当前终端.

 

十一、pycharm安装

 

安装Pycharm专业破解版

我下载的是pycharm-professional-2018.1.4,破解补丁是JetbrainsCrack-2.8-release-enc.jar,找不到的童鞋可以留言,我发给你。

破解如下:

    解压缩pycharm-professional-2018.1.4并放在Home下,将JetbrainsCrack-2.8-release-enc.jar也复制到Home下。
    在pycharm的bin目录下找到pycharm.vmoptions和pycharm64.vmoptions,用gedit打开,均在末尾加

-javaagent:/home/guo/[pycharm-2018.2.4/]JetbrainsCrack-3.1-release-enc.jar (注意破解文件路径放哪里了)
    在bin目录运行命令sh ./pycharm.sh,选择激活码激活,输入一下激活码:

ThisCrackLicenseId-{

"licenseId":"11011",

"licenseeName":"微信公众号",

"assigneeName":"裸睡的猪",

"assigneeEmail":"1113449881@qq.com",

"licenseRestriction":"",

"checkConcurrentUse":false,

"products":[

{"code":"II","paidUpTo":"2099-12-31"},

{"code":"DM","paidUpTo":"2099-12-31"},

{"code":"AC","paidUpTo":"2099-12-31"},

{"code":"RS0","paidUpTo":"2099-12-31"},

{"code":"WS","paidUpTo":"2099-12-31"},

{"code":"DPN","paidUpTo":"2099-12-31"},

{"code":"RC","paidUpTo":"2099-12-31"},

{"code":"PS","paidUpTo":"2099-12-31"},

{"code":"DC","paidUpTo":"2099-12-31"},

{"code":"RM","paidUpTo":"2099-12-31"},

{"code":"CL","paidUpTo":"2099-12-31"},

{"code":"PC","paidUpTo":"2099-12-31"}

],

"hash":"2911276/0",

"gracePeriodDays":7,

"autoProlongated":false}

到期时间为2099年,基本为永久啦。这里参考了博客,在此感谢:

https://blog.csdn.net/u014044812/article/details/78727496。、

 

十二、安装Keras

1、创建一个环境,指定python版本

$ conda create -n tf python=3.6

 

2、激活创建的tf环境:

$ conda activate tf 或者 $ source activate tf

在该环境下安装tensorflow-gpu及keras框架:

$ conda install tensorflow-gpu keras

4、查看安装是否成功

$ python
>>import keras
  import tensorflow

5、安装其他所需要的库

$ conda install pillow
$ conda install matplotlib
$ conda install scikit-learn
$ conda install graphviz pydot

6、退出该环境

$ conda deactivate  或者  source deactivate

7、移除tf环境

$ conda remove -n tf --all

8、查看GPU运行状况

$ watch -n 0 nvidia-smi  
---------------------  
作者:背包客w  
来源:CSDN  
原文:https://blog.csdn.net/weixin_39954229/article/details/79961172  
版权声明:本文为博主原创文章,转载请附上博文链接!


十三、安装jupyter

pi3 install jupyter
jupyter notebook --generate-config

jupyter notebook
 

十四、安装pytorch-cpu

conda install pytorch torchvision cuda100 -c pytorch

cuda10下安装命令

老版本:

https://pytorch.org/get-started/previous-versions/

最新版本:

https://pytorch.org/

 conda install pytorch-cpu=0.4.1 torchvision-cpu -c pytorch  无gpu版本安装,指定版本号
torchvision

 

 

INSTALLING PREVIOUS VERSIONS OF PYTORCH

We’d prefer you install the latest version, but old binaries and installation instructions are provided below for your convenience.

Via conda

This should be used for most previous macOS version installs.

To install a previous version of PyTorch via Anaconda or Miniconda, replace “0.4.1” in the following commands with the desired version (i.e., “0.2.0”).

Installing with CUDA 9

conda install pytorch=0.4.1 cuda90 -c pytorch

or

conda install pytorch=0.4.1 cuda92 -c pytorch

Installing with CUDA 8

conda install pytorch=0.4.1 cuda80 -c pytorch

Installing with CUDA 7.5

conda install pytorch=0.4.1 cuda75 -c pytorch

Installing without CUDA

conda install pytorch=0.4.1 -c pytorch

From source

It is possible to checkout an older version of PyTorch and build it. You can list tags in PyTorch git repository with git tag and checkout a particular one (replace ‘0.1.9’ with the desired version) with

git checkout v0.1.9

Follow the install from source instructions in the README.md of the PyTorch checkout.

Via pip

Download the whl file with the desired version from the list below, and run

pip install /path/to/whl/file

You can also directly pass a URL to pip:

pip install https://download.pytorch.org/whl/cu80/torch-0.4.1-cp36-cp36m-linux_x86_64.whl

If you want no CUDA support, the URL would be something like https://download.pytorch.org/whl/cpu/torch-0.4.1-cp36-cp36m-linux_x86_64.whl

There are seven major lists below: Linux binaries compiled with CUDA 9.2, 9.1, 9.0, 8 and 7.5 support, Windows support, and Mac OSX & miscellaneous other binaries.

PyTorch Linux binaries compiled with CUDA 9.2

PyTorch Linux binaries compiled with CUDA 9.1

PyTorch Linux binaries compiled with CUDA 9.0

PyTorch Linux binaries compiled with CUDA 8

PyTorch Linux binaries compiled with CUDA 7.5

Linux No CUDA binaries

Windows binaries

Mac and misc. binaries

For recent macOS binaries, use conda:

e.g.,

conda install pytorch=0.4.1 cuda90 -c pytorch conda install pytorch=0.4.1 cuda92 -c pytorch conda install pytorch=0.4.1 cuda80 -c pytorch conda install pytorch=0.4.1 -c pytorch # No CUDA

 

备注1:

 

CUDA 版本,显卡驱动,Ubuntu版本,GCC版本之间的对应关系

2018年10月28日 15:14:38 zl535320706 阅读数:132

显卡驱动与CUDA版本对应关系

https://i-blog.csdnimg.cn/blog_migrate/41fb0681b28a9bd7d9e41b97a6751955.png

来源:https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html

CUDA版本与Ubuntu 版本,以及GCC版本对应关系

  • CUDA 8.0

https://i-blog.csdnimg.cn/blog_migrate/041313376735d40001dcfa51c8b9bf08.png

来源:https://docs.nvidia.com/cuda/archive/8.0/cuda-installation-guide-linux/index.html

  • CUDA 9.0

https://i-blog.csdnimg.cn/blog_migrate/367da56191e91add521dbf0f3f98cc64.png

来源:https://docs.nvidia.com/cuda/archive/9.0/cuda-installation-guide-linux/index.html

  • CUDA 10.0

https://i-blog.csdnimg.cn/blog_migrate/ce0ef160831e4da58f61ef05d4e64eb7.png

备注2:

 

查看 CUDA cudnn 版本 查看Navicat GPU版本 查看nvidia 驱动版本

2017年12月20日 20:21:53 青盏 阅读数:6986

查看 CUDA cudnn 版本

cuda 版本 
cat /usr/local/cuda/version.txt
 
cudnn 版本 
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

 

查看Navicat GPU版本

nvidia-smi
//10s显示一次
watch -n 10 nvidia-smi
  •  
nvidia-smi -l

查看nvidia 驱动版本

cat /proc/driver/nvidia/version
  •  

硬件层面判断主板是否识别显卡:

lspci | grep NVIDIA
lspci | grep VGA
# VGA compatible controller: NVIDIA Corporation Device 1b02

 

  • 2
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值