记一次十分折腾的Ubuntu20.04安装

这次装Ubuntu真是折腾,究其原因,就是这个新电脑的固态硬盘开始时采用了MBR分区。

我制作的启动盘采用UEFI引导,所以一直找不到固态硬盘上已经安装的Windows10系统。

搜了一堆子资料,最后把整个固态硬盘格式化,改为GUID分区格式,或者叫做GPT(非CSM),大致就是GPT分区是比较MBR先进的吧。

这样保持一致,就可以找到系统上的Widnows Boot Manager了。无语子

——————————————————

中间折腾的过程中,

采用Bios引导,就是那个legacy模式引导,能够成功吧ubuntu安装上,可是死活找不到其他驱动,显示分辨率也变成了640*480,而且不能改。 

uefi和legacy是两种不同的引导方式,uefi是新式的BIOS,legacy是传统BIOS

__________________________________

Ubuntu系统安装完毕后首先升级一下系统

sudo apt update
sudo apt upgrade

增加仓库 

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

 然后再软件和更新里面选择出现的附加驱动安装。(失败,选择不同的源都不行,下载不动)

 ------------------------------------------------------------------

RTX 4090显卡驱动

于是,手动安装RTX 4090显卡驱动

手动下载驱动:https://www.nvidia.cn/geforce/drivers/

https://blog.csdn.net/baidu_41617231/article/details/135840995

赋予权限:sudo chmod +x NVIDIA-Linux-x86_64-384.59.run
运行安装文件: sudo ./NVIDIA-Linux-x86_64-384.59.run

具体参考:https://blog.csdn.net/Johntill/article/details/132302632

安装RTX显卡驱动成功之后显示:

yhexie@ntu:~$ nvidia-smi
Tue Apr 23 18:54:37 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.54.14              Driver Version: 550.54.14      CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 4090 D      Off |   00000000:01:00.0  On |                  Off |
|  0%   32C    P8             21W /  425W |     671MiB /  24564MiB |     30%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+
                                                                                         
+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|    0   N/A  N/A      1155      G   /usr/lib/xorg/Xorg                            102MiB |
|    0   N/A  N/A      1591      G   /usr/lib/xorg/Xorg                            231MiB |
|    0   N/A  N/A      1718      G   /usr/bin/gnome-shell                          134MiB |
|    0   N/A  N/A      2146      G   /usr/lib/firefox/firefox                      165MiB |
+-----------------------------------------------------------------------------------------+

CUDA Toolkit

查看CUDA Toolkit与CUDA显卡驱动的对应关系:https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/

下载CUDA Toolkit 11.8  https://developer.nvidia.com/cuda-toolkit-archive

这里踩坑了,不能采用deb安装包,因为里面包含一个520.61的显卡驱动,会冲掉之前安装的550.54.14版本驱动。需要采用run安装包,安装过程中不选择安装520.61版本的驱动。

接着配置CUDA Toolkit环境变量:

sudo gedit ~/.bashrc
在最后添加:
    export CUDA_HOME=/usr/local/cuda-11.8
    export PATH=$PATH:/usr/local/cuda-11.8/bin
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.8/lib64

更新环境:

source ~/.bashrc

检查是否成功:

nvcc -V
yhexie@ntu:~$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:33:58_PDT_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0

------------------------------------------------------------------------

安装CuDNN

地址:https://developer.nvidia.com/rdp/cudnn-download

登录,下载cudnn-local-repo-ubuntu2004-8.9.5.30_1.0-1_amd64.deb安装包

sudo dpkg -i cudnn-local-repo-ubuntu2004-8.9.5.30_1.0-1_amd64.deb

sudo cp /var/cudnn-local-repo-ubuntu2004-8.9.5.30/cudnn-local-B731B5EB-keyring.gpg /usr/share/keyrings/

sudo apt-get update

sudo apt-get install libcudnn8=8.9.5.30-1+cuda11.8
sudo apt-get install libcudnn8-dev=8.9.5.30-1+cuda11.8
sudo apt-get install libcudnn8-samples=8.9.5.30-1+cuda11.8

用编译的例子测试:

yhexie@ntu:~/cudnn_samples_v8/mnistCUDNN$ ./mnistCUDNN
Executing: mnistCUDNN
cudnnGetVersion() : 8905 , CUDNN_VERSION from cudnn.h : 8905 (8.9.5)
Host compiler version : GCC 9.4.0

There are 1 CUDA capable devices on your machine :
device 0 : sms 114  Capabilities 8.9, SmClock 2520.0 Mhz, MemSize (Mb) 24207, MemClock 10501.0 Mhz, Ecc=0, boardGroupID=0
Using device 0

Testing single precision


-------------------------------------------------------------------------------------------

无线网卡EW-7822UAD驱动安装:

cd ./Wireless-EW-7822UAD_Linux_Driver/88x2bu-20210702-main

make clean

sudo make

sudo make install

https://blog.csdn.net/Junna_zeng/article/details/130430049

----------------------------------------------------------------------

Ubuntu 20.04安装和深度学习环境搭建 4090显卡

https://blog.csdn.net/qq_43775794/article/details/131770933

Ubuntu18-22.04安装和干净卸载nvidia显卡驱动——超详细、最简单_ubuntu安装nvidia显卡驱动-CSDN博客

posted @ 2024-04-06 16:08  太一吾鱼水  阅读(623)  评论(0编辑  收藏  举报