File tree 10 files changed +132
-12
lines changed
10 files changed +132
-12
lines changed Original file line number Diff line number Diff line change 66
66
}
67
67
68
68
h1 , .text-alpha {
69
- font-size : 1.7 rem !important ;
69
+ font-size : 1.8 rem !important ;
70
70
font-weight : 500 ;
71
71
}
72
72
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
68
68
- [ K8S] ( #k8s )
69
69
- [ 语言设计] ( #语言设计 )
70
70
- [ Linux] ( #linux )
71
+ - [ Debian] ( #debian )
71
72
- [ Systemd] ( #systemd )
72
73
- [ Language Server Protocol (LSP)] ( #language-server-protocol-(lsp) )
73
74
- [ Lua] ( #lua )
@@ -443,6 +444,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
443
444
- [ 硬盘分区] ( linux/disk-partition.md )
444
445
- [ dmesg] ( linux/dmesg.md )
445
446
- [ dnsmasq] ( linux/dnsmasq.md )
447
+ - [ dpkg] ( linux/dpkg.md )
446
448
- [ du] ( linux/du.md )
447
449
- [ eBPF 与 XDP] ( linux/ebpf-and-xdp.md )
448
450
- [ 编辑二进制文件] ( linux/edit-binary-file.md )
@@ -563,6 +565,12 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
563
565
564
566
[ ` ⬆ 返回目录 ` ] ( #toc )
565
567
568
+ ### Debian
569
+
570
+ - [ 升级 debian 系统] ( linux/debian/upgrade-system.md )
571
+
572
+ [ ` ⬆ 返回目录 ` ] ( #toc )
573
+
566
574
### Systemd
567
575
568
576
- [ systemd 网络启动流程] ( linux/systemd/network.md )
@@ -737,6 +745,7 @@ Read the [NOTICE](./NOTICE) file distributed with this work for additional infor
737
745
- [ dropbear] ( others/dropbear.md )
738
746
- [ Duplicati] ( others/duplicati.md )
739
747
- [ 文件命名,下划线还是中划线?] ( others/file-naming-with-underscores-and-dashes.md )
748
+ - [ fonts.googleapis.com 不可访问] ( others/fonts.googleapis.com-is-inaccessible.md )
740
749
- [ fzf] ( others/fzf.md )
741
750
- [ 从微信公众号提取原图] ( others/get-raw-image-from-weixin.md )
742
751
- [ gRPC] ( others/grpc.md )
Original file line number Diff line number Diff line change @@ -35,11 +35,17 @@ deb http://mirrors.huaweicloud.com/debian-security/ testing-security main contri
35
35
echo ' APT::Default-Release "bullseye";' > /etc/apt/apt.conf.d/00local
36
36
```
37
37
38
+ (以后升级系统时记得修改对应的版本号)
39
+
38
40
参考
39
41
40
42
- https://unix.stackexchange.com/a/647205/373303
41
43
- [ Debian 的版本号及 distributions] ( https://archive.ph/i4N0T )
42
44
45
+ ## 给 apt 设置 http 代理
46
+
47
+ 除了更换源,还可以设置 http 代理来加速。具体看这篇文章「[ 如何为 APT 命令设置代理] ( https://linux.cn/article-15815-1.html ) 」 ([ 链接备份] ( https://archive.md/HBhB4 ) )。
48
+
43
49
## 搜索包
44
50
45
51
` apt search --names-only name ` 。` --names-only ` 只会匹配包名,如果没有则会匹配包括包描述的所有信息。
Original file line number Diff line number Diff line change
1
+ # 升级 debian 系统
2
+
3
+ 按照文档执行。https://www.debian.org/releases/stable/amd64/release-notes/ch-upgrading.zh-cn.html
Original file line number Diff line number Diff line change
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 `
Original file line number Diff line number Diff line change 1
- ## 网络接口配置 (ifcfg)
1
+ # 网络接口配置 (ifcfg)
2
2
3
- ### 常用命令
3
+ ## 常用命令
4
4
5
5
- ` ifup $interface ` 启动网络接口
6
6
- ` ifdown $interface ` 关闭网络接口
7
7
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
+ ## 参考
9
29
10
30
- https://wiki.debian.org/NetworkConfiguration
11
31
- [ /etc/network/interfaces Ubuntu Linux networking example] ( https://archive.ph/BqbXw )
Original file line number Diff line number Diff line change 2
2
3
3
## 查找包名
4
4
5
- 两种方法 。
5
+ 几种方法 。
6
6
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 ) ,可以看到所有包名。
9
10
10
11
## 查找某个包的历史版本
11
12
Original file line number Diff line number Diff line change
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
+ 写到这里,就不展开了。
Original file line number Diff line number Diff line change 6
6
<!-- MarkdownTOC GFM -->
7
7
8
8
- [ 参考资料] ( #参考资料 )
9
+ - [ 默认 target] ( #默认-target )
9
10
- [ 命令回显] ( #命令回显 )
10
11
- [ 变量赋值] ( #变量赋值 )
11
12
- [ target 作用域的变量定义] ( #target-作用域的变量定义 )
27
28
- https://makefiletutorial.com/
28
29
- [ 陈皓 - 跟我一起写Makefile] ( https://seisman.github.io/how-to-write-makefile/ )
29
30
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
+
30
48
## 命令回显
31
49
32
50
默认情况下会把每个执行命令(包括注释)都回显到终端。可以在开头加一个 ` @ ` 来阻止回显。
Original file line number Diff line number Diff line change 4
4
5
5
![ .jpg] ( https://user-images.githubusercontent.com/1998490/223427418-84015b3d-b6ef-4da9-bf46-049e9bf86699.png )
6
6
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 操作虚拟机。
8
16
9
17
### 硬件虚拟化
10
18
11
- 完全虚拟化是非常慢的 ,所以要使用硬件辅助虚拟化技术 Intel-VT,AMD-V,所以需要CPU硬件开启这个标志位,一般在BIOS里面设置 。
19
+ 完全的软件虚拟化是非常慢的 ,所以要使用硬件辅助虚拟化技术,这需要 CPU 硬件开启这个标志位,一般在 BIOS 里面设置 。
12
20
13
21
查看系统是否开启硬件虚拟化。
14
22
15
23
``` sh
16
- # 对于Intel CPU 可用命令判断
24
+ # 对于 Intel CPU 可用命令判断
17
25
grep vmx /proc/cpuinfo
18
26
19
- # 对于AMD CPU 可用命令判断
27
+ # 对于 AMD CPU 可用命令判断
20
28
grep svm /proc/cpuinfo
21
29
```
22
30
23
- 如果没有任何的输出,说明你的 cpu 不支持虚拟化。
31
+ 如果没有任何的输出,说明你的 CPU 不支持虚拟化。
You can’t perform that action at this time.
0 commit comments