-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 提交内核相关文章 * 提交安装显卡驱动相关文章 * 更新安装双系统文章 * 初步提交GRUB2文章 * 增加了GRUB2与引导扇区相关内容
- Loading branch information
Showing
56 changed files
with
474 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
# 优麒麟双系统安装教程 | ||
|
||
## 基本概念 | ||
|
||
### MBR与GPT | ||
|
||
MBR是Master Boot Record的缩写,中文为主引导扇区或主引导记录,是计算机开机访问硬盘时所必须要读取的首个扇区,在硬盘中的位置自然也是最前面。MBR记录了硬盘本身的相关信息,硬盘各个分区的大小及位置信息和结束标志字(用来检验主引导记录是否有效)。可见如果硬盘上的MBR被损坏,那么就无法读取硬盘的相关信息。此外MBR最高只支持2TB的硬盘 | ||
|
||
GPT是GUID Partition Table的缩写,中文为全局唯一标识分区表。同样的也保存了硬盘上分区有关的信息,同时没有了MBR最高只支持识别2TB的限制,最大支持18EB的大容量(EB=1024 PB,PB=1024 TB)。 | ||
|
||
### BIOS与UEFI | ||
|
||
BIOS是"Basic Input Output System"的缩略词,直译过来后中文名称就是"基本输入输出系统"。UEFI全称Unified Extensible Firmware Interface,即“统一的可扩展固件接口”,是一种详细描述全新类型接口的标准,是适用于电脑的标准固件接口,旨在代替BIOS。UEFI相比于BIOS做了诸多改进,但这并不是我们今天要关注的主要内容,上面提到的GBR,MBR就分别对应UEFI和BIOS读取的分区表类型。 | ||
|
||
而现在大多数的新电脑都支持UEFI启动,UEFI采用了向后兼容,所以BIOS切换为UEFI不可以,而UEFI切换为BIOS是可以的。同样的,优麒麟也支持从UEFI启动 | ||
|
||
|
||
## 工具准备 | ||
|
||
8G U盘一个。一块20G以上的空闲硬盘分区。优麒麟镜像,etcher软件。 | ||
|
||
## 启动盘制作 | ||
|
||
首先访问[官网](https://www.ubuntukylin.com/downloads/osdownload-cn.html),下载20.04LTS Pro的系统镜像。将事先准备好的U盘中数据备份,制作启动盘时需要将U盘格式化。下面介绍两种制作启动盘的方式。 | ||
### Windows环境下 | ||
|
||
#### 软碟通 | ||
下载软件[软碟通](https://cn.ultraiso.net/),用于制作启动盘。 | ||
|
||
 | ||
|
||
安装完成后打开软碟通,点击**继续试用**。 | ||
|
||
 | ||
|
||
左上角文件选择打开下载好的优麒麟镜像。 | ||
|
||
 | ||
选择写入硬盘映像。 | ||
|
||
 | ||
选择要写入的U盘,其他设置根据自己需要设置即可,一般情况下默认设置足以满足我们的需要。设置完成后点击写入等待完成即可。 | ||
|
||
 | ||
|
||
#### etcher | ||
下载软件[etcher](https://www.balena.io/etcher/),用于制作启动盘。 | ||
|
||
下载完成后打开,选择刚才下载好的镜像与要作为启动盘的U盘,即可开始制作启动盘。 | ||
|
||
 | ||
|
||
### Linux环境下 | ||
#### etcher | ||
ether同样有Linux发行包,只需要从官网下载对应版本,重复Windows下操作即可 | ||
#### dd | ||
``sudo fdisk -l``列出系统中设备的名称,找出启动盘在**Device**字段下的名称,形如**/dev/sda1** | ||
|
||
执行``sudo dd if=优麒麟镜像路径 of=U盘设备名 bs=4M``命令来制作启动盘.其中if指定输入文件,在这里就是我们的优麒麟镜像, of指定输出文件,这里就是待制作的启动盘. | ||
|
||
使用``dd``命令制作完启动盘后,会发现在Windows环境下可能无法识别,此时可以在安装好的linux环境中执行以下命令 | ||
```bash | ||
sudo wipefs --all /dev/sdx //首先使用wipefs命令删除ISO9660文件系统标记 | ||
sudo fdisk /dev/sdx //然后对U盘进行重新分区 | ||
//进入到fdisk命令操作中后,分别执行d操作(删除原有分区)、n操作(根据提示重建分区)、w操作(保存分区表并退出) | ||
sudo mkfs.exfat /dev/sdx //格式化U盘 | ||
``` | ||
其中``/dev/sdx``是U盘在Linux系统下的设备名,mkfs.exfat是格式化的文件格式. | ||
|
||
## 准备工作 | ||
|
||
首先准备好一块剩余容量足够大的磁盘(推荐剩余空间20G以上),在开始菜单点击右键,选择**磁盘管理**。 | ||
|
||
<img src="%E4%BC%98%E9%BA%92%E9%BA%9F%E5%8F%8C%E7%B3%BB%E7%BB%9F%E5%AE%89%E8%A3%85%E6%95%99%E7%A8%8B.assets/image-20210730160534134.png" alt="image-20210730160534134" style="zoom:50%;" /> | ||
|
||
|
||
|
||
打开后如下图所示 | ||
 | ||
|
||
选择要安装系统的磁盘,这里是C盘,右键点击,在弹出菜单中选择**压缩卷**。待系统查询完可压缩空间后会弹窗提示输入压缩空间量。 | ||
|
||
 | ||
|
||
点击压缩后会生成一块未分配的空间 | ||
|
||
 | ||
|
||
这未分配的磁盘空间就用来安装我们的优麒麟系统。 | ||
|
||
## 进入BIOS | ||
|
||
在Windows系统启动前进入电脑的BIOS系统。根据电脑的主板、品牌及型号的不同,进入BIOS的按键也不尽相同,常用的快捷键为< Esc,F8,F9,F10,F11,F12>。 示例中的笔记本是华硕玩家国度,按下F2进入BIOS,其余机型可以在互联网上查阅到。 | ||
|
||
 | ||
|
||
成功从启动盘启动后进入系统安装选项界面,这里可以选择在不安装优麒麟的情况下使用,但是我们的目的是安装双系统,所以选择第三个**Install Ubuntu Kylin**。 | ||
|
||
选择安装优麒麟之后首先选择语言: | ||
|
||
 | ||
|
||
选择地区: | ||
|
||
 | ||
|
||
创建用户及密码: | ||
|
||
 | ||
|
||
选择安装方式,20版本的优麒麟提供了快速安装和自定义安装两种安装方式。如果我们的电脑上有空闲的硬盘则可以直接在快速安装中选中空闲的硬盘进行安装。但是大多数情况下我们希望自己的优麒麟系统能和Windows系统共存在C盘上。那么就需要选择自定义安装。 | ||
|
||
 | ||
|
||
电脑本机上的分区表: | ||
|
||
 | ||
|
||
在自定义安装中可以看到本台电脑上硬盘的分区表。可以看到第一块硬盘被分成了三个区,分别简记为``p1``,``p2``,``p3``。其中``p3``是我们在进入优麒麟安装系统之前预先准备好的空闲的分区。需要指出的是我们不能直接在这里点击下一步,会提示需要挂载到根分区。观察分区表的中间部分,有一个**mounted**的字段。这个字段下面的值就是反映了当前的设备被挂载到什么分区下。 | ||
|
||
我们删除``p3``对应的分区表,新建一个``/``分区和``/home``分区,大小是准备的空闲分区的一半。下图中显示新建一个分区需要指定的参数,如 | ||
|
||
* 新分区相对剩余空间的位置 | ||
* 用于什么设备 | ||
* 分区空间大小 | ||
* 分区挂载点 | ||
|
||
而所谓的**根分区**,就是下图中的``/``挂载点。 | ||
|
||
 | ||
|
||
挂载完成后如图所示,将原来的``p3``分成了两个等大小的新设备``p3``,``p4``,分别挂载到了``/``和``/home``下。完成了分区表的创建,我们就可以点击下一步继续安装。 | ||
|
||
 | ||
|
||
点击下一步后,点击开始安装就会触发优麒麟的安装过程。 | ||
|
||
 | ||
|
||
成功安装系统后重启进入BIOS,设置优麒麟为第一启动项。 | ||
|
||
 | ||
|
||
整个操作系统的安装过程就完成了。 | ||
|
||
## 常见问题 | ||
|
||
### 安装完成后重启直接进入Windows | ||
在BIOS设置中对启动顺序进行了规定,在安装优麒麟之前电脑默认的第一启动项是Windows的启动路径,在安装完成后需要修改第一启动路径为优麒麟,具体设置方式根据各种电脑型号进行设置。如上图中电脑的第一启动项就是优麒麟,第二启动项为Windows。 | ||
|
||
### 安装完成后重启直接进入优麒麟 | ||
|
||
在安装完成重启之后,如果依然出现下图中的情况 | ||
|
||
 | ||
|
||
则仍然是BIOS启动设置没有设置好的缘故。在之前的安装中设置了U盘为第一启动项,而重启之前没有把BIOS的第一启动项设为。把U盘拔出,或者设置磁盘中的优麒麟为第一启动项即可解决。 | ||
|
||
## 删除Ubuntu | ||
|
||
如果遇到无法解决的问题,或者因为其他原因需要删除优麒麟,可以通过以下方式: | ||
|
||
### 删除已安装的优麒麟分区 | ||
|
||
 | ||
|
||
图中**磁盘1**的120.00GB的主分区和118.21GB的主分区就是安装了优麒麟系统的分区。这里选择删除卷。 | ||
|
||
 | ||
|
||
点击**删除卷**,会弹出以上提示。选择**是**。 | ||
|
||
 | ||
|
||
删除后如图所示。重启电脑,进入BIOS,设置Windows为第一启动项。 | ||
|
||
进入[DiskGenius](https://www.diskgenius.cn/)的官网,下载软件,准备修复主引导记录。正如之前所提到的。每个磁盘的最开始的地方都用来存放了这个磁盘的分区相关信息。当我们把优麒麟删除之后对应的分区表也就遭到了破坏(对不上号),所以需要重建分区表。这里的话可以将删除优麒麟产生的新的空间扩展给原来的C盘空间,同时也有助于我们后面重建分区表。 | ||
|
||
 | ||
|
||
分区搜索完成后点击左上角保存分区保存分区表时会让我们选择保存的分区表类型,MBR或者GUID,选择GUID即可,分区表重建到此完成。重启电脑即可。 |
Oops, something went wrong.
Binary file added
BIN
+145 KB
2.安装显卡驱动及CUDA/优麒麟20.04环境下显卡驱动与CUDA11.4的安装.assets/2021-07-30_22-57-28.png
Oops, something went wrong.
Binary file added
BIN
+262 KB
2.安装显卡驱动及CUDA/优麒麟20.04环境下显卡驱动与CUDA11.4的安装.assets/2021-07-30_22-58-02.png
Oops, something went wrong.
Binary file added
BIN
+306 KB
2.安装显卡驱动及CUDA/优麒麟20.04环境下显卡驱动与CUDA11.4的安装.assets/2021-07-30_23-04-44.png
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+582 KB
2.安装显卡驱动及CUDA/优麒麟20.04环境下显卡驱动与CUDA11.4的安装.assets/3打开Server Setting.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+277 KB
2.安装显卡驱动及CUDA/优麒麟20.04环境下显卡驱动与CUDA11.4的安装.assets/verify_1-16276303817781.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# 优麒麟20.04环境下显卡驱动与CUDA11.4的安装 | ||
|
||
## 显卡驱动安装 | ||
|
||
### 禁用nouveau | ||
这里先解释下何为nouveau以及我们为什么要禁用它 | ||
> 首先说明下什么是Nouveau,为什么有些系统安装N卡驱动的时候会提示“ERROR: The Nouveau kernel driver is currently in use by your system. This driver is incompatible with the NVIDIA driver……”之类的错误。 | ||
> Nouveau是由第三方为NVIDIA显卡开发的一个开源3D驱动,也没能得到NVIDIA的认可与支持。虽然Nouveau Gallium3D在游戏速度上还远远无法和NVIDIA官方私有驱动相提并论,不过确让Linux更容易的应对各种复杂的NVIDIA显卡环境,让用户安装完系统即可进入桌面并且有不错的显示效果,所以,很多Linux发行版默认集成了Nouveau驱动,在遇到NVIDIA显卡时默认安装。企业版的Linux更是如此,几乎所有支持图形界面的企业Linux发行版都将Nouveau收入其中。 | ||
> 不过对于个人桌面用户来说,处于成长阶段的Nouveau并不完美,与企业版不一样,个人用户除了想让正常显示图形界面外很多时候还需要一些3D特效,Nouveau多数时候并不能完成,而用户在安装NVIDIA官方私有驱动的时候Nouveau又成为了阻碍,不干掉Nouveau安装时总是报错。报错提示见文第一段 | ||
首先我们需要见检查一下自己的Ubuntu系统是否有nouveau在运行,打开terminal,输入 | ||
```bash | ||
lsmod | grep nouveau | ||
``` | ||
如果有输出即说明nouveau正在运行 | ||
|
||
### 优麒麟下禁用nouveau | ||
打开terminal,输入 | ||
```bash | ||
sudo gedit /etc/modprobe.d/blacklist.conf | ||
``` | ||
之后再输入密码,打开blacklist.conf,在文件的最后输入 | ||
```bash | ||
blacklist nouveau | ||
options nouveau modset=0 | ||
``` | ||
保存后退出,再在terminal中输入 | ||
```bash | ||
$ sudo update-initramfs -u | ||
``` | ||
来更新配置文件 | ||
我在第一次和后几次安装之后都出现了禁用nouveau重启,分辨率强制改为**800$\times$ 600**的情况。因此需要在这个别别扭扭的分辨率下完成N卡驱动的安装 | ||
|
||
##### N卡驱动安装 | ||
* 输入如下命令更新apt库``$ apt-get update`` | ||
* 再检测电脑的N卡模型和推荐的驱动程序模型``$ ubuntu-drivers devices`` | ||
笔者的电脑输入之后的信息是这样子的 | ||
|
||
 | ||
|
||
可以看到在driver这一栏列出了可以安装的driver的型号,并且推荐安装的是470版本,这里笔者选择的是390版本 | ||
|
||
* 继续在命令行输入``$ sudo apt-get install nvidia-driver-470``来执行安装。或者也可以``$ sudo ubuntu-drivers autoinstall``来安装所有的驱动,接下来就是漫长的等待 | ||
|
||
 | ||
|
||
* 安装完成之后屏幕的分辨率还是**800$\times$ 600** 但是重启之后就会变成适合的分辨率(在我的机型上是**1920 $\times$ 1080**) | ||
* 重启后输入``$ nvidia-setting``与``$ nvidia-smi``分别会弹出N卡的设置框与监视框,到此N卡驱动安装与nouveau的禁用就完成了 | ||
|
||
 | ||
|
||
|
||
|
||
## CUDA安装 | ||
在CUDA的官网我们可以看到对于Linux版本有不同的分支和安装方式选择,这里我建议的是使用**deb(local)**方式安装 | ||
|
||
 | ||
|
||
点击deb(local)之后按照下面的指令一步一步跟着来就好,而且指令中包含了**安装文件**和**安装公钥**两个步骤,即``$ sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb ``和``$ sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub`` | ||
|
||
 | ||
|
||
 | ||
|
||
然后进入/usr/local目录下可以看到cuda和cuda-10.2两个文件夹,表明安装成功. | ||
|
||
<img src="E:/usrlocal%E6%96%87%E4%BB%B6%E5%A4%B9.png" alt="usrlocal文件夹" style="zoom:67%;" /> | ||
|
||
|
||
#### 环境配置 | ||
打开terminal,输入 | ||
```bash | ||
sudo gedit ~/.bashrc | ||
``` | ||
在文件的末尾添加上这两行,并保存 | ||
```bash | ||
export CUDA_HOME=/usr/local/cuda | ||
export PATH=$PATH:$CUDA_HOME/bin | ||
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} | ||
``` | ||
|
||
截图下面三行即是我们需要输入并保存的东西,保存之后在终端输入``source ~/.bashrc``使我们的环境变量生效,最后测试下我们的CUDA是否安装完成 | ||
|
||
<img src="%E4%BC%98%E9%BA%92%E9%BA%9F20.04%E7%8E%AF%E5%A2%83%E4%B8%8B%E6%98%BE%E5%8D%A1%E9%A9%B1%E5%8A%A8%E4%B8%8ECUDA11.4%E7%9A%84%E5%AE%89%E8%A3%85.assets/modifyBashrc.png" alt="modifyBashrc" style="zoom:67%;" /> | ||
|
||
* 方案一 | ||
在终端输入 | ||
```bash | ||
nvcc -V | ||
``` | ||
如果输出了CUDA的相关信息,则说明我们的CUDA安装成功 | ||
|
||
<img src="%E4%BC%98%E9%BA%92%E9%BA%9F20.04%E7%8E%AF%E5%A2%83%E4%B8%8B%E6%98%BE%E5%8D%A1%E9%A9%B1%E5%8A%A8%E4%B8%8ECUDA11.4%E7%9A%84%E5%AE%89%E8%A3%85.assets/verify_1-16276303817781.png" alt="verify_1" style="zoom:80%;" /> | ||
|
||
|
||
* 方案二 运行安装过程中的样例 | ||
```bash | ||
cd /usr/local/cuda/samples/1_Utilities/deviceQuery | ||
sudo make | ||
./deviceQuery | ||
``` | ||
如果在打开./devicyQuery后有正常的输出结果的话也说明我们的CUDA安装完成了。 | ||
|
||
 | ||
|
||
|
||
至此,我们在Ubuntu18.04环境下的安装CUDA工作就已经全部完成 |
Oops, something went wrong.