Skip to content

Commit 3caef27

Browse files
committed
Linux 常用问题解决方案汇总
1 parent 777419d commit 3caef27

File tree

2 files changed

+155
-0
lines changed

2 files changed

+155
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
本仓库下存放个人博客的源文件。持续更新,欢迎 `star`
44

5+
如果大家觉得那里写的不合适的可以给我提 `Issue`
6+
57
---
68

79
## 目录简介
@@ -26,6 +28,7 @@
2628
| |-- enable-IPv6.md
2729
| |-- 科学上网之代理服务器配置.md
2830
| |-- compile-install-lastest-Git.md
31+
| |-- linux常用问题解决方案汇总.md
2932
| `-- log4j2.md
3033
|-- java-api
3134
| `-- java.lang.md
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
## Linux 常用问题解决方案汇总
2+
3+
之前的解决方法都是从网上找资料,然后记录到为知笔记里,但这一点,那一点,查找的时候很不方便。写这篇汇总目的是方便以后使用时查阅。同时也希望能够帮到大家。
4+
5+
<!-- TOC -->
6+
7+
- [Linux 常用问题解决方案汇总](#linux-常用问题解决方案汇总)
8+
- [Linux 下制作启动盘](#linux-下制作启动盘)
9+
- [安装 CentOS](#安装-centos)
10+
- [删除内核升级后多余的启动项](#删除内核升级后多余的启动项)
11+
- [恢复 Windows 启动项](#恢复-windows-启动项)
12+
- [配置字体](#配置字体)
13+
14+
<!-- /TOC -->
15+
16+
---
17+
18+
19+
### Linux 下制作启动盘
20+
21+
1. 查看 U 盘所对应的分区
22+
1. 使用 `dd` 命令写入镜像
23+
1. 写入以后即可使用。**特别注意的是 `dd` 命令写入以后 U 盘会变成只读的,如果安装完系统之后不打算将其专门作为启动盘的话还需要将 U 盘恢复一下,稍后会作简要介绍**
24+
25+
```
26+
[chen@localhost Downloads]$ df -hl
27+
Filesystem Size Used Avail Use% Mounted on
28+
/dev/sda5 197G 21G 167G 11% /
29+
devtmpfs 3.8G 0 3.8G 0% /dev
30+
tmpfs 3.8G 8.0M 3.8G 1% /dev/shm
31+
tmpfs 3.8G 34M 3.8G 1% /run
32+
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
33+
tmpfs 775M 28K 775M 1% /run/user/1001
34+
tmpfs 775M 0 775M 0% /run/user/0
35+
/dev/sdb1 15G 8.0K 15G 1% /run/media/chen/CentOS 7 x86_64
36+
37+
// sdb 是设备号,sdb1 是分区号,sdb1 是设备 sdb 的第一个分区
38+
[chen@localhost Downloads]$ sudo dd bs=4M if=CentOS-7-x86_64-Everything-1611.iso of=/dev/sdb
39+
[sudo] password for chen:
40+
1974+1 records in
41+
1974+1 records out
42+
8280604672 bytes (8.3 GB) copied, 878.385 s, 9.4 MB/s
43+
44+
```
45+
46+
- 恢复 U 盘正常使用
47+
48+
```
49+
[chen@localhost Downloads]$ df -hl
50+
Filesystem Size Used Avail Use% Mounted on
51+
/dev/sda5 197G 21G 167G 11% /
52+
devtmpfs 3.8G 0 3.8G 0% /dev
53+
tmpfs 3.8G 8.0M 3.8G 1% /dev/shm
54+
tmpfs 3.8G 34M 3.8G 1% /run
55+
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
56+
tmpfs 775M 28K 775M 1% /run/user/1001
57+
tmpfs 775M 0 775M 0% /run/user/0
58+
/dev/sdb1 15G 8.0K 15G 1% /run/media/chen/CentOS 7 x86_64
59+
60+
[chen@localhost ~]$ sudo mkfs.vfat /dev/sdb1
61+
mkfs.fat 3.0.20 (12 Jun 2013)
62+
63+
```
64+
65+
### 安装 CentOS
66+
67+
1. 查看 U 盘对应分区
68+
1. 修改引用位置
69+
1. 安装
70+
71+
```
72+
//直接选择安装的话可能会出现找不到位置的错误并且进入以下模式:
73+
74+
dracut:/#
75+
76+
// 查看 U 盘对应分区
77+
dracut:/# ls /dev/
78+
79+
接下来找到以sd开头的,有的是sdd,有的是sdb,还有的是sdc,不过貌似一般都是sdb,这里你可以看到以sdb开头的文件有两个分别是sdb和sdb1,sdb1代表的就是你的U盘了,这里是假设你看到的是sdb1,我的显示是sdb4,记住你看到的是哪个。
80+
然后重新开机
81+
82+
// 修改引用位置
83+
进入安装页时按 TAB 键,下面会出现
84+
append initrd=initrd.img root=live:CDLABEL=Fedora\x2017\x20i386 quiet
85+
这时你把后面改为 append initrd=initrd.img repo=hd:/dev/sdb1:/ quiet
86+
87+
//安装
88+
```
89+
90+
### 删除内核升级后多余的启动项
91+
92+
1. 查看当前使用的内核版本
93+
1. 查看已安装的内核版本
94+
1. 使用包管理器卸载版本较旧的内核版本
95+
96+
```
97+
[chen@localhost ~]$ uname -a
98+
Linux localhost.localdomain 3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
99+
100+
[chen@localhost ~]$ rpm -qa | sort | grep kernel
101+
abrt-addon-kerneloops-2.1.11-45.el7.centos.x86_64
102+
kernel-3.10.0-514.10.2.el7.x86_64
103+
kernel-3.10.0-514.el7.x86_64
104+
kernel-devel-3.10.0-514.10.2.el7.x86_64
105+
kernel-devel-3.10.0-514.el7.x86_64
106+
kernel-headers-3.10.0-514.10.2.el7.x86_64
107+
kernel-tools-3.10.0-514.10.2.el7.x86_64
108+
kernel-tools-libs-3.10.0-514.10.2.el7.x86_64
109+
110+
[root@localhost chen]# yum remove kernel-*3.10.0-514.el7.x86_64
111+
Loaded plugins: fastestmirror, langpacks
112+
Resolving Dependencies
113+
--> Running transaction check
114+
---> Package kernel.x86_64 0:3.10.0-514.el7 will be erased
115+
---> Package kernel-devel.x86_64 0:3.10.0-514.el7 will be erased
116+
--> Finished Dependency Resolution
117+
118+
Dependencies Resolved
119+
120+
================================================================================
121+
Package Arch Version Repository Size
122+
================================================================================
123+
Removing:
124+
kernel x86_64 3.10.0-514.el7 @anaconda 148 M
125+
kernel-devel x86_64 3.10.0-514.el7 @anaconda 34 M
126+
127+
Transaction Summary
128+
================================================================================
129+
Remove 2 Packages
130+
131+
Installed size: 182 M
132+
Is this ok [y/N]: y
133+
...
134+
```
135+
136+
### 恢复 Windows 启动项
137+
138+
1. 添加 EPEL 源
139+
1. 安装 ntfs-3g
140+
1. 重新生成引导项
141+
142+
```
143+
# yum install epel-release
144+
# yum install ntfs-3g
145+
# grub2-mkconfig -o /boot/grub2/grub.cfg
146+
```
147+
148+
### 配置字体
149+
150+
1. 下载喜欢的字体
151+
1. 将 xxx.ttf 文件移动到`~/.fonts/`
152+
1. 添加字体缓存 `fc-cache ~/.fonts/`

0 commit comments

Comments
 (0)