Skip to content

Commit 91cdb41

Browse files
committed
update
1 parent c1921c9 commit 91cdb41

File tree

10 files changed

+132
-12
lines changed

10 files changed

+132
-12
lines changed

.jekyll/sass/custom/custom.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
}
6767

6868
h1, .text-alpha {
69-
font-size: 1.7rem !important;
69+
font-size: 1.8rem !important;
7070
font-weight: 500;
7171
}
7272

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
6868
- [K8S](#k8s)
6969
- [语言设计](#语言设计)
7070
- [Linux](#linux)
71+
- [Debian](#debian)
7172
- [Systemd](#systemd)
7273
- [Language Server Protocol (LSP)](#language-server-protocol-(lsp))
7374
- [Lua](#lua)
@@ -443,6 +444,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
443444
- [硬盘分区](linux/disk-partition.md)
444445
- [dmesg](linux/dmesg.md)
445446
- [dnsmasq](linux/dnsmasq.md)
447+
- [dpkg](linux/dpkg.md)
446448
- [du](linux/du.md)
447449
- [eBPF 与 XDP](linux/ebpf-and-xdp.md)
448450
- [编辑二进制文件](linux/edit-binary-file.md)
@@ -563,6 +565,12 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
563565

564566
[`⬆ 返回目录`](#toc)
565567

568+
### Debian
569+
570+
- [升级 debian 系统](linux/debian/upgrade-system.md)
571+
572+
[`⬆ 返回目录`](#toc)
573+
566574
### Systemd
567575

568576
- [systemd 网络启动流程](linux/systemd/network.md)
@@ -737,6 +745,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
737745
- [dropbear](others/dropbear.md)
738746
- [Duplicati](others/duplicati.md)
739747
- [文件命名,下划线还是中划线?](others/file-naming-with-underscores-and-dashes.md)
748+
- [fonts.googleapis.com 不可访问](others/fonts.googleapis.com-is-inaccessible.md)
740749
- [fzf](others/fzf.md)
741750
- [从微信公众号提取原图](others/get-raw-image-from-weixin.md)
742751
- [gRPC](others/grpc.md)

linux/apt.md

+6
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,17 @@ deb http://mirrors.huaweicloud.com/debian-security/ testing-security main contri
3535
echo 'APT::Default-Release "bullseye";' > /etc/apt/apt.conf.d/00local
3636
```
3737

38+
(以后升级系统时记得修改对应的版本号)
39+
3840
参考
3941

4042
- https://unix.stackexchange.com/a/647205/373303
4143
- [Debian 的版本号及 distributions](https://archive.ph/i4N0T)
4244

45+
## 给 apt 设置 http 代理
46+
47+
除了更换源,还可以设置 http 代理来加速。具体看这篇文章「[如何为 APT 命令设置代理](https://linux.cn/article-15815-1.html)」 ([链接备份](https://archive.md/HBhB4))。
48+
4349
## 搜索包
4450

4551
`apt search --names-only name``--names-only` 只会匹配包名,如果没有则会匹配包括包描述的所有信息。

linux/debian/upgrade-system.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 升级 debian 系统
2+
3+
按照文档执行。https://www.debian.org/releases/stable/amd64/release-notes/ch-upgrading.zh-cn.html

linux/dpkg.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# dpkg
2+
3+
- 显示包内容:`dpkg -L $pkg`
4+
- 显示本地已安装的包:`dpkg -l`
5+
- 输出的前三列依次显示所需操作、软件包状态和错误信息。查阅 `man dpkg-query` 可得详细解释。
6+
7+
- 所需操作:
8+
- u = 未知 (unknown)
9+
- i = 安装 (install)
10+
- h = 保持 (hold)
11+
- r = 移除 (remove)
12+
- p = 清除 (purge)
13+
14+
- 软件包状态:
15+
- n = 未安装
16+
- c = 配置文件
17+
- H = 部分安装
18+
- U = 已解压缩
19+
- F = 部分配置
20+
- W = 等待触发器
21+
- t = 待处理触发器
22+
- i = 已安装
23+
24+
- 错误标志:
25+
- <空白> = (无)
26+
- R = 需要重新安装
27+
28+
- 比如 `ii` 代表已安装。`ic` 代表已安装并且配置有修改。
29+
- 大写的状态或错误字母表示该软件包可能会引起严重问题。
30+
- 查看指定 deb 包里的文件列表: `dpkg -c $file.deb`
31+
- 安装指定的 deb 包:`dpkg -i $file.deb`
+23-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1-
## 网络接口配置 (ifcfg)
1+
# 网络接口配置 (ifcfg)
22

3-
### 常用命令
3+
## 常用命令
44

55
- `ifup $interface` 启动网络接口
66
- `ifdown $interface` 关闭网络接口
77

8-
### 参考
8+
- 配置文件看 `/etc/network/interfaces`,它一般会引用 `/etc/network/interfaces.d/` 目录下的文件。
9+
10+
## 修改配置后检查
11+
12+
当你修改了 `/etc/network/interfaces` 或者 `/etc/network/interfaces.d/` 目录下的文件。需要检查是否有语法错误。可以这么做。
13+
14+
假设修改的是 eth0 接口配置。执行 `sudo ifup --no-act eth0` 检查。如果有错,会打印具体错误。
15+
16+
如果 eth0 已经启动,当没有错时则会显示 `ifup: interface eth0 already configured`
17+
18+
如果 eth0 是新的接口,没有错时会显示
19+
20+
```
21+
run-parts --exit-on-error /etc/network/if-pre-up.d
22+
23+
CLIENT="-i"; dhclient -4 -v $CLIENT -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -I -df /var/lib/dhcp/dhclient6.eth0.leases eth0
24+
run-parts --exit-on-error /etc/network/if-up.d
25+
```
26+
27+
28+
## 参考
929

1030
- https://wiki.debian.org/NetworkConfiguration
1131
- [/etc/network/interfaces Ubuntu Linux networking example](https://archive.ph/BqbXw)

nix/nixpkgs.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
## 查找包名
44

5-
两种方法
5+
几种方法
66

7-
1. https://search.nixos.org/packages
8-
2. 在 nixpkgs 源码 [`pkgs/top-level/all-packages.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix),可以看到所有包名。
7+
1. 官方: https://search.nixos.org/packages
8+
2. 非官方: https://history.nix-packages.com/
9+
3. 在 nixpkgs 源码 [`pkgs/top-level/all-packages.nix`](https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix),可以看到所有包名。
910

1011
## 查找某个包的历史版本
1112

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# fonts.googleapis.com 不可访问
2+
3+
其实 fonts.googleapis.com 在国内是可以访问的。但是可能因为你的 DNS 设置以及翻墙软件的设置,导致它不可访问。
4+
5+
```
6+
# 你的电脑执行以下三行,比较结果
7+
nslookup fonts.googleapis.com
8+
# 国外解析
9+
nslookup fonts.googleapis.com 1.1.1.1
10+
# 国内解析
11+
nslookup fonts.googleapis.com 223.5.5.5
12+
```
13+
14+
可是,当使用国外 DNS 服务,fonts.googleadapis.com 会解析成国外 IP,这就导致无法直接访问。
15+
16+
很多翻墙规则项目会使用 [felixonmars/dnsmasq-china-list/](https://github.com/felixonmars/dnsmasq-china-list) 项目来生成代理规则。而且 [felixonmars/dnsmasq-china-list/google.china.conf](https://github.com/felixonmars/dnsmasq-china-list/blob/master/google.china.conf) 里是把 fonts.googleadapis.com 指向国内 DNS (114.114.114.114) 的。很多翻墙规则项目也会把这个域名设定为直连。
17+
18+
## 问题来了
19+
20+
于是我想到一个问题,fonts.googleadapis.com 的国内 IP,究竟是 google 原厂提供的服务,还是我国的代理服务?
21+
22+
我用 https://www.chaipip.com/ 查询 ip 归属地(我这查出来是 IP 是 180.163.150.33),发现位置锁定在上海市政府。(IP 经纬度可能有偏移,所以定位不一定准确,自己判断)
23+
24+
写到这里,就不展开了。

others/makefile.md

+18
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<!-- MarkdownTOC GFM -->
77

88
- [参考资料](#参考资料)
9+
- [默认 target](#默认-target)
910
- [命令回显](#命令回显)
1011
- [变量赋值](#变量赋值)
1112
- [target 作用域的变量定义](#target-作用域的变量定义)
@@ -27,6 +28,23 @@
2728
- https://makefiletutorial.com/
2829
- [陈皓 - 跟我一起写Makefile](https://seisman.github.io/how-to-write-makefile/)
2930

31+
## 默认 target
32+
33+
如果 makefile 里有设置 `.DEFAULT_GOAL`,比如 `.DEFAULT_GOAL = build`,则 `make` 等同于 `make build`
34+
35+
如果 makefile 里没有设置 `.DEFAULT_GOAL``make` 会执行 makefile 里第一个 target。比如下面的例子,`make` 等同于 `make all`
36+
37+
```make
38+
# 默认目标
39+
all: build
40+
41+
# 实际任务
42+
build:
43+
@echo "Building..."
44+
45+
# 其他规则和依赖关系...
46+
```
47+
3048
## 命令回显
3149

3250
默认情况下会把每个执行命令(包括注释)都回显到终端。可以在开头加一个 `@` 来阻止回显。

vm/kvm.md

+13-5
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,28 @@
44

55
![.jpg](https://user-images.githubusercontent.com/1998490/223427418-84015b3d-b6ef-4da9-bf46-049e9bf86699.png)
66

7-
- [KVM-Qemu-Libvirt三者之间的关系](https://blog.51cto.com/changfei/1672147) ([链接备份](https://archive.ph/TwVct))
7+
- [KVM-Qemu-Libvirt 三者之间的关系](https://blog.51cto.com/changfei/1672147) ([链接备份](https://archive.ph/TwVct))
8+
9+
KVM (Kernel-based Virtual Machine) 和 QEMU (Quick Emulator) 是两个虚拟化相关的开源项目。它们通常一起使用来提供完整的虚拟化解决方案。以下是它们之间的主要区别:
10+
11+
KVM 是 Linux 内核模块,依赖于硬件虚拟化扩展,如 Intel VT-x 和 AMD-V。
12+
13+
QEMU 是运行在用户态的模拟器,它通过将客户机指令翻译为主机指令来模拟虚拟机。QEMU 可以在没有硬件虚拟化支持的系统上独立运行,但这性能较差。因为是纯软件模拟。它也可以与 KVM 一起使用以提高性能,如 qemu-kvm。
14+
15+
libvirt 是目前使用最为广泛的对 KVM 虚拟机进行管理的工具和 API。Libvirtd 是一个 daemon 进程,可以被本地的 virsh 调用,也可以被远程的 virsh 调用,Libvirtd 调用 qemu-kvm 操作虚拟机。
816

917
### 硬件虚拟化
1018

11-
完全虚拟化是非常慢的,所以要使用硬件辅助虚拟化技术 Intel-VT,AMD-V,所以需要CPU硬件开启这个标志位,一般在BIOS里面设置
19+
完全的软件虚拟化是非常慢的,所以要使用硬件辅助虚拟化技术,这需要 CPU 硬件开启这个标志位,一般在 BIOS 里面设置
1220

1321
查看系统是否开启硬件虚拟化。
1422

1523
```sh
16-
# 对于Intel CPU 可用命令判断
24+
# 对于 Intel CPU 可用命令判断
1725
grep vmx /proc/cpuinfo
1826

19-
# 对于AMD CPU 可用命令判断
27+
# 对于 AMD CPU 可用命令判断
2028
grep svm /proc/cpuinfo
2129
```
2230

23-
如果没有任何的输出,说明你的 cpu 不支持虚拟化。
31+
如果没有任何的输出,说明你的 CPU 不支持虚拟化。

0 commit comments

Comments
 (0)