-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.xml
829 lines (400 loc) · 526 KB
/
search.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>H3C Magic NX30 Pro 官方 OpenWrt 安装教程</title>
<link href="/install-openwrt-on-h3c_magic-nx30-pro.html"/>
<url>/install-openwrt-on-h3c_magic-nx30-pro.html</url>
<content type="html"><![CDATA[<p>导语:本文将指引您如何在 H3C Magic NX30 Pro 安装官方 OpenWrt。因为这台路由器出厂就启用了 Telnet 服务,所以可以更方便的刷入第三方固件,但是您在此之前依然需要完成一些准备工作。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/install-openwrt-on-h3c_magic-nx30-pro/cover.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-openwrt-on-h3c_magic-nx30-pro/cover.png"></a><span></span></div></div><span id="more"></span><h2 id="事前准备"><a href="#事前准备" class="headerlink" title="事前准备"></a>事前准备</h2><ul><li><p>1 台有网口的电脑(如无网口,可配带网口的扩展坞)、2 条网线、1 台配置好 Web 管理密码的 H3C Magic NX30 Pro</p></li><li><p><strong>完成 NX30 Pro 的网络连接配置</strong>(因为需要在 NX30 Pro 上安装 ssh 的软件包,我们需要其能连接互联网)。故连接网线的方式:</p><ul><li>⑴. 如果您有一台在役(能上网)的旧路由器。网线 1 一端连接旧路由器的 LAN 口,对端连接 NX30 Pro 的 WAN 口;网线 2 一端连接 NX30 Pro 的 LAN 口,对端连接电脑(或扩展坞)的网口</li><li>⑵ . 如果您只有一台 NX30 Pro,也一样的需要让其能正常访问网络。此时网线 1 一端是入户网口或者是光猫的网口,对端连接 NX30 Pro 的 WAN 口;网线 2 一端连接 NX30 Pro 的 LAN 口,对端连接电脑(或扩展坞)的网口</li></ul></li><li><p><strong>启用电脑的 Telnet 服务</strong>:</p><p>「<strong>Controll Panel</strong>」控制面板 → 「<strong>Programs</strong>」程序 → 「<strong>Turn Windows features on or off</strong>」关闭或启用 Windows 特性,确保以下功能项处于<strong>开启</strong>状态:</p></li></ul><div class='checkbox checked'><input type="checkbox" checked="checked"/> <p><strong>Telnet Client</strong></p> </div><ul><li><strong>待刷写镜像及工具的下载</strong>:</li></ul><overflow><table><thead><tr><th>文件名</th><th>描述</th><th>下载</th></tr></thead><tbody><tr><td><code>openwrt-*-preloader.bin</code></td><td><code>BL2</code></td><td><a href="https://firmware-selector.openwrt.org/?target=mediatek/filogic&id=h3c_magic-nx30-pro">页面</a></td></tr><tr><td><code>openwrt-*-bl31-uboot.fip</code></td><td><code>FIP</code></td><td>同上</td></tr><tr><td><code>openwrt-*-initramfs-recovery.itb</code></td><td>initramfs 镜像</td><td>同上</td></tr><tr><td><code>openwrt-*-squashfs-sysupgrade.itb</code></td><td>Sysupgrade 镜像</td><td>同上</td></tr><tr><td><code>Tftpd64-4.64-setup.exe</code></td><td>TFTP 工具安装包</td><td><a href="https://bitbucket.org/phjounin/tftpd64/downloads/Tftpd64-4.64-setup.exe">链接</a></td></tr></tbody></table></overflow><hr><p>⚠️ <strong>为了避免无线局域网的干扰,可以暂时将电脑的无线网络断开。</strong></p><hr><h2 id="启用-ssh-服务"><a href="#启用-ssh-服务" class="headerlink" title="启用 ssh 服务"></a>启用 ssh 服务</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 打开 cmd 窗口,Telnet 命令登录到设备终端</span></span><br><span class="line"><span class="comment">## 用户名为 H3C、密码为您此前初始配置的 Web 管理密码</span></span><br><span class="line">telnet 192.168.124.1 99</span><br><span class="line"></span><br><span class="line"><span class="comment"># 获取 dropbear 软件包,并启用 ssh 服务</span></span><br><span class="line">curl -o /tmp/dropbear.ipk https://downloads.openwrt.org/releases/packages-19.07/aarch64_cortex-a53/base/dropbear_2019.78-2_aarch64_cortex-a53.ipk</span><br><span class="line">opkg install /tmp/dropbear.ipk</span><br><span class="line">/etc/init.d/dropbear <span class="built_in">enable</span></span><br><span class="line">/etc/init.d/dropbear start</span><br><span class="line"></span><br><span class="line"><span class="comment"># 配置 ssh 登录的密码,建议设置成和 Web 管理密码一致</span></span><br><span class="line">passwd</span><br><span class="line"><span class="comment"># 设置完密码 exit 退出登录终端、或直接关闭窗口</span></span><br></pre></td></tr></table></figure><h2 id="分区备份"><a href="#分区备份" class="headerlink" title="分区备份"></a>分区备份</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 打开 cmd 窗口,ssh 命令登录到路由器终端</span></span><br><span class="line">ssh [email protected]</span><br><span class="line"></span><br><span class="line"><span class="comment"># 查看分区表</span></span><br><span class="line">root@NX30Pro:~<span class="comment"># cat /proc/mtd</span></span><br><span class="line">dev: size erasesize name</span><br><span class="line">mtd0: 08000000 00020000 <span class="string">"spi0.0"</span></span><br><span class="line">mtd1: 00100000 00020000 <span class="string">"BL2"</span></span><br><span class="line">mtd2: 00080000 00020000 <span class="string">"u-boot-env"</span></span><br><span class="line">mtd3: 00200000 00020000 <span class="string">"Factory"</span></span><br><span class="line">mtd4: 00200000 00020000 <span class="string">"FIP"</span></span><br><span class="line">mtd5: 04000000 00020000 <span class="string">"ubi"</span></span><br><span class="line">mtd6: 00600000 00020000 <span class="string">"pdt_data"</span></span><br><span class="line">mtd7: 00600000 00020000 <span class="string">"pdt_data_1"</span></span><br><span class="line">mtd8: 00100000 00020000 <span class="string">"exp"</span></span><br><span class="line">mtd9: 02580000 00020000 <span class="string">"plugin"</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 备份原厂固件</span></span><br><span class="line">root@NX30Pro:~<span class="comment"># dd if=/dev/mtd5 of=/tmp/mtd5_ubi</span></span><br><span class="line">131072+0 records <span class="keyword">in</span></span><br><span class="line">131072+0 records out</span><br><span class="line">67108864 bytes (64.0MB) copied, 28.450201 seconds, 2.2MB/s</span><br><span class="line"><span class="comment"># 导出原厂固件至电脑</span></span><br><span class="line"><span class="comment">## 你可以使用 WinSCP 之类的 GUI 工具查看路由器的 /tmp 目录,导出至您的电脑</span></span><br><span class="line"><span class="comment">## 也可参考命令导出方法:新开一个 cmd 窗口,执行命令导出至指定目录</span></span><br><span class="line">scp [email protected]:/tmp/mtd5_ubi D:\Downloads\backup\</span><br><span class="line"><span class="comment"># 删除 /tmp/mtd5_ubi</span></span><br><span class="line"><span class="comment">## 因为闪存空间有限,我们仍需要单独备份几个分区,故将已导出的固件删除</span></span><br><span class="line"><span class="comment">## 回到登陆 ssh 的终端窗口,执行命令</span></span><br><span class="line">root@NX30Pro:~<span class="comment"># rm /tmp/mtd5_ubi</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 单独备份(小)分区</span></span><br><span class="line">root@NX30Pro:~<span class="comment"># dd if=/dev/mtd1 of=/tmp/mtd1_BL2</span></span><br><span class="line">2048+0 records <span class="keyword">in</span></span><br><span class="line">2048+0 records out</span><br><span class="line">1048576 bytes (1.0MB) copied, 0.390332 seconds, 2.6MB/s</span><br><span class="line">root@NX30Pro:~<span class="comment"># dd if=/dev/mtd3 of=/tmp/mtd3_Factory</span></span><br><span class="line">4096+0 records <span class="keyword">in</span></span><br><span class="line">4096+0 records out</span><br><span class="line">2097152 bytes (2.0MB) copied, 0.786793 seconds, 2.5MB/s</span><br><span class="line">root@NX30Pro:~<span class="comment"># dd if=/dev/mtd4 of=/tmp/mtd4_FIP</span></span><br><span class="line">4096+0 records <span class="keyword">in</span></span><br><span class="line">4096+0 records out</span><br><span class="line">2097152 bytes (2.0MB) copied, 0.798879 seconds, 2.5MB/s</span><br><span class="line"></span><br><span class="line"><span class="comment"># 导出分区镜像至电脑,像此前一样用 WinSCP 工具或用命令导出:</span></span><br><span class="line">scp [email protected]:/tmp/mtd1_BL2 D:\Downloads\backup\</span><br><span class="line">scp [email protected]:/tmp/mtd3_Factory D:\Downloads\backup\</span><br><span class="line">scp [email protected]:/tmp/mtd4_FIP D:\Downloads\backup\</span><br><span class="line"></span><br><span class="line"><span class="comment"># 回到登陆完 ssh 的窗口,删除已导出镜像</span></span><br><span class="line">root@NX30Pro:~<span class="comment"># rm /tmp/mtd*</span></span><br></pre></td></tr></table></figure><h2 id="刷写过程"><a href="#刷写过程" class="headerlink" title="刷写过程"></a>刷写过程</h2><ol><li><strong>刷写 BL2 和 uboot</strong></li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">## 本文下载的镜像存储在电脑的 D:\Downloads\ 目录下</span></span><br><span class="line"><span class="comment">## 刷写前,用 WinSCP 或命令将用到的镜像导至路由器的 /tmp 目录下</span></span><br><span class="line"><span class="comment"># cmd 窗口执行命令参考:</span></span><br><span class="line">scp D:\Downloads\openwrt-23.05.0-mediatek-filogic-h3c_magic-nx30-pro-preloader.bin [email protected]:/tmp/</span><br><span class="line">scp D:\Downloads\openwrt-23.05.0-mediatek-filogic-h3c_magic-nx30-pro-bl31-uboot.fip [email protected]:/tmp/</span><br><span class="line"></span><br><span class="line"><span class="comment"># 回到 ssh 的终端窗口,刷写到各自分区</span></span><br><span class="line"><span class="comment"># 发现 BL2 分区提示不能写入,这个可以暂时忽略</span></span><br><span class="line">root@NX30Pro:~<span class="comment"># cd /tmp/</span></span><br><span class="line"></span><br><span class="line">root@NX30Pro:/tmp<span class="comment"># mtd write *-preloader.bin BL2</span></span><br><span class="line">Could not open mtd device: BL2</span><br><span class="line">Can<span class="string">'t open device for writing!</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">root@NX30Pro:/tmp# mtd write *-bl31-uboot.fip FIP</span></span><br><span class="line"><span class="string">Unlocking FIP ...</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">Writing from openwrt-23.05.0-mediatek-filogic-h3c_magic-nx30-pro-bl31-uboot.fip to FIP ...</span></span><br><span class="line"><span class="string">root@NX30Pro:/tmp# client_loop: send disconnect: Connection reset</span></span><br></pre></td></tr></table></figure><ol start="2"><li><strong>将电脑设置为静态 IP</strong></li></ol><p>「控制面板」→「网络和共享中心」→「更改适配器设置」→ 找到有线网卡,鼠标右键点击 →「属性」→ 双击「Internet 协议版本 4(TCP/IPv4)」→ 使用以下 IP 地址:</p><ul><li><p>IP 地址: <code>192.168.1.254</code></p></li><li><p>子网掩码: <code>255.255.255.0</code></p></li><li><p>默认网关: <code>192.168.1.1</code></p></li></ul><p>填写完成,确认保存即可。</p><ol start="3"><li><p>将文件 <code>openwrt-23.05.0-mediatek-filogic-h3c_magic-nx30-pro-initramfs-recovery.itb</code> <strong>重新命名</strong>为 <code>openwrt-mediatek-filogic-h3c_magic-nx30-pro-initramfs-recovery.itb</code> </p></li><li><p><strong>安装</strong> <code>tftpd64</code> ,然后将 <code>openwrt-mediatek-filogic-h3c_magic-nx30-pro-initramfs-recovery.itb</code> <strong>移动</strong>至 <code>tftpd64</code> 安装目录,双击其主程序 <code>tftpd64.exe</code> <strong>启动</strong></p></li><li><p><strong>物理断电重启下路由器</strong>,即可看到程序执行 tftp 恢复的进度条,可通过 <code>tftpd64</code> 程序的 <code>Log viewer</code> 栏<strong>查看日志</strong>,判断是否执行成功。</p></li><li><p>等待完成 tftp 恢复后设备完成启动(可以 ping 下 <code>192.168.1.1</code> ,通了就说明起来了),最后 ssh 登录设备并<strong>执行 sysupgrade 完成固件刷写</strong>。</p></li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 将 sysupgrade 镜像传输至路由器的 /tmp 目录,cmd 窗口执行命令:</span></span><br><span class="line">scp D:\Downloads\openwrt-23.05.0-mediatek-filogic-h3c_magic-nx30-pro-squashfs-sysupgrade.itb [email protected]:/tmp/</span><br><span class="line"></span><br><span class="line"><span class="comment"># tftp 恢复写入了一个用于临时过渡的 OpenWrt 固件,我们可以通过 ssh 命令登录其终端:</span></span><br><span class="line">ssh [email protected]</span><br><span class="line"></span><br><span class="line"><span class="comment"># 刷写 OpenWrt 固件</span></span><br><span class="line">root@OpenWrt:~<span class="comment"># sysupgrade -F -n /tmp/*-squashfs-sysupgrade.itb</span></span><br><span class="line">Tue Oct 24 12:31:18 UTC 2023 upgrade: Commencing upgrade. Closing all shell sessions.</span><br><span class="line">Command failed: Connection failed</span><br><span class="line">root@OpenWrt:~<span class="comment"># Connection to 192.168.1.1 closed by remote host.</span></span><br><span class="line">Connection to 192.168.1.1 closed.</span><br></pre></td></tr></table></figure><p>经过上述操作,我们就完成了 OpenWrt 官方固件的刷写</p><h2 id="重新刷写此前未刷入的-BL2-分区"><a href="#重新刷写此前未刷入的-BL2-分区" class="headerlink" title="重新刷写此前未刷入的 BL2 分区"></a>重新刷写此前未刷入的 BL2 分区</h2><p>虽然不知道 BL2 分区的作用,但是 OpenWrt 的首次引入设备支援的 commit 的作者有提到,强迫症的我还是想要刷进去,我们可以这么做:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 清除临时过渡固件的密钥信息,否则 ssh 登录或用 scp 命令传输文件会报错</span></span><br><span class="line">ssh-keygen -R 192.168.1.1</span><br><span class="line"></span><br><span class="line"><span class="comment">## 将需要用到的镜像导至路由器的 /tmp 目录下</span></span><br><span class="line"><span class="comment"># cmd 窗口执行命令参考:</span></span><br><span class="line">scp D:\Downloads\openwrt-23.05.0-mediatek-filogic-h3c_magic-nx30-pro-preloader.bin [email protected]:/tmp/</span><br><span class="line"></span><br><span class="line"><span class="comment"># ssh 登录到设备终端</span></span><br><span class="line">ssh [email protected]</span><br><span class="line"></span><br><span class="line"><span class="comment"># 同步仓库源,安装 kmod-mtd-rw 内核模块</span></span><br><span class="line">root@OpenWrt:~<span class="comment"># opkg update && opkg install kmod-mtd-rw</span></span><br><span class="line"><span class="comment"># 将分区配置为可读写</span></span><br><span class="line">root@OpenWrt:~<span class="comment"># insmod /lib/modules/$(uname -r)/mtd-rw.ko i_want_a_brick=1</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 刷写 BL2 分区</span></span><br><span class="line">root@OpenWrt:~<span class="comment"># mtd write /tmp/*-preloader.bin BL2</span></span><br><span class="line">Unlocking BL2 ...</span><br><span class="line"></span><br><span class="line">Writing from openwrt-23.05.0-mediatek-filogic-h3c_magic-nx30-pro-preloader.bin to BL2 ...</span><br><span class="line"></span><br><span class="line"><span class="comment"># 对了,OpenWrt 默认没设置 ssh / Luci Web 的密码。可以命令设置下:</span></span><br><span class="line">root@OpenWrt:~<span class="comment"># passwd</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 重启路由器</span></span><br><span class="line">root@OpenWrt:~<span class="comment"># reboot</span></span><br></pre></td></tr></table></figure><p>最后,各位不要忘记将电脑的网络设置改回自动获取 IP 哦。</p><h2 id="Luci-主题的安装"><a href="#Luci-主题的安装" class="headerlink" title="Luci 主题的安装"></a>Luci 主题的安装</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># ssh 登录到设备终端</span></span><br><span class="line">ssh [email protected]</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装 luci-theme-material 主题</span></span><br><span class="line">opkg update</span><br><span class="line">opkg install luci-theme-material</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装 Luci 中文语言包(可选)</span></span><br><span class="line">opkg install luci-i18n-base-zh-cn</span><br></pre></td></tr></table></figure><h2 id="ShellClash-的安装"><a href="#ShellClash-的安装" class="headerlink" title="ShellClash 的安装"></a>ShellClash 的安装</h2><p>至于为什么不安装 OpenClash 或其他之类的工具?那是因为它们太占用闪存空间了,加之目前 OpenWrt 的闪存布局暂时给 <code>/overlay</code> 的大小就 22.2 MB,能装软件包的挂载分区就小的可怜。至于如何安装及使用 ShellClash 不是本文的重点,请直接移步 ShellClash 作者的教程:</p><ul><li><a href="https://juewuy.github.io/bdaz/">本地安装 ShellClash 的教程</a></li></ul><p>至此,本文完。</p>]]></content>
<categories>
<category> Router </category>
</categories>
<tags>
<tag> OpenWrt </tag>
<tag> ShellClash </tag>
</tags>
</entry>
<entry>
<title>如何解决 Virtualized Intel VT-x/EPT is not supported on this platform... 的问题</title>
<link href="/virtualized-intel-vt-x-ept-is-not-supported-on-this-platform.html"/>
<url>/virtualized-intel-vt-x-ept-is-not-supported-on-this-platform.html</url>
<content type="html"><![CDATA[<blockquote><p>Virtualized Intel VT-x/EPT is not supported on this platform. Continue without virtualized Intel VT-x/EPT?</p><p>VMware Workstation does not support nested virtualization on this host. Module ‘HV’ power on failed. Failed to start the virtual machine.</p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='one'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/virtualized-intel-vt-x-ept-is-not-supported-on-this-platform/1.png' data-fancybox='one' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/virtualized-intel-vt-x-ept-is-not-supported-on-this-platform/1.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/virtualized-intel-vt-x-ept-is-not-supported-on-this-platform/2.png' data-fancybox='one' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/virtualized-intel-vt-x-ept-is-not-supported-on-this-platform/2.png"></a><span></span></div></div><p>我在 Windows 11 宿主机上,通过 VMware Workstation 运行 Red Hat Enterprise Linux,并试图在其之上运行 KVM 虚拟机。遇到了上述报错信息,大意是提醒 VT-x / EPT 不受支持,检测到在宿主机不支持 nested virtualization (<strong>嵌套虚拟化</strong>,可以简单理解为虚拟机之上运行虚拟机)。</p><p>经过一番折腾捣鼓,我发现这是 Windows 上的几个坑点导致的,下面我来具体说明下我是如何解决这个问题的。</p><span id="more"></span><p><strong>步骤总览</strong>(确保完成以下事项):</p><div class='checkbox checked'><input type="checkbox" checked="checked"/> <p><strong>BIOS 已启用 VT-x</strong></p> </div><div class='checkbox checked'><input type="checkbox" checked="checked"/> <p><strong>禁用 Hyper-V 相关 Windows 特性</strong></p> </div><div class='checkbox checked'><input type="checkbox" checked="checked"/> <p><strong>禁用 Windows Security 的内存完整性功能</strong></p> </div><h2 id="BIOS-启用-VT-x-选项"><a href="#BIOS-启用-VT-x-选项" class="headerlink" title="BIOS 启用 VT-x 选项"></a>BIOS 启用 VT-x 选项</h2><p>VT-x (<strong>Virtualization Technology</strong> on the x86 platform),是英特尔在 x86 平台下的虚拟化技术,我们需要确保 BIOS 是否已启用该选项。不同电脑主板厂商进入 BIOS 的按键不一,建议自行搜索,然后找到 VT-x (Virtualization Technology) 启用即可。</p><p>我本人以 HP 的笔记本为例,开机的时候快速点按 F10,即可进入 BIOS 界面。</p><p>「<strong>BIOS Setup Utility</strong>」主界面 → 「<strong>Configuration</strong>」配置 → 「<strong>Virtualization Technology</strong>」项改为「<strong>Enabled</strong>」启用。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='one'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/virtualized-intel-vt-x-ept-is-not-supported-on-this-platform/3.jpg' data-fancybox='one' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/virtualized-intel-vt-x-ept-is-not-supported-on-this-platform/3.jpg"></a><span></span></div></div><h2 id="禁用-Hyper-V-相关-Windows-特性"><a href="#禁用-Hyper-V-相关-Windows-特性" class="headerlink" title="禁用 Hyper-V 相关 Windows 特性"></a>禁用 Hyper-V 相关 Windows 特性</h2><p><strong>当 Windows 启用了 Hyper-V 之后,VT-x 将不会起作用。</strong> 然而如果您的系统使用了 WSL 或 WSA 之类的功能,则会启用 Hyper-V 这一功能特性。为了解决嵌套虚拟化遇到的报错问题,我们必须关闭 Hyper-V 的相关功能选项,以避免冲突。</p><p>「<strong>Controll Panel</strong>」控制面板 → 「<strong>Programs</strong>」程序 → 「<strong>Turn Windows features on or off</strong>」关闭或启用 Windows 特性,确保以下与 Hyper-V 可能相关的所有功能项处于<strong>关闭</strong>状态:</p><div class='checkbox'><input type="checkbox" /> <p><strong>Hyper-V</strong></p> </div><div class='checkbox'><input type="checkbox" /> <p><strong>Virtual Machine Platform</strong></p> </div><div class='checkbox'><input type="checkbox" /> <p><strong>Windows Hypervisior Platform</strong></p> </div><div class='checkbox'><input type="checkbox" /> <p><strong>Windows Sandbox</strong></p> </div><div class='checkbox'><input type="checkbox" /> <p><strong>Windows Subsystem for Linux</strong></p> </div><h2 id="禁用-Windows-Security-的内存完整性功能"><a href="#禁用-Windows-Security-的内存完整性功能" class="headerlink" title="禁用 Windows Security 的内存完整性功能"></a>禁用 Windows Security 的内存完整性功能</h2><p>Windows Security 的「<em>Memory integrity</em>」内存完整性功能也与 VT-x 存在冲突,需要禁用该功能。</p><p>「<strong>Windows Security</strong>」Windows Defender 安全中心 → 「<strong>Device security</strong>」设备安全 → 「<strong>Core isolation</strong>」内核隔离 → 「<strong>Core isolation details</strong>」内核隔离详细信息 → 确保「<strong>Memory integrity</strong>」内存完整性处于关闭状态:</p><div class='checkbox'><input type="checkbox" /> <p>「<em>Memory integrity</em>」内存完整性</p> </div><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='one'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/virtualized-intel-vt-x-ept-is-not-supported-on-this-platform/4.png' data-fancybox='one' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/virtualized-intel-vt-x-ept-is-not-supported-on-this-platform/4.png"></a><span></span></div></div><p>最后,重启设备即可。还是不得不说 Windows 越来越坑了 🤣。 </p>]]></content>
<categories>
<category> Windows </category>
</categories>
<tags>
<tag> 虚拟化 </tag>
</tags>
</entry>
<entry>
<title>摩托罗拉 Edge S Pro 国行系统转换为海外欧洲零售版(支持 OTA)</title>
<link href="/How-to-Convert-Edge-S-Pro-to-Retail-Europe.html"/>
<url>/How-to-Convert-Edge-S-Pro-to-Retail-Europe.html</url>
<content type="html"><![CDATA[<p>本文将指引您将 Edge S Pro 国行系统转换为欧洲零售版的系统,并使其可以正常接收 OTA 更新。</p><p>至于我为什么要这么做?避开 Lenovo / Motorola 的远程施法只是其中一点 🤣。我最主要的理由是:欧洲地区的 <a href="https://en.wikipedia.org/wiki/General_Data_Protection_Regulation"><em>GDPR</em> (通用数据保护条例)</a>,地表最强隐私保护法规了解一下。</p><span id="more"></span><h2 id="前情提要"><a href="#前情提要" class="headerlink" title="前情提要"></a>前情提要</h2><h3 id="USB-驱动的安装"><a href="#USB-驱动的安装" class="headerlink" title="USB 驱动的安装"></a>USB 驱动的安装</h3><details cyan><summary> 点击以展开 </summary> <div class='content'> <ul><li><p>请确保已正确<strong>安装 Motorola USB 驱动</strong></p><ul><li><a href="https://en-gb.support.motorola.com/app/usb-drivers">官网</a></li></ul><blockquote><p>官方版本在缺乏某些运行环境(如 <code>Visual C++</code> 等)的情况下,Windows 上安装可能会报错,安装不上(且无有效提示信息)</p></blockquote><ul><li><a href="https://github.com/ericclose/Motorola-USB-Drivers-win">Motorola-USB-Drivers-win</a></li></ul><blockquote><p><strong>推荐</strong>,该版本无需依赖运行环境库也可以正常安装(仅需 Windows 10 v1607 及以上版本)。是我从 <a href="https://developer.android.com/studio/run/win-usb">Google USB 驱动</a> 和 <a href="https://en-gb.support.motorola.com/app/answers/detail/a_id/158726">Motorola Rescue and Smart Assistant</a> 提取而来,克隆或下载整个仓库,通过<strong>以管理员模式运行</strong> bat 脚本,即可完成驱动的安装)</p></blockquote></li></ul> </div> </details><h3 id="配置-ADB-的环境变量"><a href="#配置-ADB-的环境变量" class="headerlink" title="配置 ADB 的环境变量"></a>配置 ADB 的环境变量</h3><details cyan><summary> 点击以展开 </summary> <div class='content'> <ul><li><p>配置 ADB 的环境变量的步骤</p><ul><li><p><a href="https://dl.google.com/android/repository/platform-tools_r33.0.3-windows.zip">ADB 下载</a></p></li><li><p>ADB 环境变量的配置方法:</p><blockquote><p>Windows 10 及以上版本:按下 Win 键,键入 「environment variables」或『环境变量』,搜索预览结果选择<strong>编辑系统环境变量</strong>;『环境变量』→ 双击「系统变量」中的『PATH』→ 『新建』,在文本框输入 <code>adb.exe</code> <strong>所在目录的绝对路径</strong>,如『<code>D:\Program Files\platform-tools</code>』,最后保存即可。</p></blockquote></li></ul></li></ul> </div> </details><h3 id="基础常识"><a href="#基础常识" class="headerlink" title="基础常识"></a>基础常识</h3><details cyan><summary> 点击以展开 </summary> <div class='content'> <ul><li><p>知悉<strong>启用 USB 调试</strong>的方法</p><blockquote><p>『<em>Settings</em>』设置 →『<em>About Phone</em>』关于手机 → 快速连续点击『<em>Build number</em>』版本号,直至提示已启用开发者选项;</p><p>『<em>Settings</em>』设置 →『<em>System</em>』系统 →『<em>Developer options</em>』开发者选项 →『<em>USB debugging</em>』USB 调试</p></blockquote></li><li><p>知悉如何将手机<strong>启动至 bootloader 模式</strong></p><blockquote><ul><li><p>方法 1:设备处于关机状态下,长按『电源键』&『音量 -』,直至设备启动至 bootloader 模式后即可松开按键</p></li><li><p>方法 2:设备启用 USB 调试之后,用数据线将手机与电脑连接,通过 cmd 执行命令 <code>adb reboot bootloader</code> 重启至 bootloader 模式</p></li></ul></blockquote></li><li><p>知悉如何将手机<strong>启动至 recovery 模式</strong></p><blockquote><ul><li><p>方法 1:设备处于关机状态下,长按『电源键』&『音量 +』,直至设备启动至 recovery 模式后即可松开按键</p></li><li><p>方法 2:设备启用 USB 调试之后,用数据线将手机与电脑连接,通过 cmd 执行命令 <code>adb reboot recovery</code> 重启至 recovery 模式</p></li></ul></blockquote></li></ul> </div> </details><h3 id="解锁-bootloader"><a href="#解锁-bootloader" class="headerlink" title="解锁 bootloader"></a>解锁 bootloader</h3><details cyan><summary> 点击以展开 </summary> <div class='content'> <ul><li><p>请确保设备已经<strong>解锁 bootloader</strong></p><blockquote><p>解锁 Motorola 设备的 bootloader 有以下影响,请自行决定是否解锁:</p><ul><li><p>原则上意味着<strong>放弃保修资格</strong></p></li><li><p>解锁操作将会<strong>清除设备数据</strong></p></li><li><p>解锁 bootloader 后设备 <strong>DRM 等级</strong>将从 L1 <strong>降低</strong>至 L3(目前发现<strong>欧版更新至 Android 13 又恢复成 L1</strong>)</p></li><li><p>解锁后<strong>设备启动</strong>将会提示“<strong>设备已解锁 bootloader</strong>”</p></li></ul></blockquote><ul><li><a href="https://en-gb.support.motorola.com/app/standalone/bootloader/unlock-your-device-a">解锁 bootloader - Motorola 官网</a></li></ul></li></ul> </div> </details><h3 id="重要分区的备份"><a href="#重要分区的备份" class="headerlink" title="重要分区的备份"></a>重要分区的备份</h3><details cyan open><summary> 点击以收起 </summary> <div class='content'> <ul><li><p>⚠️ <strong>备份</strong>重要的分区</p><ul><li><p><code>cid</code>:用于分配 CPU ID、手机区域代码、bootloader 解锁标识符等。主管设备能刷入的固件</p></li><li><p><code>persist</code>:主管出厂的一些数据,例如 IMEI、蓝牙,WIFI MAC 地址、设备 SN 等参数</p></li></ul></li></ul><blockquote><ol><li><strong>下载</strong> LineageOS 19.1 配套的 recovery</li></ol><ul><li>LineageOS 19.1 recovery <a href="https://web.archive.org/web/20230707083131if_/https://gemmei.ftp.acc.umu.se/mirror/lineageos/full/pstar/20230606/boot.img">下载地址</a>(最新版本的 LineageOS 20 的 <code>boot.img</code> 必须与 dtbo 和 vendor_boot 配套刷入才能正常使用,19.1 的则可以独立使用)</li></ul><ol start="2"><li>将手机<strong>重启至 bootloader 模式</strong>,通过命令<strong>刷入 Lineage recovery</strong></li></ol></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># <boot.img_路径> 不需要手动填写,直接将 boot.img 拖至 cmd 窗口会自动填写路径</span></span><br><span class="line">fastboot flash boot <boot.img_路径></span><br><span class="line"><span class="comment"># 实例:fastboot flash boot D:\Downloads\boot.img</span></span><br></pre></td></tr></table></figure><blockquote><ol start="3"><li>将手机<strong>重启至 recovery 模式</strong>,通过 Lineage recovery(「<em>Advanced</em>」<strong>高级</strong> →「<em>Enable ADB</em>」<strong>启用 ADB shell</strong>),电脑<strong>使用命令进行备份</strong>:</li></ol></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 访问 shell,shell 环境以 `pstar:/ #` 开头</span></span><br><span class="line">adb shell</span><br><span class="line"></span><br><span class="line"><span class="comment"># /tmp 是临时挂载目录,重启会自动清除,我们将 cid 和 persist 暂时导出至 /tmp 目录</span></span><br><span class="line"><span class="built_in">dd</span> <span class="keyword">if</span>=/dev/block/bootdevice/by-name/cid of=/tmp/cid</span><br><span class="line"><span class="built_in">dd</span> <span class="keyword">if</span>=/dev/block/bootdevice/by-name/persist of=/tmp/persist</span><br><span class="line"><span class="comment"># 退出 shell 环境</span></span><br><span class="line"><span class="built_in">exit</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 将导出的 cid 和 persist 所在的 tmp 目录整个导出,备份至电脑的目录</span></span><br><span class="line"><span class="comment"># 请根据自身情况,妥善选择备份至的电脑路径,如:D:\Downloads\</span></span><br><span class="line">adb pull /tmp/ D:\Downloads\</span><br></pre></td></tr></table></figure> </div> </details><hr><h2 id="固件的下载及刷写"><a href="#固件的下载及刷写" class="headerlink" title="固件的下载及刷写"></a>固件的下载及刷写</h2><ul><li><p>Edge S Pro / Edge 20 Pro / pstar 欧洲零售版(RETEU)固件下载:</p><ul><li><a href="https://mirrors.lolinet.com/firmware/motorola/pstar/official/RETEU/">固件链接</a></li></ul><blockquote><p>选择最新的版本下载即可</p></blockquote></li><li><p>RETEU 固件的刷写:</p><blockquote><p>此处我们需要用到 <code>motorola_flash_xml</code> 工具(很多人喜欢用 <a href="https://mirrors.lolinet.com/software/windows/TinyFastbootScript/">TinyFastbootScript</a> 刷机工具,感兴趣的可以自行去研究)协助我们生成 fastboot 刷写脚本,而本文使用的工具依赖于 Python。所以我们的操作如下:</p><ol><li><p>首先<a href="https://www.python.org/downloads/">下载</a>并安装 Python 最新版</p><ul><li>⚠️ 安装的时候,确认勾选「<em>Add <code>python.exe</code> to PATH</em>」<strong>添加 <code>python.exe</code> 到 PATH</strong> 的选项,其他保持默认即可。</li></ul></li><li><p>克隆或下载 <a href="https://gitlab.com/ThomasHastings/motorola_flash_xml">motorola_flash_xml</a> 整个仓库</p></li><li><p>将 RETEU 的固件 <code>*.zip</code> 解压到 <code>motorola_flash_xml.py</code> 所在的目录(即 <code>flashfile.xml</code> 与 <code>motorola_flash_xml.py</code> 处于同一目录)</p></li><li><p>通过 cmd 执行以下命令:</p></li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 将 cmd 的路径切换至 motorola_flash_xml.py 所在的目录,如:</span></span><br><span class="line"><span class="built_in">cd</span> /d D:\repo\motorola_flash_xml</span><br><span class="line"></span><br><span class="line"><span class="comment"># 生成刷写脚本:</span></span><br><span class="line">python motorola_flash_xml.py</span><br><span class="line"></span><br><span class="line"><span class="comment"># 刷写 RETEU 固件:</span></span><br><span class="line">flash_all.bat</span><br></pre></td></tr></table></figure></blockquote></li></ul><p>执行完上述操作之后,RETEU 的系统就刷写进去了。</p><hr><h2 id="软件通道的转换操作"><a href="#软件通道的转换操作" class="headerlink" title="软件通道的转换操作"></a>软件通道的转换操作</h2><p>修改软件通道之后,您的设备将可以正常接收欧洲零售版的 OTA 更新。操作方法如下:</p><ol><li><p>将手机重启至 bootloader 模式</p></li><li><p>更改『<em>Software channel</em>』软件通道为 <code>reteu</code></p><p>设备处于 bootloader 模式下,cmd 键入命令:</p></li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fastboot oem config carrier reteu</span><br></pre></td></tr></table></figure><p>您<strong>仍需</strong>要将设备<strong>恢复出厂设置</strong>之后,软件通道的修改才能生效</p><p>『<em>Software channel</em>』<strong>软件通道 的查看</strong>:</p><ul><li>『<em>Settings</em>』设置 →『<em>About Phone</em>』关于手机 →『<em>Software channel</em>』软件通道</li></ul><hr><h2 id="FAQ"><a href="#FAQ" class="headerlink" title="FAQ"></a>FAQ</h2><details cyan><summary> 关于回锁 bootloader 的问题(点击以展开) </summary> <div class='content'> <blockquote><p>Motorola 零售机的 bootloader 有三种模式:</p><ul><li><p><code>oem_locked</code>:bootloader 的出厂状态</p></li><li><p><code>flashing_unlocked</code>:解锁 bootloader 后的状态</p></li><li><p><code>flashing_locked</code>:通过命令回锁的状态。</p></li></ul><p><strong>回锁</strong>(<code>flashing_locked</code>)有以下影响:</p><ul><li><p><strong>回锁</strong>不能恢复您的保修资格(因为 bootloader 状态与出厂不符),且并<strong>不能恢复 DRM 等级</strong>;</p></li><li><p>如果您刷的是<strong>匹配地区的官方固件</strong>(且<strong>未经任何修改</strong>,如未装 Magisk 等),<strong>回锁</strong>您<strong>可能仍能正常启动</strong>;</p></li><li><p>但如若刷了<strong>其他区域的固件</strong>或<strong>第三方固件</strong>,<strong>回锁可能只会直接导致变砖</strong>;</p></li><li><p><strong>回锁</strong>可能会导致您<strong>无法通过官方的解锁方法再次解锁 bootloader</strong></p></li></ul></blockquote> </div> </details><details cyan><summary> 关于系统降级的问题(点击以展开) </summary> <div class='content'> <blockquote><ul><li><p>Motorola 全部机型的 <strong>Bootloader</strong> 和<strong>基带</strong> (<em>Baseband Part</em>) 部分存在熔丝级防降级机制,刷入之后<strong>很可能无法降级回许久未更新的国行系统</strong>。</p></li><li><p>多数情况下,<strong>基带版本降级</strong>可能会导致<strong>设备 IMEI 丢失</strong>或<strong>手机信号丢失</strong>的情况,<strong>更新版本后则可恢复正常</strong>。</p></li></ul></blockquote> </div> </details><details cyan open><summary> 关于 Google 账户锁的问题 </summary> <div class='content'> <blockquote><p>初次刷入 RETEU 的系统不存在 Google 账户锁,可以跳过不登陆 Google 账户。但如果您已经登陆过 Google 账户,<strong>未退出 Google 账户</strong>或通过 recovery <strong>抹除设备</strong>(<strong>而非通过系统设置恢复出厂设置</strong>),再次使用 RETEU 固件则会触发 Google 账户锁(开机向导状态下,通知栏左上角有个 <code>🔒</code> 的标志,则为触发 Google 账户锁)。</p><p>可以通过 Lineage recovery(「<em>Advanced</em>」<strong>高级</strong> →「<em>Enable ADB</em>」<strong>启用 ADB shell</strong>)使用命令抹除 <code>frp</code> 分区解决:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">adb shell</span><br><span class="line"><span class="built_in">dd</span> <span class="keyword">if</span>=/dev/zero of=/dev/block/bootdevice/by-name/frp bs=512 count=1024</span><br><span class="line"><span class="built_in">exit</span></span><br></pre></td></tr></table></figure><p>抹除完 <code>frp</code> 分区后,请再进入<strong>系统设置完成一次正常的恢复出厂设置</strong>(否则您可能会遇到一些奇奇怪怪的问题,如无法通过 apk 安装软件等)</p></blockquote> </div> </details><h2 id="截图展示"><a href="#截图展示" class="headerlink" title="截图展示"></a>截图展示</h2><ul><li>收到 OTA 更新的相关截图:</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/how-to-convert-edge-s-pro-to-retail-europe/1.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/how-to-convert-edge-s-pro-to-retail-europe/1.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/how-to-convert-edge-s-pro-to-retail-europe/2.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/how-to-convert-edge-s-pro-to-retail-europe/2.png"></a><span></span></div></div> <ul><li>更新后关于手机截图:</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/how-to-convert-edge-s-pro-to-retail-europe/3.jpg' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/how-to-convert-edge-s-pro-to-retail-europe/3.jpg"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/how-to-convert-edge-s-pro-to-retail-europe/4.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/how-to-convert-edge-s-pro-to-retail-europe/4.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/how-to-convert-edge-s-pro-to-retail-europe/5.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/how-to-convert-edge-s-pro-to-retail-europe/5.png"></a><span></span></div></div> ]]></content>
<categories>
<category> Android </category>
</categories>
<tags>
<tag> Android </tag>
<tag> Motorola </tag>
</tags>
</entry>
<entry>
<title>如何安装 Microsoft Store 版本的 Office</title>
<link href="/how-to-install-office-from-microsoft-store.html"/>
<url>/how-to-install-office-from-microsoft-store.html</url>
<content type="html"><![CDATA[<p>有别于 <a href="https://github.com/YerongAI/Office-Tool/releases/latest">Office Tool Plus</a> 工具部署安装 Click-to-Run 版本的 Office,本文将指引您通过第三方的解析网站从微软商店获取 UWP 版本的 Office ,并使之可以顺利地在新版本的 Windows 环境下侧载安装。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-office-from-microsoft-store/3.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-office-from-microsoft-store/3.png"></a><span></span></div></div><span id="more"></span><h2 id="优缺点"><a href="#优缺点" class="headerlink" title="优缺点"></a>优缺点</h2><overflow><table><thead><tr><th>优点</th><th>缺点</th></tr></thead><tbody><tr><td>应用商店版本的 Office 没有 Click-to-Run 组件,不存在后台。</td><td>应用商店版本的 Office 安装包非常大,仅基本包就超过 Click-to-Run 安装包的总大小。</td></tr><tr><td>应用商店版本的 Office 卸载很快,而且组件可以直接单独安装。</td><td>应用商店版本的 Office 只能在支持 UWP 应用的 Windows 10 及以上系统版本上运行。</td></tr><tr><td>应用商店版本的 Office 可以自动适配系统语言,不需手动下载语言包。</td><td>应用商店版本的 Office 仅提供 32-bit,而 Click-to-Run 可以自选 32-bit 或 64-bit 版本</td></tr></tbody></table></overflow><h2 id="获取相关安装包"><a href="#获取相关安装包" class="headerlink" title="获取相关安装包"></a>获取相关安装包</h2><ul><li>第三方的 Microsoft Store 应用下载解析网站:<a href="https://store.rg-adguard.net/">Microsoft Store - Generation Project</a></li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-office-from-microsoft-store/1.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-office-from-microsoft-store/1.png"></a><span></span></div></div><blockquote><p>通过该解析网站,解析 <strong>App Installer、Office 任一组件</strong>的商店 URL 链接即可得到所需直链(包括 Office 基础包:Microsoft Office Desktop Apps)。</p></blockquote><blockquote><p>💡Tips:考虑到<strong>兼容性问题</strong>,建议 Office 基础包(Microsoft Office Desktop Apps)及任一 Office 组件的<strong>版本一致</strong>。</p></blockquote><blockquote><p>💡Tips:因为 Chromium 等浏览器新版本已经禁用了在 <em>https</em> 站点直接点击下载 <em>http</em> 链接的文件,<strong>请将解析得到的 http 直链复制到新的标签页,才可顺利下载</strong>。</p></blockquote><table><thead><tr><th>名称</th><th>商店链接</th><th>下载文件名</th><th>sha1sum</th></tr></thead><tbody><tr><td>App Installer</td><td><a href="https://www.microsoft.com/store/productId/9NBLGGH4NNS1">link</a></td><td><code>Microsoft.DesktopAppInstaller_2021.1207.203.0_neutral_~_8wekyb3d8bbwe.AppxBundle</code></td><td><code>6e7d34b433bcb76f203843647186c72f0bdc83b3</code></td></tr><tr><td>Microsoft Office Desktop Apps</td><td><code>❌</code></td><td><code>Microsoft.Office.Desktop_16051.16130.20306.0_neutral_~_8wekyb3d8bbwe.AppxBundle</code></td><td><code>ae9b639d7ef8f4a9c0c7b52036e7a4abaaf2e6c0</code></td></tr><tr><td>Word</td><td><a href="https://www.microsoft.com/store/productId/CFQ7TTC0K5D7">link</a></td><td><code>Microsoft.Office.Desktop.Word_16051.16130.20306.0_neutral_~_8wekyb3d8bbwe.AppxBundle</code></td><td><code>a60c3f15fd94b0c13429a4d0cd993239956418d0</code></td></tr><tr><td>Excel</td><td><a href="https://www.microsoft.com/store/productId/CFQ7TTC0K5F3">link</a></td><td><code>Microsoft.Office.Desktop.Excel_16051.16130.20306.0_neutral_~_8wekyb3d8bbwe.AppxBundle</code></td><td><code>f04b25e5c123c555e3f673cc5efb8acfe9d65696</code></td></tr><tr><td>PowerPoint</td><td><a href="https://www.microsoft.com/store/productId/CFQ7TTC0K5CT">link</a></td><td><code>Microsoft.Office.Desktop.PowerPoint_16051.16130.20306.0_neutral_~_8wekyb3d8bbwe.AppxBundle</code></td><td><code>c46b8ee31d12b92172fc8aded888b9c4c7e7f8b4</code></td></tr><tr><td>OneNote</td><td><a href="https://www.microsoft.com/store/productId/CFQ7TTC0K56B">link</a></td><td><code>Microsoft.Office.Desktop.OneNote_16051.16130.20306.0_neutral_~_8wekyb3d8bbwe.AppxBundle</code></td><td><code>b63f14bb5a9886580abf7f5b09262d7fe899144f</code></td></tr><tr><td>…</td><td>…</td><td>…</td><td>…</td></tr></tbody></table></overflow><h2 id="安装说明"><a href="#安装说明" class="headerlink" title="安装说明"></a>安装说明</h2><p><strong>要想在新版本的 Windows 环境下顺利安装 Microsoft Store 版本的 Office,请依照以下次序安装即可</strong>:</p><p><strong>首先</strong>,请先鼠标右键选择下载好的 App Installer 安装包 <code>Microsoft.DesktopAppInstaller_2021.1207.203.0_neutral_~_8wekyb3d8bbwe.AppxBundle</code>,鼠标点击确认安装旧版本的 App Installer。如果不安装这个旧版本的 App Installer,可能在您的系统上如(Windows 11)将会报错“Error in parsing the app package.”:</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-office-from-microsoft-store/2.jpg' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-office-from-microsoft-store/2.jpg"></a><span></span></div></div><p><strong>然后</strong>再安装<strong>基础包</strong> Microsoft Office Desktop Apps,<strong>之后</strong>任意次序安装<strong>各 Office 组件</strong>即可。</p><h2 id="关于激活"><a href="#关于激活" class="headerlink" title="关于激活"></a>关于激活</h2><p><strong>只要拥有正版授权的用户(包括目前大多数笔电预装的 Microsoft Office 家庭和学生版授权),都可以直接在 Microsoft Store 版本的 Office 登录自己的微软账号或者输入密钥激活即可。</strong></p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-office-from-microsoft-store/4.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-office-from-microsoft-store/4.png"></a><span></span></div></div><p>如果需要使用 KMS 激活,具体做法可参考:<a href="https://www.coolhub.top/archives/115#:~:text=%E6%BF%80%E6%B4%BB%20Office">[技能扩展] 安装 Microsoft Store 版本的 Office</a></p>]]></content>
<categories>
<category> Windows </category>
</categories>
<tags>
<tag> Office </tag>
<tag> Microsoft Office </tag>
<tag> Microsoft Store </tag>
</tags>
</entry>
<entry>
<title>官方 OpenWrt 无 Web 页面 (Luci)?手动编辑配置文件实现宽带拨号 (PPPoE)</title>
<link href="/pppoe-without-luci.html"/>
<url>/pppoe-without-luci.html</url>
<content type="html"><![CDATA[<p>导语:官方 OpenWrt 默认情况不包含 Luci Web 页面。虽然默认启用了 DHCP 可以直接从网关自动获取 IP 或 DNS,但是如果您是需要配置该设备连宽带拨号 (PPPoE) 的,没有 Luci 页面的情况下该如何操作呢?本文将会教您如何通过手动配置的方法实现 PPPoE 拨号:</p><span id="more"></span><h2 id="PPPoE-网络连接"><a href="#PPPoE-网络连接" class="headerlink" title="PPPoE 网络连接"></a>PPPoE 网络连接</h2><p>打开系统的终端(在 Windows 的用户打开 cmd 或 Windows Terminal),通过输入命令 <code>ssh [email protected]</code> 登录至设备,然后执行命令:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /etc/config/network</span><br></pre></td></tr></table></figure><p>找到配置文件中的 <code>config interface 'wan'</code> 这一块,按照如下格式填写:</p><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">......</span><br><span class="line"></span><br><span class="line">config interface 'wan'</span><br><span class="line"> option device 'eth1'</span><br><span class="line"> option proto 'pppoe'</span><br><span class="line"> option username 'username'</span><br><span class="line"> option password 'password'</span><br><span class="line"> option ipv6 'auto'</span><br><span class="line"> option peerdns '0'</span><br><span class="line"> list dns '223.5.5.5'</span><br><span class="line"> list dns '119.29.29.29'</span><br><span class="line"></span><br><span class="line">config interface 'wan6'</span><br><span class="line"> option device 'eth1'</span><br><span class="line"> option proto 'dhcpv6'</span><br><span class="line"></span><br><span class="line">......</span><br></pre></td></tr></table></figure><blockquote><p>配置文件各项解释如下:</p><ul><li>device ‘eth1’ : 网卡设备为 eth1,不同设备可能具有不同的网卡设备名。<strong>保持该项配置不变</strong></li><li>proto ‘pppoe’ : 协议默认是 dhcp,我们需要将此改为 pppoe 以进行宽带拨号</li><li>username ‘username’ : 该项为运营商 (ISP) 提供的宽带账户名,将 ‘username’ 改为您实际的账户名即可</li><li>password ‘password’ : 该项为运营商 (ISP) 提供的宽带密码,将 ‘password’ 改为您实际的密码即可</li><li>ipv6 ‘auto’ : ipv6 自动获取</li><li>peerdns ‘0’ : 是否从上级网关获取 DNS(通常为运营商 ISP 提供的 DNS),0 为不获取</li><li>list dns ‘x.x.x.x’ : 手动分配的 DNS,我这里设置了 2 个阿里的公共 DNS 服务器,您可以根据您自身需求更改此项</li></ul></blockquote><p>配置文件修改完之后,重启下网络服务即可:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">/etc/init.d/network restart</span><br></pre></td></tr></table></figure><h2 id="修改设备-LAN-IP"><a href="#修改设备-LAN-IP" class="headerlink" title="修改设备 LAN IP"></a>修改设备 LAN IP</h2><p>如果您使用的是官方 OpenWrt,设备默认 LAN IP 是 192.168.1.,但如果您的网络环境中有其他设备(常见的如如运营商的光猫设备)使用了同样的 LAN IP,这将会导致您前面无法通过 ssh 登录至设备,此时您需要修改设备的 LAN IP。</p><p>为确保不受其他设备的影响,请先暂时移除设备的 WAN 口线缆,仅使用 1 个 LAN 口与您的电脑相连,然后此时通过 <code>ssh [email protected]</code> 登录至设备,执行命令修改:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">uci <span class="built_in">set</span> network.lan.ipaddr=<span class="string">"192.168.2.1"</span></span><br><span class="line">uci commit network</span><br><span class="line">/etc/init.d/network restart</span><br></pre></td></tr></table></figure><p>上面我将设备的 LAN IP 修改为 192.168.2.1,您可以根据您自身情况修改。</p><h2 id="安装-Luci(可选项)"><a href="#安装-Luci(可选项)" class="headerlink" title="安装 Luci(可选项)"></a>安装 Luci(可选项)</h2><p>通过上面的操作,您的设备应该已经可以正常联网了,如果您还是想要 Luci Web 页面,您可以通过下列命令安装即可:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 更新软件包仓库信息</span></span><br><span class="line">opkg update</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装 Luci</span></span><br><span class="line">opkg install luci</span><br><span class="line"></span><br><span class="line"><span class="comment"># 安装 Luci 中文语言包</span></span><br><span class="line">opkg install luci-i18n-base-zh-cn</span><br></pre></td></tr></table></figure><p>安装完成后您便可以通过浏览器访问设备的 LAN IP 进入 Luci 页面了。</p>]]></content>
<categories>
<category> OpenWrt </category>
</categories>
<tags>
<tag> OpenWrt </tag>
<tag> PPPoE </tag>
</tags>
</entry>
<entry>
<title>在 Debian 10 上 Redis 的安装及其安全配置</title>
<link href="/how-to-install-and-secure-redis-on-debian-10.html"/>
<url>/how-to-install-and-secure-redis-on-debian-10.html</url>
<content type="html"><![CDATA[<p>Redis 是一种基于内存的键值对存储数据库,其以灵活性、性能和广泛的语言支持而闻名。本教程将会演示如何在 Debian 10 服务器上安装和安全地部署 Redis。</p><h2 id="先决条件"><a href="#先决条件" class="headerlink" title="先决条件"></a>先决条件</h2><p>要完成本教程,您需要使用一个拥有 sudo 权限的非 root 用户和基本的防火墙配置的服务器。</p><p>当你准备好开始时,使用拥有 sudo 权限的用户登录到你的服务器,然后继续下面的工作。</p><h2 id="安装和配置-Redis"><a href="#安装和配置-Redis" class="headerlink" title="安装和配置 Redis"></a>安装和配置 Redis</h2><p>更新你的本地 apt 软件包缓存并安装 Redis:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo apt update</span><br><span class="line">sudo apt install redis-server</span><br></pre></td></tr></table></figure><p>在这之后,需要对 Redis 的配置文件进行一个重要的修改,该文件是在安装过程中自动生成的。使用你喜欢的文本编辑器对其进行编辑:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/redis/redis.conf</span><br></pre></td></tr></table></figure><p>在文件中,找到 <code>supervised</code> 项,此项允许你声明使用 init 将 Redis 作为一个服务来进行管理。默认情况下 <code>supervised</code> 被设为 <code>no</code>,所以我们将其改为 <code>systemd</code>:</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-and-secure-redis-on-debian-10/1.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-and-secure-redis-on-debian-10/1.png"></a><span></span></div></div><p>随后只需要重启一下 Redis 服务:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo systemctl restart redis</span><br></pre></td></tr></table></figure><h2 id="测试-Redis"><a href="#测试-Redis" class="headerlink" title="测试 Redis"></a>测试 Redis</h2><p>在对 Redis 的配置进行任何进一步的更改之前,最好确保 Redis 能按照预期的方式运行。首先检查 Redis 服务是否正在运行:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo systemctl status redis</span><br></pre></td></tr></table></figure><p>如果运行时没有任何错误,这个命令将产生类似于下面的输出:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">* redis-server.service - Advanced key-value store</span><br><span class="line"> Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)</span><br><span class="line"> Active: active (running) since Thu 2021-02-18 12:53:46 CST; 4s ago</span><br><span class="line"> Docs: http://redis.io/documentation,</span><br><span class="line"> man:redis-server(1)</span><br><span class="line"> Process: 9790 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)</span><br><span class="line"> Main PID: 9791 (redis-server)</span><br><span class="line"> Tasks: 4 (limit: 544)</span><br><span class="line"> Memory: 1.8M</span><br><span class="line"> CGroup: /system.slice/redis-server.service</span><br><span class="line"> `-9791 /usr/bin/redis-server 127.0.0.1:6379</span><br><span class="line"></span><br><span class="line">Feb 18 12:53:46 debian systemd[1]: Starting Advanced key-value store...</span><br><span class="line">Feb 18 12:53:46 debian systemd[1]: redis-server.service: Can't open PID file /run/redis/redis-server.pid (yet?) after start: No such</span><br><span class="line">Feb 18 12:53:46 debian systemd[1]: Started Advanced key-value store.</span><br></pre></td></tr></table></figure><p>在这里,你可以看到 Redis 正在运行( <strong>active (running)</strong> ),并且已经被设置为 <strong>enabled</strong>(每次服务器启动时启动)。</p><p>要测试 Redis 是否正常运行,可使用命令行客户端连接到服务器:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">redis-cli</span><br></pre></td></tr></table></figure><p>使用 <code>ping</code> 命令测试连通性:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">127.0.0.1:6379> ping</span><br></pre></td></tr></table></figure><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">PONG</span><br></pre></td></tr></table></figure><p><code>PONG</code> 这个输出意味着服务器的连通性是没问题的。接下来检查是否能正常创建一个 key 并设置值:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">127.0.0.1:6379> <span class="built_in">set</span> <span class="built_in">test</span> <span class="string">"It's working!"</span></span><br></pre></td></tr></table></figure><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">OK</span><br></pre></td></tr></table></figure><p>执行下列指令获取指定 key 的值:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">127.0.0.1:6379> get <span class="built_in">test</span></span><br></pre></td></tr></table></figure><p>假设一切正常,你就能检索到你存储的值:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">"It's working!"</span><br></pre></td></tr></table></figure><p>确认可以取值后,退出 Redis 命令提示符,回到 shell:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">127.0.0.1:6379> <span class="built_in">exit</span></span><br></pre></td></tr></table></figure><p>作为最后一项测试,我们将检查 Redis 是否能够在停止或重启后仍能持久化数据。要做到这一点,你可以:</p><ol><li>首先 <code>sudo systemctl restart redis</code> 重启 Redis 实例。</li><li><code>redis-cli</code> 连接到服务器,<code>get test</code> 尝试获取先前给 <code>test</code> 设定的值。</li></ol><p>如果没有异常,那就说明你的 Redis 已经就绪。然而,它的一些默认配置是不安全的,为恶意行为者提供了攻击和访问你的服务器及其数据的机会。本教程中的其余步骤涵盖了 <a href="https://redis.io/docs/management/security">Redis 官方网站</a>规定的缓解这些漏洞的方法。</p><h2 id="Redis-的-bind-参数"><a href="#Redis-的-bind-参数" class="headerlink" title="Redis 的 bind 参数"></a>Redis 的 bind 参数</h2><p>编辑 Redis 配置文件 <code>/etc/redis/redis.conf</code> :</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/redis/redis.conf</span><br></pre></td></tr></table></figure><p>找到这一行,你会看到这么一行:</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-and-secure-redis-on-debian-10/2.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-and-secure-redis-on-debian-10/2.png"></a><span></span></div></div><blockquote><ul><li>默认情况下,Redis 只能从本地回环网络接口( <strong>localhost</strong> )访问,并不会暴露给公网接口,这样子是相对更安全的。即 <code>bind 127.0.0.1 ::1</code>。</li><li>如果在正常业务中 Redis 服务的确<strong>需要公网</strong>上的其他机器对其访问,可以通过在 <code>bind</code> 项后追加<strong>服务器的公网接口 IP</strong>。</li></ul></blockquote><p>可以使用 <code>ip addr show</code> 查看当前 Linux 服务器上的网络接口。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">eric@debian:~$ ip addr show</span><br><span class="line">1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000</span><br><span class="line"> <span class="built_in">link</span>/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00</span><br><span class="line"> inet 127.0.0.1/8 scope host lo</span><br><span class="line"> valid_lft forever preferred_lft forever</span><br><span class="line"> inet6 ::1/128 scope host</span><br><span class="line"> valid_lft forever preferred_lft forever</span><br><span class="line">2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq state UP group default qlen 1000</span><br><span class="line"> <span class="built_in">link</span>/ether 00:16:13:4b:af:50 brd ff:ff:ff:ff:ff:ff</span><br><span class="line"> inet 107.xxx.xxx.245/24 brd 107.189.30.255 scope global dynamic ens3</span><br><span class="line"> valid_lft 2589688sec preferred_lft 2589688sec</span><br><span class="line"> inet6 fe80::216:13ff:fe4b:af50/64 scope <span class="built_in">link</span></span><br><span class="line"> valid_lft forever preferred_lft forever</span><br></pre></td></tr></table></figure><p>我当前有两个网络接口:</p><overflow><table><thead><tr><th align="center">网络接口</th><th align="center">说明</th></tr></thead><tbody><tr><td align="center">lo</td><td align="center">本地回环接口</td></tr><tr><td align="center">ens3</td><td align="center">公网接口</td></tr></tbody></table></overflow><p>所以在 <code>bind</code> 后面加多一个公网接口的 IP,地址为 <code>107.xxx.xxx.245</code>(IP 地址中的 <code>x</code> 是为了隐去我的 IP 地址的部分位数)。</p><figure class="highlight plaintext"><figcaption><span>/etc/redis/redis.conf</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">bind 127.0.0.1 ::1 107.xxx.xxx.245</span><br></pre></td></tr></table></figure><p>然后 <code>sudo systemctl restart redis</code> 重启下 redis 服务即可,这样配置 Redis 就会监听本地回环接口和公网接口了。</p><p>要检查这个变化是否已经生效,可以使用 <code>ss</code> 或 <code>netstat</code> 来验证:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ss -an | grep 6379</span><br></pre></td></tr></table></figure><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo netstat -lnp | grep redis</span><br></pre></td></tr></table></figure><p>接下来你还需要添加一个防火墙规则,假设你使用 <code>ufw</code> 来管理防火墙并想要允许指定的远程机器的 IP(即客户端的公网 IP) 访问 Redis 服务,你可以运行以下命令:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo ufw allow proto tcp from <CLIENT_IP_ADDRESS> to any port 6379</span><br></pre></td></tr></table></figure><blockquote><ul><li>将 <code><CLIENT_IP_ADDRESS></code> 改为<strong>客户端的公网 IP</strong></li></ul></blockquote><p>完成后,你可以使用 <code>redis-cli</code> 工具通过 <code>ping</code> Redis 服务器来测试连接,可以在另一台机器(作为客户端)中执行命令:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">redis-cli -h <REDIS_IP_ADDRESS> ping</span><br></pre></td></tr></table></figure><blockquote><ul><li>将 <code><REDIS_IP_ADDRESS></code> 改为 <strong>Redis 服务端的公网 IP</strong>(本文的例子为 <code>107.xxx.xxx.245</code>,请自行根据你的情况作出修改),没有问题的话该命令将返回 <code>PONG</code> 的响应。</li></ul></blockquote><h2 id="配置-Redis-密码"><a href="#配置-Redis-密码" class="headerlink" title="配置 Redis 密码"></a>配置 Redis 密码</h2><p>密码是直接在 Redis 的配置文件 <code>/etc/redis/redis.conf</code> 中配置的,所以再次编辑配置文件 <code>/etc/redis/redis.conf</code> :</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/redis/redis.conf</span><br></pre></td></tr></table></figure><p>找到 <strong>SECURITY</strong> 部分可以看到有一行被注释(即 <code>#</code> 开头)的项:</p><figure class="highlight plaintext"><figcaption><span>/etc/redis/redis.conf</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">. . .</span><br><span class="line"># requirepass foobared</span><br></pre></td></tr></table></figure><p>删去开头的 <code>#</code> 和空格,将默认的密码 <code>foobared</code> 改成你想要的密码。当然为了更安全,与其自己编写密码,你也可以选择使用一个简单的命令生成复杂度更高的密码(该命令将显示给定字符串的 SHA256 校验和),如:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">echo</span> <span class="string">"HelloWorld"</span> | <span class="built_in">sha256sum</span></span><br></pre></td></tr></table></figure><div class="note warning"><p><strong>切记</strong>:要创建一个独特的密码,请将 <code>""</code> 中的字符串(即 <code>HelloWorld</code>)改为任何其他单词或短语。</p></div> <p>修改后的配置文件将如下所示:</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-and-secure-redis-on-debian-10/3.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-and-secure-redis-on-debian-10/3.png"></a><span></span></div></div><p>重启 redis 服务之后连接到 redis:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo systemctl restart redis</span><br><span class="line">redis-cli</span><br></pre></td></tr></table></figure><p>直接尝试给指定 key 设置一个值:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">127.0.0.1:6379> <span class="built_in">set</span> key1 10</span><br></pre></td></tr></table></figure><p>不出意外的话会报错,因为你没有通过验证。输出报错信息如下:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">(error) NOAUTH Authentication required.</span><br></pre></td></tr></table></figure><p>所以你需要使用 <code>auth</code> 命令进行验证:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">127.0.0.1:6379> auth your_redis_password</span><br></pre></td></tr></table></figure><blockquote><ul><li>请将 <code>your_redis_password</code> 改为您在 <strong>Redis 配置文件中的密码</strong>。</li></ul></blockquote><p>验证通过后就能正常使用 Redis 了。</p><h2 id="禁用或重命名危险命令"><a href="#禁用或重命名危险命令" class="headerlink" title="禁用或重命名危险命令"></a>禁用或重命名危险命令</h2><p>Redis 内置的另一个安全功能可以禁用或重命名某些被认为是危险的命令,如 FLUSHDB,FLUSHALL,DEBUG 等。一些被认为是危险的命令(以下并非完整列表)包括:</p><ul><li>FLUSHDB</li><li>FLUSHALL</li><li>KEYS</li><li>PEXPIRE</li><li>DEL</li><li>CONFIG</li><li>SHUTDOWN</li><li>BGREWRITEAOF</li><li>BGSAVE</li><li>SAVE</li><li>SPOP</li><li>SREM</li><li>RENAME</li><li>DEBUG</li></ul><div class="note warning"><p>你是否应该禁用或重命名一个命令<strong>取决于你的具体需求</strong>,如果你知道<strong>你永远不会使用一个可能被滥用的命令,那么你可以禁用它</strong>(也可设置为一些复杂的、难以猜测的名字)。</p></div><p>同样的,编辑配置文件 <code>/etc/redis/redis.conf</code> 的 <strong>SECURITY</strong> 部分设置。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-and-secure-redis-on-debian-10/4.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/how-to-install-and-secure-redis-on-debian-10/4.png"></a><span></span></div></div><ul><li>要禁用一个命令,只需将其重命名为一个空字符串(用一对引号表示,中间没有字符),如下所示:</li></ul><figure class="highlight plaintext"><figcaption><span>/etc/redis/redis.conf</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">. . .</span><br><span class="line">rename-command FLUSHDB ""</span><br><span class="line">rename-command FLUSHALL ""</span><br><span class="line">rename-command DEBUG ""</span><br><span class="line">. . .</span><br></pre></td></tr></table></figure><ul><li>要重命名一个命令,请给它另一个名字(一些复杂的或难以猜测的名字,但至少应该让你自己很容易记住),如下面的例子所示:</li></ul><figure class="highlight plaintext"><figcaption><span>/etc/redis/redis.conf</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">. . .</span><br><span class="line">rename-command SHUTDOWN SHUTDOWN_MENOT</span><br><span class="line">rename-command CONFIG ASC12_CONFIG</span><br><span class="line">. . .</span><br></pre></td></tr></table></figure><p>修改完配置文件后,最后重启 Redis 服务就好了。</p><h2 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h2><p>在本教程中,您安装并配置了 Redis,验证了您的 Redis 安装是否正常运行,并使用其内置的安全功能使其不易受到恶意行为者的攻击。请记住,一旦有人登录到你的服务器,就很容易规避我们设置的 Redis 特定安全功能。因此,最重要的安全功能是你系统的防火墙。</p>]]></content>
<categories>
<category> Linux </category>
</categories>
<tags>
<tag> Redis </tag>
<tag> Debian </tag>
</tags>
</entry>
<entry>
<title>一文教您使用 Sandboxie Plus 运行 QQ 桌面版</title>
<link href="/run-qq-with-sandboxie-plus.html"/>
<url>/run-qq-with-sandboxie-plus.html</url>
<content type="html"><![CDATA[<div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/cover.png" alt="图片来源:<a target=_blank rel=noopener href=https://www.pixiv.net/en/artworks/87117133 data-pjax-state=>Pixiv</a>" style="height:250px;"/></div><span class="image-caption">图片来源:<a target=_blank rel=noopener href=https://www.pixiv.net/en/artworks/87117133 data-pjax-state=>Pixiv</a></span></div><p><strong>导语</strong>:腾讯 QQ/Tim 会获取用户浏览器(Chrome、IE 以及其它 Chromium 内核浏览器)的历史访问记录,在读取后会根据数据对信息情况进行分类。腾讯 QQ/Tim 会使用 MD5 比较历史记录中的搜索链接,链接包括淘宝、天猫、京东。搜索链接匹配之后,腾讯 QQ/Tim 还会使用 MD5 比较搜索的关键字,如古着、融资、股票等。 众多网友进行一波分析谈论得了出上述结论,而腾讯的回应则是『<strong>读取浏览器数据是为了用户好</strong>』。本文将介绍如何使用 Sandboxie Plus 防范 QQ 读取个人隐私,希望能给您一些帮助。</p><span id="more"></span><h2 id="相关背景"><a href="#相关背景" class="headerlink" title="相关背景"></a>相关背景</h2><ul><li><a href="https://www.v2ex.com/t/745030">QQ 正在尝试读取你的浏览记录 - V2EX</a> | <a href="https://web.archive.org/web/20210114143043/https://www.v2ex.com/t/745030">📁归档</a></li><li><a href="https://bbs.kanxue.com/thread-265359.htm">关于 QQ 读取 Chrome 历史记录的澄清 - 看雪论坛</a> | <a href="https://web.archive.org/web/20210116220819/https://bbs.pediy.com/thread-265359.htm">📁归档</a></li><li><a href="https://telegra.ph/%E4%B9%9F%E8%AE%BA%E8%85%BE%E8%AE%AF%E5%AF%B9%E4%BD%A0%E7%9A%84%E5%8E%86%E5%8F%B2%E8%AE%B0%E5%BD%95%E5%81%9A%E4%BA%86%E7%82%B9%E5%95%A5-01-17">也论腾讯拿你的历史记录做了点啥- Lion Yang & Epics of Anticensorship</a> | <a href="https://archive.is/U6VSs">📁归档</a></li><li><a href="https://www.zhihu.com/question/439768601/answer/1683913941">如何看待 QQ 扫描读取所有浏览器的历史记录? - 腾讯QQ的回答 - 知乎</a> | <a href="https://web.archive.org/web/20210119143703/https://www.zhihu.com/question/439768601/answer/1683913941">📁归档</a></li></ul><details cyan><summary> 相关评论(点击以展开) </summary> <div class='content'> <blockquote><p>『<strong>判断用户是否恶意登录</strong>』还需要读取淘宝、天猫、京东搜索记录,看用户是否搜了<strong>炒股</strong>、<strong>股票</strong>、<strong>融资</strong>、<strong>融券</strong>、<strong>古着</strong>、<strong>VINTAGE</strong> 吗?判断用户登陆风险安全还要<strong>启动之后 10 分钟</strong>才扫描吗?你 TM 自己信吗?反正我是不信。 – from <a href="https://t.me/anticensorship_epics/96">Epics of Anti-Censorship</a></p></blockquote><blockquote><p>我就想知道 —— 淘宝、天猫、京东的<strong>搜索链接匹配</strong>和官方说的<strong>拦截恶意程序</strong>有什么关系。</p><p>再问几个不懂的问题:</p><p>腾讯:<strong>读取浏览器历史用以判断用户登录安全风险的情况,读取的数据用于在PC QQ的本地客户端中判断是否恶意登录。</strong></p><p>①. 为什么要在登陆后十分钟进行检测?判断是否为恶意登录不应该在登录时进行吗?</p><p>②. 检测的关键字为什么是电商地址、股票、融资这几个关键词?你怎么通过这几个关键词来判断是不是恶意登录?</p><p>③. 知乎的热搜为什么直接被撤了?</p><p>④. QQ这篇回答的评论为什么还要审核?</p><p>–from <a href="https://mp.weixin.qq.com/s/KLy8VC4I1ZBG1ArUxeilag">火绒安全实验室公众号文章<strong>评论区</strong></a></p></blockquote> </div> </details><hr><h2 id="操作流程"><a href="#操作流程" class="headerlink" title="操作流程"></a>操作流程</h2><h3 id="操作视频"><a href="#操作视频" class="headerlink" title="操作视频"></a>操作视频</h3><iframe width="560" height="315" src="https://odysee.com/$/embed/run-QQ-with-SandboxiePlus/05c31719ef1626df4af0f5c892cc43c4a7dfafe0?r=9dqbAP46xNQpfpSCTmkeuz5SRiaZz5Tb" allowfullscreen></iframe><ul><li>⚠ <strong>视频没有任何配音和字幕,建议直接对照文章进行操作。</strong></li></ul><h3 id="图文教程"><a href="#图文教程" class="headerlink" title="图文教程"></a>图文教程</h3><h4 id="准备相关文件"><a href="#准备相关文件" class="headerlink" title="准备相关文件"></a>准备相关文件</h4><ul><li><strong>Sandboxie Plus 安装包</strong>(<code>Sandboxie-Plus*.exe</code>)</li></ul><blockquote><p>前往「<a href="https://github.com/sandboxie-plus/Sandboxie/releases/latest"><em>Sandboxie Plus</em> 的下载页</a>」,根据您<strong>操作系统位数</strong>(x86 为 32 位,x64 为 64 位)进行选择下载。</p></blockquote><ul><li><strong>QQ 桌面版 Appx 包</strong>(<code>*.appx</code>)</li></ul><blockquote><p>将「<a href="https://www.microsoft.com/zh-cn/p/qq/9NHLGF0ZWC5S">QQ 桌面版(Microsoft Store)</a>」的链接复制到「<a href="https://store.rg-adguard.net/">Online link generator for Microsoft Store</a>」的输入框,渠道选择「<strong>Retail</strong> 零售」。确认,等待页面载入后,选择最大的文件进行下载。</p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/1.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/1.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/2.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/2.png"></a><span></span></div></div><ul><li><strong>QQ PC 版安装包</strong>(<code>QQ*.exe</code>)</li></ul><blockquote><p>直接前往「<a href="https://im.qq.com/pcqq/">QQ PC 版</a>」页面下载。</p></blockquote><h4 id="操作要点"><a href="#操作要点" class="headerlink" title="操作要点"></a>操作要点</h4><blockquote><p><strong>说明</strong>:要在沙盒运行<strong>微软商店版的 QQ</strong>(无 <code>qqprotect.exe</code>)之前得先在沙盒里安装一次 <strong>QQ PC 版</strong>(安装启动一次之后就可以卸载),否则无法启动,就是这么玄学 🤣。</p></blockquote><ol><li><strong>安装 Sandboxie Plus</strong></li></ol><blockquote><p><strong>安装路径</strong>,选择你想要的路径就行,如我选择 <code>G:\Program Files\Sandboxie-Plus</code>。其他选项默认</p></blockquote><ol start="2"><li>启用 <strong>Windows 10 Core UI</strong> 兼容选项</li></ol><blockquote><p>⚠ <strong>如果不对此进行操作,将会导致沙盒里的应用无法使用系统内置的输入法输入中文。</strong></p><p>Sandboxie Plus 菜单栏「<strong>Options</strong>」 -> 「<strong>Global Settings</strong>」 -> 「<strong>Software Compatibility</strong>」 -> 启用「<strong>Windows 10 Core UI</strong>」,点击「<strong>Apply</strong>」。</p></blockquote><ol start="3"><li><strong>Sandboxie Plus 文件系统根目录的设置</strong></li></ol><blockquote><p>⚠ <strong>如果不对此进行操作,沙盒里的文件将会默认存储到系统盘。</strong></p><p>可以通过 Sandboxie Plus 菜单栏「<strong>Options</strong>」 -> 「<strong>Global Settings</strong>」 -> 「<strong>Advanced Options</strong>」-> 「<strong>Sandbox file system root</strong>」修改路径,如我修改成 <code>G:\Sandboxie\%SANDBOX%</code>,最后点击「Apply」。</p></blockquote><ol start="4"><li><strong>移除默认的沙盒「DefaultBox」</strong></li></ol><blockquote><p>默认的沙盒我们不需要,留着没用,不如删了。</p><p>鼠标右键选中,选择「<strong>Remove Sandbox</strong>」。</p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class="img-wrap"><div class="img-bg"><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/3.png' data-fancybox='default' data-caption='image'><img fancybox itemprop="contentUrl" class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/3.png" alt="image" style="height:300px;"/></a><span></span></div></div></div></div><ol start="5"><li><strong>新建沙盒</strong></li></ol><blockquote><p>Sandboxie Plus 菜单栏「<strong>Sandbox</strong>」 -> 「<strong>Create New Box</strong>」,输入名字,其余选项默认即可。</p></blockquote><ol start="6"><li><strong>设置沙盒的资源访问权限</strong></li></ol><blockquote><p>⚠ 目前 Sandboxie Plus 暂不支持<a href="https://github.com/sandboxie-plus/Sandboxie/issues/194"><strong>资源访问的白名单模式</strong></a>,所以编写规则略显麻烦,不过据 Sandboxie Plus 项目成员 <a href="https://github.com/DavidXanatos">DavidXanatos</a> 的回复说<a href="https://github.com/sandboxie-plus/Sandboxie/issues/194#issuecomment-732149941">在计划中</a>了,那么就让我们拭目以待吧。</p></blockquote><blockquote><p>鼠标右键选中<strong>您新建的沙盒</strong>,「<strong>Sandbox Options</strong>」,左栏「<strong>Resource Access</strong>」,「<strong>Add File/Folder</strong>」,可根据您的需求,<strong>借鉴</strong>以下内容填写。</p></blockquote><ul><li><strong>Closed</strong>:拒绝对资源的所有访问(包括读写),例如对包含敏感数据的文件或文件夹的访问。</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/4.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/4.png"></a><span></span></div></div><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">%UserProfile%\AppData\Local\Google # Chrome 浏览器数据</span><br><span class="line">%UserProfile%\AppData\Local\Microsoft # Edge 浏览器数据</span><br><span class="line">%UserProfile%\.ssh # SSH 数据</span><br><span class="line">%UserProfile%\.gnupg # GPG 数据</span><br><span class="line">%UserProfile%\.config # Clash 数据</span><br><span class="line">%AppData%\clash_win # Clash 数据</span><br><span class="line">%UserProfile%\.bash_history # Git Bash 历史记录</span><br><span class="line">%UserProfile%\.gitconfig # Git 配置文件</span><br><span class="line">D:\ # D 盘</span><br><span class="line">E:\ # E 盘</span><br><span class="line">F:\ # F 盘</span><br></pre></td></tr></table></figure><ol start="7"><li><strong>解压 QQ 桌面版 Appx 包(<code>*.appx</code>)</strong></li></ol><blockquote><p>使用解压缩软件(如 <em>7-zip</em>)解压 <strong>QQ 桌面版 Appx 包</strong>(<code>*.appx</code>),找到 <code>QQ</code> 文件夹,再用解压缩软件将 QQ 文件夹打包成 <strong>zip 格式</strong>,命名为 <code>QQ.zip</code>。</p></blockquote><ol start="8"><li><strong>移动相关文件到合适的位置</strong></li></ol><blockquote><p>因为我这边下载的文件默认路径在 <code>F:\Downloads</code>,而 <code>F</code> 盘已经被我设为拒绝访问,故需要将文件放置到<strong>拒绝资源访问权限规则之外的位置</strong>。如将 <code>QQ.zip</code> 和 <strong>QQ PC 版安装包</strong>(<code>QQ*.exe</code>)移动至 <code>G:\</code>。</p></blockquote><ol start="9"><li><strong>安装 QQ PC 版到沙盒</strong></li></ol><blockquote><p>直接鼠标右键选中 <code>QQ*.exe</code>,选择「<strong>Run Sandboxed</strong>」,然后流程如往常安装软件一样,自定义安装,选择<strong>安装路径</strong>和<strong>个人文件夹保存位置</strong>(当然和前面一样,必须是<strong>拒绝资源访问权限规则之外的位置</strong>),如分别为 <code>G:\Program Files</code> 和 <code>G:\Documents</code>,安装完成后启动过一次再退出就可以了。</p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class="img-wrap"><div class="img-bg"><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/5.png' data-fancybox='default' data-caption='image'><img fancybox itemprop="contentUrl" class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/5.png" alt="image" style="height:400px;"/></a><span></span></div></div></div></div><ol start="10"><li><strong>卸载 QQ PC 版</strong></li></ol><blockquote><p><strong>Sandboxie Plus 主界面</strong>鼠标右键选中您创建过的沙盒,「<strong>Run</strong>」 -> 「<strong>Run Explorer</strong>」,这样也就是在沙盒里打开资源管理器了。找到安装路径下的 <code>QQUninst.exe</code>,具体路径如 <code>G:\Program Files\Tencent\QQ\QQUninst.exe</code>,<strong>双击</strong>,完成卸载后再将 <code>G:\Program Files\Tencent</code> <strong>整个文件夹删除</strong>。</p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/6.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/6.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/7.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/7.png"></a><span></span></div></div><ol start="11"><li><strong>在沙盒打开的资源管理器中将 <code>QQ.zip</code> 解压</strong></li></ol><blockquote><p>鼠标右键选中文件,「<strong>Open with</strong> 打开方式」 -> 「<strong>Windows Explorer</strong> 资源管理器」,然后将 <code>QQ</code> 文件夹复制到合适的位置,如 <code>G:\</code></p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class="img-wrap"><div class="img-bg"><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/8.png' data-fancybox='default' data-caption='image'><img fancybox itemprop="contentUrl" class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/8.png" alt="image" style="height:400px;"/></a><span></span></div></div></div></div><ol start="12"><li><strong>启动 QQ 并创建快捷方式</strong></li></ol><blockquote><p>在 <strong>Sandboxie Plus 主界面</strong>,找到 <strong>QQ 的主进程</strong>,鼠标右键选中,「<strong>Create Shortcut</strong> 创建快捷方式」放到桌面就可以了,下次想要在沙盒运行 QQ 只需要直接双击桌面上的快捷方式咯</p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/9.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/run-qq-with-sandboxie-plus/9.png"></a><span></span></div></div>]]></content>
<categories>
<category> Software </category>
</categories>
<tags>
<tag> Sandboxie Plus </tag>
<tag> QQ </tag>
<tag> 沙盒 </tag>
</tags>
</entry>
<entry>
<title>V2Ray (WebSocket + TLS + Web + Cloudflare) 手动配置详细说明</title>
<link href="/V2Ray-TLS-WebSocket-Nginx-with-Cloudflare.html"/>
<url>/V2Ray-TLS-WebSocket-Nginx-with-Cloudflare.html</url>
<content type="html"><![CDATA[<p><strong>先决条件</strong></p><p>在<strong>开始操作之前</strong>,建议你先了解以下基础知识:</p><ul><li>使用 ssh 命令或 ssh 客户端登录远程服务器</li><li>使用 vim 或其他编辑器的最基本的操作</li></ul><span id="more"></span><h2 id="购买-VPS"><a href="#购买-VPS" class="headerlink" title="购买 VPS"></a>购买 VPS</h2><details cyan><summary> 购买 VPS 的说明(点击以展开) </summary> <div class='content'> <p>Hmmm… 本人学生党(穷 ➕ 没有办理国际信用卡),买境外的 VPS 不太方便。我找了相对便宜的(没有活动时的价格最低为 <strong>$3.71 / 月</strong>)且支持使用支付宝的 VPS 提供商 —— <a href="https://cloudcone.com/"><strong>CloudCone</strong></a>。</p><p>注册登录没太多好说的,唯一的<strong>建议</strong>就是注册的时候填写<strong>国外的邮箱</strong>(Cloudcone 将会通过这个邮箱告知你 VPS 的 <strong>IP 地址</strong>和 <strong>root 用户的初始密码</strong>)。</p><p>这里简单说下如何<strong>通过支付宝</strong>进行充值:</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/1.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/1.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/2.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/2.png"></a><span></span></div></div><p>填写完<strong>支付宝关联的邮箱地址</strong>(如支付宝未与任何邮箱关联,请自行搜索相关内容),会跳转至支付宝扫码付款的页面,付款成功就可新建 VPS 实例了。</p><p>新建实例部分,本文以 <strong>Debian 10</strong> 为例,您也可以使用其他 Linux 发行版本。如您使用其他 Linux 发行版本,本教程后续的部分命令或许会有些许差异(如软件包的安装等),当然本文对您仍具有参考意义。</p><p><strong>主机名</strong>按照框内灰色字体的格式填写即可。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/3.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/3.png"></a><span></span></div></div><p>新建实例成功后,请注意查看你<strong>注册账号时的邮箱</strong>,是否收到包含服务器<strong>公网 IPv4 地址</strong>和 <strong>root 用户初始密码</strong>的电子邮件。</p> </div> </details><h2 id="初始化-VPS"><a href="#初始化-VPS" class="headerlink" title="初始化 VPS"></a>初始化 VPS</h2><details cyan><summary> 具体步骤 </summary> <div class='content'> <p><strong>ssh 登录到远程服务器的 root 用户</strong>后再完成以下操作:</p><ol><li><strong>更新</strong>系统已知的软件包列表、<strong>升级</strong>系统上的所有软件包、<strong>移除</strong>不再需要的依赖软件包:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apt update && apt upgrade && apt autoremove</span><br></pre></td></tr></table></figure><hr><blockquote><p>正经的 Linux 用户不会用 root 干所有的事情,如果这么做的话将会很危险。创建一个普通的用户,并让它可以通过 <em>sudo</em> 指令用 root 权限执行命令是一般的解决方案。</p></blockquote><ol start="2"><li>在用 <em>sudo</em> 之前,我们需要先安装 <strong>sudo</strong> 这个软件包:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apt install sudo</span><br></pre></td></tr></table></figure><ol start="3"><li><strong>新建</strong>一个普通用户,本文新建名为 <code>eric</code> 的用户( <code>-m</code> 为用户创建相应的 home 目录,<code>-s </code> 选项使用 /bin/bash 作为用户的 shell,<code>-G</code> 并将其添加到 sudo 用户组中),创建好后第2行命令给 eric 用户设置一个密码:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">useradd -m -s /bin/bash -G sudo eric</span><br><span class="line">passwd eric</span><br></pre></td></tr></table></figure><ol start="4"><li>相关建议(可选操作)</li></ol><div class="tabs" id="tab-a"><ul class="nav-tabs"><li class="tab active"><a class="#a-1">相关建议</a></li></ul><div class="tab-content"><div class="tab-pane active" id="a-1"><p><strong>为了安全</strong>起见,建议你完成下列操作:</p><ul><li>禁止通过 SSH 登录到 root 用户</li><li>限制 SSH 通过用户密码来登录,并实现 SSH 仅能通过密钥登录服务器</li></ul><p><strong>在操作之前,你需要先将本机公钥添加到远程服务器</strong></p><ul><li>首先确认下本机是否生成过 SSH 密钥。Git Bash 上执行命令 <code>ls ~/.ssh</code> 查看是否有 <code>id_*</code> 和 <code>id_*.pub</code> 这两个文件(其中 <code>*</code> 是生成密钥的签名类型),如果没有则需要通过 ssh-keygen 生成,在 Git Bash 中执行命令:</li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen -t ecdsa</span><br></pre></td></tr></table></figure><ul><li>如果已生成过 SSH 密钥,你现在就可以通过命令将本机的公钥信息添加到远程服务器中,执行命令后会让你确认信息,输入 <code>yes</code>,然后输入服务器用户的登录密码:</li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">$ ssh-copy-id eric@服务器IP地址</span><br><span class="line"></span><br><span class="line">......</span><br><span class="line"></span><br><span class="line">Are you sure you want to <span class="built_in">continue</span> connecting (<span class="built_in">yes</span>/no/[fingerprint])? <span class="built_in">yes</span></span><br><span class="line"></span><br><span class="line">......</span><br><span class="line"></span><br><span class="line">eric@服务器IP地址<span class="string">'s password:</span></span><br></pre></td></tr></table></figure><p>完成该操作之后就可以免密登录服务器了,如果要禁用远程登录 root 用户和使用密码登录的方式,点击下面的『<strong>操作要点</strong>』展开</p><details green><summary> 操作要点 </summary> <div class='content'> <ul><li><strong>禁止通过 SSH 登录到 root 用户</strong><ul><li>编辑 <code>/etc/ssh/sshd_config</code></li></ul></li></ul><figure class="highlight plaintext"><figcaption><span>/etc/ssh/sshd_config</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">......</span><br><span class="line"></span><br><span class="line">PermitRootLogin no</span><br><span class="line"></span><br><span class="line">......</span><br></pre></td></tr></table></figure><ul><li><strong>限制 SSH 通过用户密码来登录</strong><ul><li>编辑 <code>/etc/ssh/sshd_config</code></li></ul></li></ul><figure class="highlight plaintext"><figcaption><span>/etc/ssh/sshd_config</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">......</span><br><span class="line"></span><br><span class="line">PasswordAuthentication no</span><br><span class="line"></span><br><span class="line">......</span><br></pre></td></tr></table></figure><ul><li>编辑完配置文件后,<code>sudo systemctl restart sshd</code> 重启下服务器的 sshd 服务</li></ul> </div> </details></div></div></div> </div> </details><h2 id="安装-V2Ray-前的准备"><a href="#安装-V2Ray-前的准备" class="headerlink" title="安装 V2Ray 前的准备"></a>安装 V2Ray 前的准备</h2><blockquote><p>正经的 Linux 用户不会用 root 干所有的事情,如果这么做的话将会很危险。所以<strong>使用普通用户</strong>,再通过 <em>sudo</em> 指令用 root 权限执行命令是坠吼的。</p></blockquote><p><strong>使用普通用户</strong>通过 ssh 登录到你的远程服务器后再完成以下操作:</p><h3 id="时间校准"><a href="#时间校准" class="headerlink" title="时间校准"></a>时间校准</h3><blockquote><p>对于 V2Ray,它的验证方式包含时间,就算是配置没有任何问题,如果时间不正确,也无法连接 V2Ray 服务器的,服务器会认为你这是不合法的请求。所以系统时间一定要正确,只要保证时间误差在 <strong>90 秒</strong> 之内就没问题。</p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">sudo timedatectl set-ntp <span class="literal">true</span> <span class="comment"># 启用 NTP 服务</span></span><br><span class="line">sudo <span class="built_in">ln</span> -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime <span class="comment"># 将时区设为“亚洲/上海”</span></span><br><span class="line">sudo hwclock --systohc <span class="comment"># 将硬件时钟调整到与当前系统时间一致</span></span><br><span class="line"><span class="built_in">date</span> -R <span class="comment"># 以 RFC 5322 格式输出日期和时间。例如 Mon, 18 Jan 2021 11:04:16 +0800</span></span><br></pre></td></tr></table></figure><p>执行完之后,终端显示的时间如果正确,那么就没问题了。</p><h3 id="防火墙初始化"><a href="#防火墙初始化" class="headerlink" title="防火墙初始化"></a>防火墙初始化</h3><ul><li>本文将使用 <em>ufw</em> 来管理系统的防火墙</li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">sudo apt install ufw</span><br><span class="line">sudo ufw <span class="built_in">enable</span></span><br><span class="line">sudo ufw allow <span class="string">'OpenSSH'</span></span><br></pre></td></tr></table></figure><h3 id="安装相关软件包"><a href="#安装相关软件包" class="headerlink" title="安装相关软件包"></a>安装相关软件包</h3><ol><li><strong>更新</strong>系统已知的软件包列表、<strong>升级</strong>系统上的所有软件包、<strong>移除</strong>不再需要的依赖软件包:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt update && sudo apt upgrade && sudo apt autoremove</span><br></pre></td></tr></table></figure><ol start="2"><li><strong>安装编辑器</strong> vim(后续编写配配置文件需要,当然你也可以使用其他编辑器)</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt install vim</span><br></pre></td></tr></table></figure><ol start="3"><li><strong>安装</strong>所需要的依赖软件包:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt install curl openssl</span><br></pre></td></tr></table></figure><h2 id="安装并配置-V2Ray"><a href="#安装并配置-V2Ray" class="headerlink" title="安装并配置 V2Ray"></a>安装并配置 V2Ray</h2><h3 id="下载-V2Ray-安装脚本"><a href="#下载-V2Ray-安装脚本" class="headerlink" title="下载 V2Ray 安装脚本"></a>下载 V2Ray 安装脚本</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">curl -O https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh</span><br><span class="line">curl -O https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-dat-release.sh</span><br></pre></td></tr></table></figure><h3 id="安装-V2ray-主程序"><a href="#安装-V2ray-主程序" class="headerlink" title="安装 V2ray 主程序"></a>安装 V2ray 主程序</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo bash install-release.sh</span><br></pre></td></tr></table></figure><h3 id="安装最新发行的-geoip-dat-和-geosite-dat"><a href="#安装最新发行的-geoip-dat-和-geosite-dat" class="headerlink" title="安装最新发行的 geoip.dat 和 geosite.dat"></a>安装最新发行的 geoip.dat 和 geosite.dat</h3><ul><li><code>geoip.dat</code>:IP 数据文件</li><li><code>geosite.dat</code>:域名数据文件</li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo bash install-dat-release.sh</span><br></pre></td></tr></table></figure><h3 id="配置-V2Ray"><a href="#配置-V2Ray" class="headerlink" title="配置 V2Ray"></a>配置 V2Ray</h3><p>使用 vim 编辑 V2Ray 的配置文件:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /usr/local/etc/v2ray/config.json</span><br></pre></td></tr></table></figure><p>清空文件原有内容,然后输入以下内容:</p><figure class="highlight json"><figcaption><span>/usr/local/etc/v2ray/config.json</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br></pre></td><td class="code"><pre><span class="line"><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"log"</span><span class="punctuation">:</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"loglevel"</span><span class="punctuation">:</span><span class="string">"warning"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"routing"</span><span class="punctuation">:</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"domainStrategy"</span><span class="punctuation">:</span><span class="string">"AsIs"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"rules"</span><span class="punctuation">:</span><span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"type"</span><span class="punctuation">:</span><span class="string">"field"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"ip"</span><span class="punctuation">:</span><span class="punctuation">[</span></span><br><span class="line"> <span class="string">"geoip:private"</span></span><br><span class="line"> <span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"outboundTag"</span><span class="punctuation">:</span><span class="string">"block"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"inbounds"</span><span class="punctuation">:</span><span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"listen"</span><span class="punctuation">:</span><span class="string">"127.0.0.1"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"port"</span><span class="punctuation">:</span><span class="number">10000</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"protocol"</span><span class="punctuation">:</span><span class="string">"vmess"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"settings"</span><span class="punctuation">:</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"clients"</span><span class="punctuation">:</span><span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"id"</span><span class="punctuation">:</span><span class="string">"9dfe7fee-d08f-44f8-ad2d-300d4c9c3a0e"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"alterId"</span><span class="punctuation">:</span><span class="number">0</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"streamSettings"</span><span class="punctuation">:</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"network"</span><span class="punctuation">:</span><span class="string">"ws"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"wsSettings"</span><span class="punctuation">:</span><span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"path"</span><span class="punctuation">:</span><span class="string">"/ray"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"outbounds"</span><span class="punctuation">:</span><span class="punctuation">[</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"protocol"</span><span class="punctuation">:</span><span class="string">"freedom"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"tag"</span><span class="punctuation">:</span><span class="string">"direct"</span></span><br><span class="line"> <span class="punctuation">}</span><span class="punctuation">,</span></span><br><span class="line"> <span class="punctuation">{</span></span><br><span class="line"> <span class="attr">"protocol"</span><span class="punctuation">:</span><span class="string">"blackhole"</span><span class="punctuation">,</span></span><br><span class="line"> <span class="attr">"tag"</span><span class="punctuation">:</span><span class="string">"block"</span></span><br><span class="line"> <span class="punctuation">}</span></span><br><span class="line"> <span class="punctuation">]</span></span><br><span class="line"><span class="punctuation">}</span></span><br></pre></td></tr></table></figure><blockquote><ul><li><code>port</code>:V2Ray 的 <strong>WebSocket 所监听的内网端口</strong>,取值范围是 <strong>1 ~ 65535</strong>,但<strong>为了避免端口占用,所以不能填常用的端口号</strong>(如 22 是 <em>ssh</em> 的端口号,80 是 <em>HTTP</em> 的端口号,443 是 <em>HTTPS</em> 的端口号等),此处设我为 <code>10000</code></li><li><code>id</code>:<strong>用户的主 ID</strong>。可<strong>通过 <a href="https://www.v2fly.org/awesome/tools.html#%E5%9C%A8%E7%BA%BF%E5%B7%A5%E5%85%B7">UUID 生成器 - v2fly</a> 或者 <a href="https://www.uuidgenerator.net/">Online UUID Generator</a> 生成</strong>(任选其中一个网站生成就行),此处我设为 <code>9dfe7fee-d08f-44f8-ad2d-300d4c9c3a0e</code></li><li><code>alterId</code>:根据<a href="https://www.v2fly.org/config/protocols/vmess.html">新 V2Ray 白话文指南 – VMess</a>,<strong>推荐值为 0,代表启用 VMessAEAD</strong></li><li><code>network</code>:<strong>传输协议</strong>。设为 <strong>WebSocket</strong>,即 <code>ws</code></li><li><code>path</code>:<strong>WebSocket 所使用的 HTTP 协议路径</strong>。可自定义,例如我设为 <code>/ray</code></li></ul></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/5.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/5.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/6.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/6.png"></a><span></span></div></div><div class="note warning"><p><strong>咳咳,上面的配置文件想要照抄的话至少 id 取不一样的值就好</strong> 🤣</p></div><h2 id="注册域名"><a href="#注册域名" class="headerlink" title="注册域名"></a>注册域名</h2><details cyan><summary> 注册域名的说明 </summary> <div class='content'> <p>域名可通过网站 <a href="https://www.namesilo.com/">NameSilo</a> 进行申请注册,这个站点<strong>最低可花 $0.99</strong> 即可注册申请一年的域名,同时还支持免费启用 <strong>WHOIS privacy</strong>(WHOIS 隐私服务大致的意思是:从 WHOIS 记录中删除您的个人联系信息)。</p><hr><ul><li>在 <strong>NameSilo</strong> 注册完登录账号,然后搜索你想要的域名,<strong>选择域名</strong>。选择<strong>最便宜的就行</strong>(至于<strong>续费域名</strong>的费用比较高,所以建议是<strong>域名过期后再换</strong>就行):</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/7.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/7.png"></a><span></span></div></div><hr><ul><li>点击 <strong>Add</strong> 之后,会跳转如下界面(此处注意关掉<strong>自动续费</strong>,打开 <strong>WHOIS 隐私</strong>服务):</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/8.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/8.png"></a><span></span></div></div><hr><ul><li>支付方面,NameSilo 也是支持支付宝进行支付的,<strong>填写支付宝相关联的邮箱地址</strong>,然后进行扫码支付。</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/9.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/9.png"></a><span></span></div></div><hr><ul><li>付款成功后<strong>点击</strong>页面里的「<strong>Account Domains</strong> 账户所属域名」栏里的<strong>数字</strong></li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/10.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/10.png"></a><span></span></div></div><hr><ul><li>然后跳转到<strong>信息填写页面</strong>,这些信息可以通过<a href="https://www.haoweichi.com/">美国虚拟信息生成器</a><strong>生成</strong>然后进行填写(<strong>其中带 <code>*</code> 号的为必填项</strong>)</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/11.png" alt="image" style="height:400px;"/></div></div><hr><ul><li>填写完信息后,<strong>点击 🌏 图标管理域名的 DNS</strong>,然后在 DNS 管理页面<strong>点击 ❌ 删除所有的记录</strong></li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/12.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/12.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/13.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/13.png"></a><span></span></div></div><div class="note warning"><p><strong>注册完域名记得前往您的电子邮箱查收来自 NameSilo 的邮件,必须点击 WHOIS 的邮箱验证链接,否则您的域名可能将被注销。</strong></p></div> </div> </details><h2 id="Cloudflare-接管域名解析"><a href="#Cloudflare-接管域名解析" class="headerlink" title="Cloudflare 接管域名解析"></a>Cloudflare 接管域名解析</h2><p>完成前面的步骤后,我们将在这一步使用 Cloudflare 来接管域名的解析。</p><details cyan><summary> 具体步骤 </summary> <div class='content'> <ol><li><strong>注册</strong> Cloudflare 的账号,注册完账号之后,<strong>请前往邮箱查看来自 Cloudflare 的邮件,点击验证链接以验证您的电子邮箱</strong>。</li></ol><ul><li><a href="https://www.cloudflare.com/">Cloudflare 官网</a></li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/14.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/14.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/15.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/15.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/16.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/16.png"></a><span></span></div></div><hr><ol start="2"><li><strong>添加站点</strong>,输入先前注册的域名即可。</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/17.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/17.png"></a><span></span></div></div><hr><ol start="3"><li>选择「<strong>免费计划</strong>」</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/18.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/18.png"></a><span></span></div></div><hr><ol start="4"><li><strong>暂不</strong>添加 DNS 记录</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/19.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/19.png"></a><span></span></div></div><hr><ol start="5"><li>前往域名提供商(如前面介绍的 <a href="https://www.namesilo.com/">NameSilo</a>),点击图示部分进行<strong>域名服务器的管理</strong></li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/20.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/20.png"></a><span></span></div></div><hr><ol start="6"><li><strong>移除</strong>域名提供商预置的「<strong>域名服务器</strong>」,用 Cloudflare 提供的「<strong>域名服务器</strong>」<strong>替换</strong>之。</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/21.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/21.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/22.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/22.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/23.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/23.png"></a><span></span></div></div><hr><ol start="7"><li>「<strong>Submit</strong> 提交」完上述变更之后,等待若干分钟后域名的状态转为「<strong>active</strong> 激活」。然后点击「<strong>Done, check nameservers</strong>」。</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/24.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/24.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/25.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/25.png"></a><span></span></div></div><hr><ol start="8"><li>点击「<strong>Finish later</strong>」,然后再回到 <a href="https://www.cloudflare.com/">Cloudflare 首页</a>,等待若干分钟后「<strong>Pending Nameserver Update</strong>」会转为「<strong>active</strong>」,这时<strong>点进去</strong>。</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/26.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/26.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/27.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/27.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/28.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/28.png"></a><span></span></div></div><hr><ol start="9"><li><strong>添加</strong> DNS 记录</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/29.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/29.png"></a><span></span></div></div><hr><ol start="10"><li>如下图表<strong>添加</strong> 2 条记录就可以了。</li></ol><overflow><table><thead><tr><th>Type</th><th>Name</th><th>IPv4 address</th><th>Proxy status</th></tr></thead><tbody><tr><td><code>A</code></td><td><code>@</code></td><td><code>x.x.x.x</code></td><td><code>☁ Proxied</code></td></tr><tr><td><code>A</code></td><td><code>www</code></td><td><code>x.x.x.x</code></td><td><code>☁ Proxied</code></td></tr></tbody></table></overflow><ul><li>云朵被点亮(即 <code>☁ Proxied</code>)意味着你的网站流量必须经过 Cloudflare,也可以说使用了 Cloudflare 的 CDN 节点。</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/30.png' data-fancybox='default' data-caption='添加一条记录的示例'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/30.png" alt="添加一条记录的示例"></a><span class='image-caption'>添加一条记录的示例</span></div></div> </div> </details><h2 id="安装-Nginx-及其初始配置"><a href="#安装-Nginx-及其初始配置" class="headerlink" title="安装 Nginx 及其初始配置"></a>安装 Nginx 及其初始配置</h2><details cyan open><summary> 具体步骤 </summary> <div class='content'> <div class="note warning"><p><strong>请将本文中的 <code>ericclose.xyz</code> 替换成您注册的域名</strong></p></div><h3 id="安装-Nginx"><a href="#安装-Nginx" class="headerlink" title="安装 Nginx"></a>安装 Nginx</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo apt install nginx</span><br></pre></td></tr></table></figure><h3 id="配置防火墙"><a href="#配置防火墙" class="headerlink" title="配置防火墙"></a>配置防火墙</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo ufw allow <span class="string">'Nginx Full'</span></span><br></pre></td></tr></table></figure><h3 id="配置-Nginx"><a href="#配置-Nginx" class="headerlink" title="配置 Nginx"></a>配置 Nginx</h3><ol><li>Nginx 在安装过程中会创建一个<strong>默认的服务器块</strong>。如果它仍然存在,请<strong>将其删除</strong>,因为你后面将<strong>为你注册的域名配置一个自定义服务器块</strong></li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo <span class="built_in">rm</span> /etc/nginx/sites-enabled/default</span><br></pre></td></tr></table></figure><ol start="2"><li>使用如下命令,<strong>为你的域名创建目录</strong></li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo <span class="built_in">mkdir</span> -p /var/www/ericclose.xyz/html</span><br></pre></td></tr></table></figure><ol start="3"><li>接下来,用 <code>$USER</code> 环境变量<strong>给当前的系统用户分配目录的所有权</strong></li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo <span class="built_in">chown</span> -R <span class="variable">$USER</span>:<span class="variable">$USER</span> /var/www/ericclose.xyz/html</span><br></pre></td></tr></table></figure><ol start="4"><li>使用命令<strong>确保 web root 具有正确的权限</strong></li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo <span class="built_in">chmod</span> -R 755 /var/www/ericclose.xyz</span><br></pre></td></tr></table></figure><ol start="5"><li>接下来,使用 <code>vim</code> 或其他编辑器<strong>创建 <code>index.html</code> 页面文件</strong></li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim /var/www/ericclose.xyz/html/index.html</span><br></pre></td></tr></table></figure><p>文件<strong>写入以下内容</strong>:</p><figure class="highlight html"><figcaption><span>/var/www/ericclose.xyz/html/index.html</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag"><<span class="name">html</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">title</span>></span>Welcome<span class="tag"></<span class="name">title</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">head</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">body</span>></span></span><br><span class="line"> <span class="tag"><<span class="name">h1</span>></span>Success! Your Nginx server is successfully configured. <span class="tag"></<span class="name">h1</span>></span></span><br><span class="line"><span class="tag"><<span class="name">p</span>></span>This is a sample page.<span class="tag"></<span class="name">p</span>></span></span><br><span class="line"> <span class="tag"></<span class="name">body</span>></span></span><br><span class="line"><span class="tag"></<span class="name">html</span>></span></span><br></pre></td></tr></table></figure><ol start="6"><li>我们需要<strong>创建一个服务器块,指向我们自定义的 web root</strong>。我们不直接修改默认的配置文件,而是新建一个文件</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/nginx/sites-available/ericclose.xyz</span><br></pre></td></tr></table></figure><p>填写以下内容:</p><figure class="highlight nginx"><figcaption><span>/etc/nginx/sites-available/ericclose.xyz</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">server</span> {</span><br><span class="line"> <span class="attribute">listen</span> <span class="number">80</span>;</span><br><span class="line"> <span class="attribute">listen</span> [::]:<span class="number">80</span>;</span><br><span class="line"></span><br><span class="line"> <span class="attribute">root</span> /var/www/ericclose.xyz/html;</span><br><span class="line"> <span class="attribute">index</span> index.html index.htm index.nginx-debian.html;</span><br><span class="line"></span><br><span class="line"> <span class="attribute">server_name</span> ericclose.xyz www.ericclose.xyz;</span><br><span class="line"></span><br><span class="line"> <span class="section">location</span> / {</span><br><span class="line"> <span class="attribute">try_files</span> <span class="variable">$uri</span> <span class="variable">$uri</span>/ =<span class="number">404</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure><blockquote><ul><li><strong>注意要记得修改配置文件中的 <code>root</code> 项和 <code>server_name</code> 项中的 <code>ericclose.xyz</code>,更改为您的域名即可</strong>。</li></ul></blockquote><ol start="7"><li>接下来,让我们通过在 <code>sites-enabled</code> 目录下<strong>创建一个符号链接</strong>来启用这个服务器块,Nginx 在启动时会在这个目录下读取配置文件:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo <span class="built_in">ln</span> -s /etc/nginx/sites-available/ericclose.xyz /etc/nginx/sites-enabled/</span><br></pre></td></tr></table></figure><ol start="8"><li>为了<strong>防止可能出现的内存问题</strong>,有必要调整 <code>/etc/nginx/nginx.conf</code> 文件中的一个值。</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/nginx/nginx.conf</span><br></pre></td></tr></table></figure><p>找到 <code>server_names_hash_bucket_size</code>,将 <code>#</code> 符号去掉,<strong>取消这一行的注释</strong>。</p><figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">...</span><br><span class="line"><span class="section">http</span> {</span><br><span class="line"> ...</span><br><span class="line"> <span class="attribute">server_names_hash_bucket_size</span> <span class="number">64</span>;</span><br><span class="line"> ...</span><br><span class="line">}</span><br><span class="line">...</span><br></pre></td></tr></table></figure><ol start="9"><li>接下来,<strong>测试一下 Nginx 文件中是否有语法错误</strong>。</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo nginx -t</span><br></pre></td></tr></table></figure><ol start="10"><li>最后,若你的配置测试没有遇到问题,<strong>重启 Nginx 来启用你的更改</strong>。</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo systemctl restart nginx</span><br></pre></td></tr></table></figure><ol start="11"><li>现在可以<strong>访问您注册的域名</strong>了,如下:</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/31.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/31.png"></a><span></span></div></div> </div> </details><h2 id="使用-Cloudflare-生成-TLS-证书和私钥、部署-Authenticated-Origin-Pulls"><a href="#使用-Cloudflare-生成-TLS-证书和私钥、部署-Authenticated-Origin-Pulls" class="headerlink" title="使用 Cloudflare 生成 TLS 证书和私钥、部署 Authenticated Origin Pulls"></a>使用 Cloudflare 生成 TLS 证书和私钥、部署 Authenticated Origin Pulls</h2><h3 id="生成-TLS-证书和私钥"><a href="#生成-TLS-证书和私钥" class="headerlink" title="生成 TLS 证书和私钥"></a>生成 TLS 证书和私钥</h3><p>生成证书的方法有很多,<a href="https://guide.v2fly.org/advanced/tls.html#%E5%AE%89%E8%A3%85%E8%AF%81%E4%B9%A6%E5%92%8C%E5%AF%86%E9%92%A5">新 V2Ray 白话文指南</a>使用 <a href="https://github.com/acmesh-official/acme.sh">acme.sh</a> 生成证书,我这里的话则是通过 Cloudflare 网站生成🤣。</p><div class="note warning"><p>注意:「<strong>Cloudflare Origin Certificate</strong>」是一个只被 Cloudflare 信任的证书,不被浏览器所信任,所以使用「<strong>Cloudflare Origin Certificate</strong>」就必须在前面<strong>使用 Cloudflare 添加 DNS 记录时将云朵点亮</strong>,即 <code>☁ Proxied</code>。<strong>如果不点亮云朵,您的网站将无法安全访问,同时代理也会无法正常连接。</strong> – from <a href="https://community.cloudflare.com/t/https-certificate-not-trusted/3610/12">HTTPS certificate not trusted with Cloudflare Origin Certificate</a></p></div><details cyan open><summary> 具体步骤 </summary> <div class='content'> <p>Cloudflare Origin CA 可以让你生成由 Cloudflare 签署的免费 TLS 证书,安装在你的 Nginx 服务器上,以此可以保护 Cloudflare 的服务器和你的 Nginx 服务器之间的连接。</p><ul><li>要使用 Origin CA 生成证书,请在浏览器中登录 <a href="https://www.cloudflare.com/">Cloudflare</a> 账户。选择您要保护的域名,并导航到 Cloudflare 仪表板的「<strong>SSL/TLS</strong>」部分。然后再从导航到「<strong>Origin Server</strong>」选项卡,然后单击「<strong>Create Certificate</strong> 创建证书」按钮。</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/32.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/32.png"></a><span></span></div></div><ul><li>保留选择「<strong>Let Cloudflare generate a private key and a CSR</strong>」,「<strong>Private key type</strong> 私钥类型」我们选择「<strong>ECDSA</strong>」,关于 ECDSA 相较于 RSA 的优点请自行搜索。其余选项默认,「<strong>Next</strong> 下一步」即可</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class="img-wrap"><div class="img-bg"><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/33.png' data-fancybox='default' data-caption='image'><img fancybox itemprop="contentUrl" class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/33.png" alt="image" style="height:450px;"/></a><span></span></div></div></div></div><ul><li>然后你会看到一个对话框,里面有「<strong>Origin Certificate</strong> 源证书」和「<strong>Private key</strong> 私钥」。你需要将证书和私钥的内容写到你的服务器上。出于安全考虑,<strong>私钥信息仅显示一次,之后不会再显示</strong>,所以在点击「<strong>OK</strong>」之前,最好先将相关内容<strong>复制后妥善保管</strong>。</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/34.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/34.png"></a><span></span></div></div><div class="note warning"><p>你将使用服务器上的 <code>/etc/ssl</code> 目录来存放<strong>源证书</strong>和<strong>私钥</strong>文件。</p></div><div class="note warning"><p>关于 Nginx 的相关配置将在后面讲解。</p></div><hr><ul><li>在服务器上,使用用 vim 或其他文本编辑器编辑 <code>/etc/ssl/cert.pem</code>:</li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/ssl/cert.pem</span><br></pre></td></tr></table></figure><p>将先前保存的<strong>证书</strong>内容添加到文件中,然后保存并退出编辑器。</p><hr><ul><li>在服务器上,使用用 vim 或其他文本编辑器编辑 <code>/etc/ssl/key.pem</code>:</li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/ssl/key.pem</span><br></pre></td></tr></table></figure><hr><p>将先前保存的<strong>私钥</strong>内容添加到文件中,然后保存并退出编辑器。</p><p>现在进入 Cloudflare 仪表板的「<strong>SSL/TLS</strong>」部分,导航到「<strong>Overview</strong>」选项卡,并将 SSL/TLS 加密模式改为「 <strong>Full (strict)</strong> 」。这将<strong>确保 Cloudflare 始终加密 Cloudflare 和你的 Nginx 服务器之间的连接</strong>。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/35.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/35.png"></a><span></span></div></div><p>然后 Cloudflare 仪表板的「<strong>SSL/TLS</strong>」部分,导航到「<strong>Edge Certificates</strong>」选项卡,并将「<strong>Minimum TLS Version</strong>」改为「<strong>TLS 1.2</strong>」:</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/edgecertificates.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/edgecertificates.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/minimumtlsversion.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/minimumtlsversion.png"></a><span></span></div></div><hr><h3 id="部署-Authenticated-Origin-Pulls"><a href="#部署-Authenticated-Origin-Pulls" class="headerlink" title="部署 Authenticated Origin Pulls"></a>部署 Authenticated Origin Pulls</h3><p>如果在 Nginx 服务器上设置了「<strong>Authenticated Origin Pulls</strong>」,就可以确保它只接受来自 Cloudflare 服务器的请求,<strong>防止</strong>任何其他人<strong>直接连接到 Nginx 服务器</strong>。</p><p>要使「<strong>Authenticated Origin Pulls</strong>」正常工作,需要在 Cloudflare 中使用完全 SSL,并更新源 Web 服务器 SSL 配置。下载 <a href="https://developers.cloudflare.com/ssl/static/authenticated_origin_pull_ca.pem">authenticated_origin_pull_ca.pem</a>,或者复制下文证书内容, <strong>并将证书 <code>authenticated_origin_pull_ca.pem</code> 的内容写入到服务器的 <code>/etc/ssl/cloudflare.crt</code> 中</strong>。关于 Nginx 的相关配置下一节会讲解</p><ol><li>点击 Cloudflare 仪表板中的「<strong>SSL/TLS</strong>」部分,导航到「<strong>Origin Server</strong>」选项卡并打开「<strong>Authenticated Origin Pulls</strong>」选项 。</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/36.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/36.png"></a><span></span></div></div> </div> </details><ol start="2"><li><strong>将证书 <code>authenticated_origin_pull_ca.pem</code> 的内容写入到服务器的 <code>/etc/ssl/cloudflare.crt</code> 中</strong></li></ol><p>你可以选择<strong>下载证书</strong> <a href="https://developers.cloudflare.com/ssl/static/authenticated_origin_pull_ca.pem">authenticated_origin_pull_ca.pem</a>,或者<strong>直接复制</strong>证书的内容:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line">-----BEGIN CERTIFICATE-----</span><br><span class="line">MIIGCjCCA/KgAwIBAgIIV5G6lVbCLmEwDQYJKoZIhvcNAQENBQAwgZAxCzAJBgNV</span><br><span class="line">BAYTAlVTMRkwFwYDVQQKExBDbG91ZEZsYXJlLCBJbmMuMRQwEgYDVQQLEwtPcmln</span><br><span class="line">aW4gUHVsbDEWMBQGA1UEBxMNU2FuIEZyYW5jaXNjbzETMBEGA1UECBMKQ2FsaWZv</span><br><span class="line">cm5pYTEjMCEGA1UEAxMab3JpZ2luLXB1bGwuY2xvdWRmbGFyZS5uZXQwHhcNMTkx</span><br><span class="line">MDEwMTg0NTAwWhcNMjkxMTAxMTcwMDAwWjCBkDELMAkGA1UEBhMCVVMxGTAXBgNV</span><br><span class="line">BAoTEENsb3VkRmxhcmUsIEluYy4xFDASBgNVBAsTC09yaWdpbiBQdWxsMRYwFAYD</span><br><span class="line">VQQHEw1TYW4gRnJhbmNpc2NvMRMwEQYDVQQIEwpDYWxpZm9ybmlhMSMwIQYDVQQD</span><br><span class="line">ExpvcmlnaW4tcHVsbC5jbG91ZGZsYXJlLm5ldDCCAiIwDQYJKoZIhvcNAQEBBQAD</span><br><span class="line">ggIPADCCAgoCggIBAN2y2zojYfl0bKfhp0AJBFeV+jQqbCw3sHmvEPwLmqDLqynI</span><br><span class="line">42tZXR5y914ZB9ZrwbL/K5O46exd/LujJnV2b3dzcx5rtiQzso0xzljqbnbQT20e</span><br><span class="line">ihx/WrF4OkZKydZzsdaJsWAPuplDH5P7J82q3re88jQdgE5hqjqFZ3clCG7lxoBw</span><br><span class="line">hLaazm3NJJlUfzdk97ouRvnFGAuXd5cQVx8jYOOeU60sWqmMe4QHdOvpqB91bJoY</span><br><span class="line">QSKVFjUgHeTpN8tNpKJfb9LIn3pun3bC9NKNHtRKMNX3Kl/sAPq7q/AlndvA2Kw3</span><br><span class="line">Dkum2mHQUGdzVHqcOgea9BGjLK2h7SuX93zTWL02u799dr6Xkrad/WShHchfjjRn</span><br><span class="line">aL35niJUDr02YJtPgxWObsrfOU63B8juLUphW/4BOjjJyAG5l9j1//aUGEi/sEe5</span><br><span class="line">lqVv0P78QrxoxR+MMXiJwQab5FB8TG/ac6mRHgF9CmkX90uaRh+OC07XjTdfSKGR</span><br><span class="line">PpM9hB2ZhLol/nf8qmoLdoD5HvODZuKu2+muKeVHXgw2/A6wM7OwrinxZiyBk5Hh</span><br><span class="line">CvaADH7PZpU6z/zv5NU5HSvXiKtCzFuDu4/Zfi34RfHXeCUfHAb4KfNRXJwMsxUa</span><br><span class="line">+4ZpSAX2G6RnGU5meuXpU5/V+DQJp/e69XyyY6RXDoMywaEFlIlXBqjRRA2pAgMB</span><br><span class="line">AAGjZjBkMA4GA1UdDwEB/wQEAwIBBjASBgNVHRMBAf8ECDAGAQH/AgECMB0GA1Ud</span><br><span class="line">DgQWBBRDWUsraYuA4REzalfNVzjann3F6zAfBgNVHSMEGDAWgBRDWUsraYuA4REz</span><br><span class="line">alfNVzjann3F6zANBgkqhkiG9w0BAQ0FAAOCAgEAkQ+T9nqcSlAuW/90DeYmQOW1</span><br><span class="line">QhqOor5psBEGvxbNGV2hdLJY8h6QUq48BCevcMChg/L1CkznBNI40i3/6heDn3IS</span><br><span class="line">zVEwXKf34pPFCACWVMZxbQjkNRTiH8iRur9EsaNQ5oXCPJkhwg2+IFyoPAAYURoX</span><br><span class="line">VcI9SCDUa45clmYHJ/XYwV1icGVI8/9b2JUqklnOTa5tugwIUi5sTfipNcJXHhgz</span><br><span class="line">6BKYDl0/UP0lLKbsUETXeTGDiDpxZYIgbcFrRDDkHC6BSvdWVEiH5b9mH2BON60z</span><br><span class="line">0O0j8EEKTwi9jnafVtZQXP/D8yoVowdFDjXcKkOPF/1gIh9qrFR6GdoPVgB3SkLc</span><br><span class="line">5ulBqZaCHm563jsvWb/kXJnlFxW+1bsO9BDD6DweBcGdNurgmH625wBXksSdD7y/</span><br><span class="line">fakk8DagjbjKShYlPEFOAqEcliwjF45eabL0t27MJV61O/jHzHL3dknXeE4BDa2j</span><br><span class="line">bA+JbyJeUMtU7KMsxvx82RmhqBEJJDBCJ3scVptvhDMRrtqDBW5JShxoAOcpFQGm</span><br><span class="line">iYWicn46nPDjgTU0bX1ZPpTpryXbvciVL5RkVBuyX2ntcOLDPlZWgxZCBp96x07F</span><br><span class="line">AnOzKgZk4RzZPNAxCXERVxajn/FLcOhglVAKo5H0ac+AitlQ0ip55D2/mf8o72tM</span><br><span class="line">fVQ6VpyjEXdiIXWUq/o=</span><br><span class="line">-----END CERTIFICATE-----</span><br></pre></td></tr></table></figure><p>使用 vim 编辑 <code>/etc/ssl/cloudflare.crt</code>,<strong>将证书内容粘贴进去</strong>即可:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/ssl/cloudflare.crt</span><br></pre></td></tr></table></figure><h2 id="Nginx-证书和密钥、反向代理的配置"><a href="#Nginx-证书和密钥、反向代理的配置" class="headerlink" title="Nginx 证书和密钥、反向代理的配置"></a>Nginx 证书和密钥、反向代理的配置</h2><div class="note warning"><p><strong>请将本文中的 <code>ericclose.xyz</code> 替换成您注册的域名</strong></p></div><p>前面只是把证书和私钥的内容写入到服务器,Nginx 的相关配置并没有写,所以这一节就让我们完成它:</p><p>使用 vim 编辑文件 <code>/etc/nginx/sites-available/ericclose.xyz</code>:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/nginx/sites-available/ericclose.xyz</span><br></pre></td></tr></table></figure><p>修改后的文件如下:</p><figure class="highlight nginx"><figcaption><span>/etc/nginx/sites-available/ericclose.xyz</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">server</span> {</span><br><span class="line"> <span class="attribute">listen</span> <span class="number">80</span> default_server;</span><br><span class="line"> <span class="attribute">listen</span> [::]:<span class="number">80</span> default_server;</span><br><span class="line"></span><br><span class="line"> <span class="attribute">server_name</span> ericclose.xyz www.ericclose.xyz;</span><br><span class="line"></span><br><span class="line"> <span class="attribute">return</span> <span class="number">301</span> https://<span class="variable">$host</span><span class="variable">$request_uri</span>;</span><br><span class="line">}</span><br><span class="line"></span><br><span class="line"><span class="section">server</span> {</span><br><span class="line"> <span class="attribute">listen</span> <span class="number">443</span> ssl http2;</span><br><span class="line"> <span class="attribute">listen</span> [::]:<span class="number">443</span> ssl http2;</span><br><span class="line"></span><br><span class="line"> <span class="attribute">ssl_certificate</span> /etc/ssl/cert.pem;</span><br><span class="line"> <span class="attribute">ssl_certificate_key</span> /etc/ssl/key.pem;</span><br><span class="line"> <span class="attribute">ssl_client_certificate</span> /etc/ssl/cloudflare.crt;</span><br><span class="line"> <span class="attribute">ssl_verify_client</span> <span class="literal">on</span>;</span><br><span class="line"> <span class="attribute">ssl_session_timeout</span> <span class="number">1d</span>;</span><br><span class="line"> <span class="attribute">ssl_session_cache</span> shared:MozSSL:<span class="number">10m</span>; <span class="comment"># about 40000 sessions</span></span><br><span class="line"> <span class="attribute">ssl_session_tickets</span> <span class="literal">off</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment"># intermediate configuration</span></span><br><span class="line"> <span class="attribute">ssl_protocols</span> TLSv1.<span class="number">2</span> TLSv1.<span class="number">3</span>;</span><br><span class="line"> <span class="attribute">ssl_ciphers</span> ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;</span><br><span class="line"> <span class="attribute">ssl_prefer_server_ciphers</span> <span class="literal">off</span>;</span><br><span class="line"></span><br><span class="line"> <span class="comment"># HSTS (ngx_http_headers_module is required) (63072000 seconds)</span></span><br><span class="line"> <span class="attribute">add_header</span> Strict-Transport-Security <span class="string">"max-age=63072000"</span> always;</span><br><span class="line"></span><br><span class="line"> <span class="attribute">server_name</span> ericclose.xyz www.ericclose.xyz;</span><br><span class="line"></span><br><span class="line"> <span class="attribute">root</span> /var/www/ericclose.xyz/html;</span><br><span class="line"> <span class="attribute">index</span> index.html index.htm index.nginx-debian.html;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"> <span class="section">location</span> / {</span><br><span class="line"> <span class="attribute">try_files</span> <span class="variable">$uri</span> <span class="variable">$uri</span>/ =<span class="number">404</span>;</span><br><span class="line"> }</span><br><span class="line"></span><br><span class="line"> <span class="section">location</span> /ray {</span><br><span class="line"> <span class="attribute">if</span> (<span class="variable">$http_upgrade</span> != <span class="string">"websocket"</span>) {</span><br><span class="line"> <span class="attribute">return</span> <span class="number">404</span>;</span><br><span class="line"> }</span><br><span class="line"> <span class="attribute">proxy_redirect</span> <span class="literal">off</span>;</span><br><span class="line"> <span class="attribute">proxy_pass</span> http://127.0.0.1:10000;</span><br><span class="line"> <span class="attribute">proxy_http_version</span> <span class="number">1</span>.<span class="number">1</span>;</span><br><span class="line"> <span class="attribute">proxy_set_header</span> Upgrade <span class="variable">$http_upgrade</span>;</span><br><span class="line"> <span class="attribute">proxy_set_header</span> Connection <span class="string">"upgrade"</span>;</span><br><span class="line"> <span class="attribute">proxy_set_header</span> Host <span class="variable">$host</span>;</span><br><span class="line"></span><br><span class="line"> <span class="attribute">proxy_set_header</span> X-Real-IP <span class="variable">$remote_addr</span>;</span><br><span class="line"> <span class="attribute">proxy_set_header</span> X-Forwarded-For <span class="variable">$proxy_add_x_forwarded_for</span>;</span><br><span class="line"> }</span><br><span class="line">}</span><br></pre></td></tr></table></figure><blockquote><ul><li><strong>注意要记得修改配置文件中的 <code>server_name</code> 项和 <code>root</code> 项的 <code>ericclose.xyz</code>,更改为您的域名即可</strong>。</li><li>配置文件中 <code>proxy_pass http://127.0.0.1:10000;</code> 的 <code>10000</code> 必须和前面 V2Ray 配置文件(<code>/usr/local/etc/v2ray/config.json</code>)中的 <code>port</code> 一致。</li><li><code>location /ray { ... }</code> 这里的 <code>/ray</code> 必须与前面 V2Ray 配置文件中的 <code>path</code> 一致(相互对应)。</li></ul></blockquote><p><strong>然后重启 nginx 服务</strong>:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo systemctl restart nginx</span><br></pre></td></tr></table></figure><div class="note warning"><p><strong>现在您可以再次访问您注册的域名来判断配置是否正确,如无误将会看到您之前访问域名的页面,同时可以注意到浏览器已经显示是 <code>HTTPS</code> 链接了。</strong></p></div><ul><li>为了更具真实的网站伪装效果,<strong>您可以自行寻找些前端模板</strong>套上去(本文将不会赘述)</li></ul><h2 id="自启并启动相关服务"><a href="#自启并启动相关服务" class="headerlink" title="自启并启动相关服务"></a>自启并启动相关服务</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo systemctl <span class="built_in">enable</span> v2ray nginx --now <span class="comment"># 自启并启动 V2ray 和 Nginx 的服务</span></span><br><span class="line">sudo systemctl status -l v2ray nginx <span class="comment"># 查看 V2ray 和 Nginx 服务的状态</span></span><br></pre></td></tr></table></figure><h3 id="VMess-MD5-认证信息淘汰机制"><a href="#VMess-MD5-认证信息淘汰机制" class="headerlink" title="VMess MD5 认证信息淘汰机制"></a>VMess MD5 认证信息淘汰机制</h3><blockquote><p>VMessAEAD 协议已经经过同行评议并已经整合了相应的修改。 VMess MD5 认证信息 的淘汰机制已经启动。</p><p>自 2022 年 1 月 1 日起,服务器端将默认禁用对于 MD5 认证信息 的兼容。任何使用 MD5 认证信息的客户端将无法连接到禁用 VMess MD5 认证信息的服务器端。</p><p>在服务器端可以通过设置环境变量 <code>v2ray.vmess.aead.forced</code> = <code>true</code> 以关闭对于 MD5 认证信息的兼容。 或者 <code>v2ray.vmess.aead.forced</code> = <code>false</code> 以强制开启对于 MD5 认证信息 认证机制的兼容 (不受到 2022 年自动禁用机制的影响) 。 (v4.35.0+)<br>– from <a href="https://www.v2fly.org/config/protocols/vmess.html#vmess-md5-%E8%AE%A4%E8%AF%81%E4%BF%A1%E6%81%AF-%E6%B7%98%E6%B1%B0%E6%9C%BA%E5%88%B6">新 V2Ray 白话文指南 – VMess MD5 认证信息淘汰机制</a></p></blockquote><p>为了禁用旧的 MD5 认证信息 的兼容,强制使用 VMessAEAD,我们可以这么做来给 v2ray.service 添加个环境变量:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 给 v2ray.service 创建个 override,而不是直接修改 v2ray.service 本身,以防止更新 V2Ray 后修改的内容失效</span></span><br><span class="line"></span><br><span class="line">sudo EDITOR=vim systemctl edit v2ray.service</span><br></pre></td></tr></table></figure><p>用 vim 编辑器写入如下内容,<code>:wq</code> 保存并退出:</p><figure class="highlight ini"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="section">[Service]</span></span><br><span class="line"><span class="attr">Environment</span>=V2RAY_VMESS_AEAD_FORCED=<span class="literal">true</span></span><br></pre></td></tr></table></figure><p>然后重启 v2ray 服务生效:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo systemctl restart v2ray</span><br></pre></td></tr></table></figure><h2 id="TCP-BBR"><a href="#TCP-BBR" class="headerlink" title="TCP BBR"></a>TCP BBR</h2><ul><li><strong>TCP BBR</strong>(Bottleneck Bandwidth and Round-trip propagation time)是由 Google 设计的一种<strong>拥塞控制算法</strong>。自从 <em>Linux Kernel 4.9</em> 开始就引入了该算法,但<strong>默认没有启用,所以需要手动开启</strong>。</li></ul><p><strong>启用</strong>该算法仅需在 <code>/etc/sysctl.conf</code> 文件<strong>末尾追加两行内容</strong>:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo bash -c <span class="string">"echo 'net.core.default_qdisc=fq' >> /etc/sysctl.conf"</span></span><br><span class="line">sudo bash -c <span class="string">"echo 'net.ipv4.tcp_congestion_control=bbr' >> /etc/sysctl.conf"</span></span><br></pre></td></tr></table></figure><p>接下来你需要重启系统或者直接<strong>使用 <em>systemctl</em> 重载变更</strong>。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo sysctl --system</span><br></pre></td></tr></table></figure><p>您可以使用以下 <em>sysctl</em> 命令<strong>验证配置是否生效</strong>,如下:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo sysctl net.core.default_qdisc</span><br></pre></td></tr></table></figure><ul><li>若输出结果为 <code>net.core.default_qdisc = fq</code>,则配置已生效</li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo sysctl net.ipv4.tcp_congestion_control</span><br></pre></td></tr></table></figure><ul><li>若输出结果为 <code>net.ipv4.tcp_congestion_control = bbr</code>,则配置已生效</li></ul><h2 id="客户端配置(懒人方法)"><a href="#客户端配置(懒人方法)" class="headerlink" title="客户端配置(懒人方法)"></a>客户端配置(懒人方法)</h2><details cyan><summary> 关于客户端配置的说明 </summary> <div class='content'> <p>关于客户端配置文件的编写,可以先用 <strong>v2rayN 生成 <code>vmess://</code> 链接</strong>,之后<strong>再通过 <a href="https://sub-web.netlify.app/">Subscription Converter</a> 进行转换</strong>即可🤣。</p><ol><li>前往 <a href="https://github.com/2dust/v2rayN/releases/latest">V2RayN 下载页</a> 找到 <code>v2rayN-Core.zip</code> <strong>下载</strong>,然后<strong>解压</strong>后找到<strong>主程序 <code>v2rayN.exe</code></strong> 双击运行。双击 v2rayN 的<strong>托盘图标</strong>,然后就会弹出<strong>主界面窗口</strong>。</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/37.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/37.png"></a><span></span></div></div><ol start="2"><li>「<strong>服务器</strong>」 -> 「<strong>添加 Vmess 服务器</strong>」,然后请<strong>根据服务端的配置</strong>对内容进行填写。</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/38.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/38.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/39.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/39.png"></a><span></span></div></div><blockquote><ul><li><strong>地址(<code>address</code>)</strong>:可以填写您<strong>注册的域名</strong>(也可以是 Cloudflare 的 CDN IP,关于这个后面会讲)</li><li><strong>端口(<code>port</code>)</strong>:<strong>HTTPS 端口号</strong>,即填写 <code>443</code></li><li><strong>用户 ID</strong>(<code>id</code>):<strong>与 V2Ray 服务端的配置一致</strong>,也就是之前生成的 UUID,即 <code>9dfe7fee-d08f-44f8-ad2d-300d4c9c3a0e</code></li><li><strong>额外 ID(<code>alterId</code>)</strong>:<strong>与 V2Ray 服务端的配置一致</strong>,即 <code>0</code></li><li><strong>加密方式(<code>security</code>)</strong>:<strong>自动</strong>,即 <code>auto</code></li><li><strong>别名(<code>remarks</code>)</strong>:<strong>节点名称</strong>,可自定义,这里我取名为 <code>node</code></li><li><strong>传输协议(<code>network</code>)</strong>:<strong>WebSocket</strong>,即 <code>ws</code></li><li><strong>伪装类型(<code>type</code>)</strong>:<code>none</code></li><li><strong>伪装域名(<code>host</code>)</strong>:填写您<strong>注册的域名</strong>,我的是 <code>ericclose.xyz</code></li><li><strong>路径(<code>path</code>)</strong>:<strong>与 V2Ray 服务端的配置一致</strong>,即 <code>/ray</code></li><li><strong>底层传输安全(<code>tls</code>)</strong>:<code>tls</code></li><li><strong>跳过证书验证(<code>allowInsecure</code>)</strong>:<strong>是否允许不安全连接</strong>(用于客户端)。当<strong>值为 <code>true</code> 时,V2Ray 不会检查远端主机所提供的 TLS 证书的有效性</strong>,所以<strong>为了安全起见我们选择 <code>false</code></strong> 。</li></ul></blockquote><p>填写完成确认即可。</p><ol start="3"><li>如果你想要<strong>直接使用 v2rayN 进行代理上网</strong>的话,只需要<strong>鼠标右键点击 v2rayN 的托盘图标</strong>,<strong>启用 HTTP 代理</strong>,可以是<strong>全局或 PAC(<em>proxy auto-config</em>,代理自动配置) 模式</strong>,取决于你个人需求。</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/40.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/40.png"></a><span></span></div></div><p>此时如果你配置没出问题的话,那么你已经能够科学上网了。</p><ol start="4"><li>如果你想<strong>使用其他客户端,如 clash,Quantumult X 等</strong>。那么你需要在 v2rayN 主界面选中节点 <code>node</code>,点击「<strong>分享</strong>」,即可<strong>生成 <code>vmess://</code> 链接</strong>。访问 <a href="https://sub-web.netlify.app/">Subscription Converter</a> 网站,选择「<strong>基础模式</strong>」,<strong>复制生成的 <code>vmess://</code> 链接到指定位置</strong>,选择<strong>你想要使用的客户端</strong>,最后「<strong>生成订阅链接</strong>」即可。</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/41.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/41.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/42.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/42.png"></a><span></span></div></div> </div> </details><ul><li>为了支持 VMessAEAD 请将您的客户端更新到最新版本!截至 2022 年 1 月 16 日,各平台客户端均已提供对 VMessAEAD 的支持:<ul><li><a href="https://github.com/Fndroid/clash_for_windows_pkg/releases">Clash for Windows</a> v0.19.5 +</li><li><a href="https://github.com/yichengchen/clashX/releases">ClashX</a> v1.90.0 +</li><li><a href="https://github.com/Kr328/ClashForAndroid/releases">Clash for Android</a> v2.5.4 +</li><li><a href="https://apps.apple.com/us/app/quantumult-x/id1443988620">Quantumult X</a> v1.0.27 +</li></ul></li></ul><blockquote><p>上述 Clash 各客户端版本,Clash 内核均升级至 v1.9.0 +,客户端的配置 <code>ws-opts</code> 处有所变动,请注意修改后使用,详见 <a href="https://github.com/Dreamacro/clash/wiki/configuration#all-configuration-options">Clash Wiki - All Configuration Options</a>。</p><p>Quantumult X v1.0.27 + 默认启用 Vmess AEAD(即 <code>aead=true</code>),配置可以不用修改</p></blockquote><ul><li><em>关于各个客户端的具体使用方法,不属于本文讨论的范畴。</em></li></ul><h2 id="优选-Cloudflare-CDN-节点-IP"><a href="#优选-Cloudflare-CDN-节点-IP" class="headerlink" title="优选 Cloudflare CDN 节点 IP"></a>优选 Cloudflare CDN 节点 IP</h2><p>直接通过本地的 DNS <strong>解析您注册域名</strong>得到的 Cloudflare CDN 的 IP,有时可能速度很不理想,尤其是我使用的<strong>中国电信宽带到了晚上高峰期(20:00 ~ 24:00)的时候特别差劲</strong>。通过一个测试工具 <em>CloudflareSpeedTest</em> 优选出几个 Cloudflare 的 CDN 节点 IP,可以相对缓解这种情况。<strong>由于不同的运营商、不同的地域或不同的时间段,相同的 CDN 节点 IP 表现具有差异,所以建议就是各自在自己的网络环境下进行测试</strong>。</p><details cyan><summary> 优选 Cloudflare CDN 节点 IP 的说明 </summary> <div class='content'> <ul><li><a href="https://github.com/XIU2/CloudflareSpeedTest/releases/latest">CloudflareSpeedTest 项目 latest release 下载页</a></li></ul><ol><li><p>根据您的<strong>操作系统</strong>和<strong>处理器架构</strong>进行选择下载,以我这边 Windows x64 为例子,我下载的是 <code>CloudflareST_windows_amd64.zip</code>,下载后进行解压。</p></li><li><p>首先 <em>cmd</em> 切换到 <code>CloudflareST.exe</code> 所在的目录,如 <code>F:\Downloads\CloudflareST_windows_amd64</code>:</p></li></ol><figure class="highlight bat"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /d F:\Downloads\CloudflareST_windows_amd64</span><br></pre></td></tr></table></figure><ol start="3"><li>此处我以我<strong>平常使用的命令加几个选项</strong>为例子:</li></ol><p>如需要找到 <em>20</em> 个平均延迟低于 <em>300 ms</em> 且下载速度高于 <em>5 MB/s</em> 的 IP 才会停止测速。</p><figure class="highlight bat"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">CloudflareST.exe -tl <span class="number">300</span> -sl <span class="number">5</span> -dn <span class="number">20</span></span><br></pre></td></tr></table></figure><blockquote><ul><li><code>-tl</code>: <strong>平均延迟上限</strong>,只输出低于指定平均延迟的 IP</li><li><code>-sl</code>: <strong>下载速度下限</strong>,输出高于指定下载速度的 IP</li><li><code>-dn</code>: <strong>符合条件的 IP 数量</strong>,即指定输出符合<strong>延迟</strong>和<strong>下载速度</strong>要求的 IP 数量</li><li>完整的使用方法请参考<a href="https://github.com/XIU2/CloudflareSpeedTest/blob/master/README.md">项目 README</a>。</li></ul></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/43.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/43.png"></a><span></span></div></div><p>当我们得到了一组优选 IP 后,如何使用这些 CDN 节点呢?我们只需要在 v2rayN 填写的<strong>地址(<code>address</code>)</strong>处,分别填写<strong>排名靠前的几个 IP 就行</strong>。具体操作:</p><ul><li>v2rayN 主界面<strong>鼠标右键选中原有的节点</strong> <code>node</code>,选择「<strong>克隆所选服务器</strong>」,然后<strong>双击克隆得到的节点</strong>,将<strong>地址(<code>address</code>)</strong>修改为优选得到的 IP,如 <code>104.31.79.91</code>,<strong>别名(<code>remarks</code>)</strong>取自己喜欢的就好,如 <code>node1</code>。</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/44.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/44.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/45.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/45.png"></a><span></span></div></div><p>如想添加多几个节点,就多克隆几个。</p><p>至于<strong>其他客户端的配置转换</strong>依然可以使用 <a href="https://sub-web.netlify.app/">Subscription Converter</a>,将生成得到的数个 <code>vmess://</code> 链接分行粘贴到 <em>Subscription Converter</em> 中,最后再生成订阅链接就完事了。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/46.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/v2ray-tls-websocket-nginx-with-cloudflare/46.png"></a><span></span></div></div><p>P.S. <strong>一条一条的生成 <code>vmess://</code> 链接还是挺麻烦的,所以建议各位学会自己编写你所使用的客户端的配置文件</strong> 🤣</p> </div> </details>]]></content>
<categories>
<category> Proxy </category>
</categories>
<tags>
<tag> V2Ray </tag>
<tag> Cloudflare </tag>
<tag> 科学上网 </tag>
</tags>
</entry>
<entry>
<title>更改 Pixel / Pixel XL 的 modem 以支持中国电信</title>
<link href="/pixel-modem-mod-for-china-telecom.html"/>
<url>/pixel-modem-mod-for-china-telecom.html</url>
<content type="html"><![CDATA[<blockquote><p>❗️ <strong>注意</strong>:本教程仅适用于 Google Pixel (2016) 或 Google Pixel XL (2016),其他更新的机型并不适用。</p></blockquote><p>高通现代的 SoC 理论上应该是支持众多 LTE 的频段,而很多针对中国大陆境外销售的手机可能对境内的运营商网络支持不够友好。Google Pixel 对于中国电信的支持情况就是一个例子,为了使中国电信能够在 Google Pixel 上正常使用,本教程教会告诉你如何通过非硬件层面上的方法(通过修改 modem )来实现这一目的。</p><span id="more"></span><h2 id="基本要求"><a href="#基本要求" class="headerlink" title="基本要求"></a>基本要求</h2><p>为了能够正常完成本次操作,你首先需要确保以下内容:</p><details red open><summary> 配置好 ADB 的环境变量 </summary> <div class='content'> <p>不懂的话就请网上自行搜索“ADB 环境变量”,本文不会讲解这一基本操作(敬请见谅</p> </div> </details><details cyan><summary> 知道如何进入 bootloader 模式 </summary> <div class='content'> <ul><li>bootloader 模式:在设备关机的情况下,长按 <kbd>音量-键</kbd> + <kbd>电源键</kbd> ,进入如下界面即可。</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class="img-wrap"><div class="img-bg"><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/1.png' data-fancybox='default' data-caption='image'><img fancybox itemprop="contentUrl" class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/1.png" alt="image" style="width:250px;"/></a><span></span></div></div></div></div> </div> </details><details yellow><summary> 知道如何进入 recovery 模式 </summary> <div class='content'> <p>①.在设备处于 bootloader 模式的情况下,通过 <kbd>音量+键</kbd> 或 <kbd>音量-键</kbd> 更换菜单选项,直到显示 <strong>Recovery mode</strong> ,然后 按 <kbd>电源键</kbd> 确认;</p><p>②.随后手机会出现 <strong>No command</strong> 的界面;</p><p>③.然后这时长按 <kbd>电源键</kbd> ,3 秒后(电源键依然不要松),按一下 <kbd>音量+键</kbd> (只要按一下就松开音量键),手机就会显示出 recovery 的功能菜单,如下第 3 张图所示。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery stretch" col='3' data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/2.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/2.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/3.jpg' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/3.jpg"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/4.jpg' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/4.jpg"></a><span></span></div></div> </div> </details><details green><summary> 确保已解锁 bootloader </summary> <div class='content'> <p>关于解锁 bootloader 的操作可以看我上篇的文章的一个小节:</p><div class="tag link"><a class="link-card" title="确认是否可以解锁 bootloader" href="https://ericclose.github.io/Pixel-repairs-and-carriers.html#%E7%A1%AE%E8%AE%A4%E6%98%AF%E5%90%A6%E5%8F%AF%E4%BB%A5%E8%A7%A3%E9%94%81-bootloader"><div class="left"><img src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-repairs-and-carriers/unlock-bootloader.jpg"/></div><div class="right"><p class="text">确认是否可以解锁 bootloader</p><p class="url">https://ericclose.github.io/Pixel-repairs-and-carriers.html#%E7%A1%AE%E8%AE%A4%E6%98%AF%E5%90%A6%E5%8F%AF%E4%BB%A5%E8%A7%A3%E9%94%81-bootloader</p></div></a></div><p>如果很不幸你的 Pixel 是 Verizon 版的就只能找某宝奸商付费解锁 bootloader 了。</p> </div> </details><hr><p>❗️ <strong>注意</strong>:如果你不想或没空自己移植 modem,请直接跳过过下面 <strong>移植 modem</strong> 的环节(之后直接按教程刷入移植得到的 <code>modem.img</code> 即可):</p><span class='btn center large'><a class="button" href='https://ericclose.github.io/pixel-modem-mod-for-china-telecom.html#%E4%B8%8B%E8%BD%BD%E7%A7%BB%E6%A4%8D%E5%BE%97%E5%88%B0%E7%9A%84%20modem%20%E9%95%9C%E5%83%8F' title='点击跳过“移植 modem”环节'><i class='fas fa-arrow-down'></i>点击跳过“移植 modem”环节</a></span><h2 id="移植-modem"><a href="#移植-modem" class="headerlink" title="移植 modem"></a>移植 modem</h2><blockquote><p>❗️ <strong>注意</strong>:由于 Google Pixel 和 Google Pixel XL 使用的是相同的 modem(通过二者 <code>modem.img</code> 的 sha256sum 值相同得出的结论),所以通过修改得到的 modem 文件是通用的。</p></blockquote><h3 id="刷入最新的-factory-image"><a href="#刷入最新的-factory-image" class="headerlink" title="刷入最新的 factory image"></a>刷入最新的 factory image</h3><p>本教程是基于 Pixel 的最后一个系统版本修改 modem,所以请确保你的 Pixel 系统已是最新。<strong>factory image</strong>,即工厂镜像,通俗来说也就是所谓的“线刷包”。请根据你所持有的设备下载相应的工厂镜像:</p><overflow><table><thead><tr><th align="center">设备</th><th align="center">工厂镜像下载链接</th></tr></thead><tbody><tr><td align="center">Pixel</td><td align="center"><a href="https://dl.google.com/dl/android/aosp/sailfish-qp1a.191005.007.a3-factory-d4552659.zip">sailfish-qp1a.191005.007.a3-factory-d4552659.zip</a></td></tr><tr><td align="center">Pixel XL</td><td align="center"><a href="https://dl.google.com/dl/android/aosp/marlin-qp1a.191005.007.a3-factory-bef66533.zip">marlin-qp1a.191005.007.a3-factory-bef66533.zip</a></td></tr></tbody></table></overflow><ol><li>将手机重启到 bootloader 模式</li><li>解压下载好的工厂镜像</li><li>找到 <code>flash-all.bat</code> 文件,双击即可</li><li>完成后手机会自动重启</li></ol><h3 id="备份-Pixel-Pixel-XL-的-modem"><a href="#备份-Pixel-Pixel-XL-的-modem" class="headerlink" title="备份 Pixel / Pixel XL 的 modem"></a>备份 Pixel / Pixel XL 的 modem</h3><p>由于 Pixel /Pixel XL 的 Android 10 工厂镜像没有提供单独的 <code>modem.img</code> ,所以我们需要通过 TWRP(第三方 recovery)执行 <code>dd</code> 命令来实现对 modem 的备份。</p><overflow><table><thead><tr><th align="center">设备</th><th align="center">TWRP 下载链接</th></tr></thead><tbody><tr><td align="center">Pixel</td><td align="center"><a href="https://eu.dl.twrp.me/sailfish/twrp-3.4.0-0-sailfish.img">twrp-3.4.0-0-sailfish.img</a></td></tr><tr><td align="center">Pixel XL</td><td align="center"><a href="https://eu.dl.twrp.me/marlin/twrp-3.4.0-0-marlin.img">twrp-3.4.0-0-marlin.img</a></td></tr></tbody></table></overflow><ol><li>首先根据你所持有的设备下载好相应的 TWRP</li><li>将手机重启到 bootloader 模式</li><li>启动到 TWRP,即执行命令:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fastboot boot *.img</span><br></pre></td></tr></table></figure><blockquote><p>命令里的 <code>*.img</code> 不需要手动输入,直接拖拽文件到 cmd 窗口即可,系统会自动填写文件相应的路径。如图:</p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/5.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/5.png"></a><span></span></div></div><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/6.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/6.png"></a><span></span></div></div><ol start="4"><li>最后,备份 modem</li></ol><p>执行命令如下:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">adb shell</span><br><span class="line"><span class="built_in">dd</span> <span class="keyword">if</span>=/dev/block/bootdevice/by-name/modem_a of=/sdcard/stock.img</span><br><span class="line"><span class="built_in">exit</span></span><br><span class="line">adb pull /sdcard/stock.img F:\Downloads</span><br></pre></td></tr></table></figure><blockquote><p>命令里的 <code>F:\Downloads</code> 是备份的 modem (即 <code>stock.img</code> )存储在电脑上的路径,你可以自行修改,看图:</p></blockquote><p><img src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/7.png"></p><h3 id="获取-OnePlus-3T-的-modem"><a href="#获取-OnePlus-3T-的-modem" class="headerlink" title="获取 OnePlus 3T 的 modem"></a>获取 OnePlus 3T 的 modem</h3><p>更改基带文件的总体思路是:提取相同型号处理器的设备的基带文件(这里使用的是 OnePlus 3T)。为了得到 OnePlus 的 modem,所以我们需要 OnePlus 的工厂镜像来提取 modem。</p><overflow><table><thead><tr><th align="center">设备</th><th align="center">工厂镜像下载链接</th></tr></thead><tbody><tr><td align="center">OnePlus 3T</td><td align="center"><a href="https://download.h2os.com/OnePlus%203T/MP/OnePlus3THydrogen_28_OTA_083_all_2002201900_bf0fc8385b5547c0.zip">OnePlus3THydrogen_28_OTA_083_all_2002201900_bf0fc8385b5547c0.zip</a></td></tr></tbody></table></overflow><ol><li>首先下载 OnePlus 3T 的工厂镜像</li><li>从工厂镜像压缩包找到 <code>/firmware-update/NON-HLOS.bin</code> ,提取出来即可</li></ol><h3 id="移植-modem-1"><a href="#移植-modem-1" class="headerlink" title="移植 modem"></a>移植 modem</h3><p>经过前期的准备工作,我们得到了</p><ul><li>Pixel / Pixel XL 的 modem 镜像 <code>stock.img</code></li><li>OnePlus 3T 的 modem 镜像 <code>NON-HLOS.bin</code></li></ul><overflow><table><thead><tr><th align="center">文件名</th><th align="center">下载链接</th></tr></thead><tbody><tr><td align="center"><code>stock.img</code></td><td align="center"><a href="https://github.com/ericclose/pixel-modem-mod-for-china-telecom/raw/master/stock.img">链接</a></td></tr><tr><td align="center"><code>NON-HLOS.bin</code></td><td align="center"><a href="https://github.com/ericclose/pixel-modem-mod-for-china-telecom/raw/master/NON-HLOS.bin">链接</a></td></tr></tbody></table></overflow><p>通过挂载 modem 镜像,我们可以对镜像里的文件进行修改,为了接下来的操作,我们这里需要用到搭载 <strong>Linux 系统</strong> 的电脑或虚拟机。<strong>以下命令均在 Linux 上运行</strong>:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 1. 创建挂载点(stock 用于挂载 Pixel 的原始 modem 镜像,oneplus 用于挂载 OnePlus 的 modem 镜像)</span></span><br><span class="line"><span class="built_in">mkdir</span> stock oneplus</span><br><span class="line"><span class="comment"># 2. 分别挂载 Pixel 和 OnePlus 的镜像,挂载到相应挂载点上</span></span><br><span class="line">sudo mount -o loop stock.img stock && sudo mount -o loop NON-HLOS.bin oneplus</span><br><span class="line"><span class="comment"># 3. 创建目录</span></span><br><span class="line">sudo <span class="built_in">mkdir</span> stock/modem_pr/mcfg/configs/mcfg_sw/generic/china</span><br><span class="line"><span class="comment"># 4. 复制文件</span></span><br><span class="line">sudo <span class="built_in">cp</span> -r oneplus/image/modem_pr/mcfg/configs/mcfg_sw/generic/china/ct stock/modem_pr/mcfg/configs/mcfg_sw/generic/china/</span><br><span class="line"><span class="comment"># 5. ❗️ 注意:使用 vim (或其他编辑器)编辑文件,将文件中的数字加 1</span></span><br><span class="line">sudo vim stock/modem_pr/verinfo/ver_info.txt </span><br><span class="line"><span class="comment"># 6. 同步</span></span><br><span class="line">sudo <span class="built_in">sync</span></span><br><span class="line"><span class="comment"># 7. 从各自的挂载点卸载</span></span><br><span class="line">sudo umount stock oneplus</span><br><span class="line"><span class="comment"># 8. 重命名 stock.img 为 modem.img </span></span><br><span class="line"><span class="built_in">mv</span> stock.img modem.img</span><br></pre></td></tr></table></figure><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/8.png' data-fancybox='default' data-caption='数字加 1'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/8.png" alt="数字加 1"></a><span class='image-caption'>数字加 1</span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/9.png' data-fancybox='default' data-caption='输入的命令'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/9.png" alt="输入的命令"></a><span class='image-caption'>输入的命令</span></div></div><p>完成上述命令后我们就移植得到了 <code>modem.img</code> 啦。</p><h2 id="下载移植得到的-modem-镜像"><a href="#下载移植得到的-modem-镜像" class="headerlink" title="下载移植得到的 modem 镜像"></a>下载移植得到的 modem 镜像</h2><p>你可以使用自己移植得到的 modem 镜像( <code>modem.img</code> ),或者是下载本文提供的镜像:</p><overflow><table><thead><tr><th align="center">文件名</th><th align="center">下载链接</th></tr></thead><tbody><tr><td align="center"><code>modem.img</code></td><td align="center"><a href="https://github.com/ericclose/pixel-modem-mod-for-china-telecom/raw/master/modem.img">链接</a></td></tr></tbody></table></overflow><h2 id="刷入-modem"><a href="#刷入-modem" class="headerlink" title="刷入 modem"></a>刷入 modem</h2><p>手机进入 bootloader 模式,刷入 modem 镜像( <code>modem.img</code> ),cmd 执行这行命令即可:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fastboot --slot all flash modem *.img</span><br></pre></td></tr></table></figure><blockquote><p>命令里的 <code>*.img</code> 不需要手动输入,直接拖拽文件到 cmd 窗口即可,系统会自动填写文件相应的路径。如图:</p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/10.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/10.png"></a><span></span></div></div><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/11.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-modem-mod-for-china-telecom/11.png"></a><span></span></div></div><blockquote><p>❗️ <strong>注意</strong>:刷入 modem 后必须恢复出厂设置,之后重启即可,执行以下命令:</p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">fastboot erase userdata</span><br><span class="line">fastboot erase frp</span><br><span class="line">fastboot reboot</span><br></pre></td></tr></table></figure><h2 id="网络去叉"><a href="#网络去叉" class="headerlink" title="网络去叉"></a>网络去叉</h2><p>状态栏的网络信号有个叉,这是为什么呢,又该如何解决?详情请参见:</p><span class='btn center large'><a class="button" href='https://ericclose.github.io/captive-portal-android.html' title='(类)原生 Android 网络去叉/叹号 Android 5.0 - 10.0'><i class='fas fa-wifi'></i>(类)原生 Android 网络去叉/叹号 Android 5.0 - 10.0</a></span>]]></content>
<categories>
<category> Android </category>
</categories>
<tags>
<tag> Google </tag>
<tag> sailfish </tag>
<tag> marlin </tag>
<tag> Pixel </tag>
<tag> Pixel XL </tag>
<tag> modem </tag>
<tag> 移植 </tag>
</tags>
</entry>
<entry>
<title>查询 Google Pixel 保修信息以及判断是否为 Verizon (运营商) 版</title>
<link href="/Pixel-repairs-and-carriers.html"/>
<url>/Pixel-repairs-and-carriers.html</url>
<content type="html"><![CDATA[<p>如果你想了解关于运营商版和无锁版 Pixel 的不同点,你可以展开下列内容看看:</p><details cyan><summary> 运营商版 Pixel 的相关资料 </summary> <div class='content'> <hr><blockquote><ul><li><p>根据你购买手机的区域,你可能需要解锁你的 Google Pixel 来切换运营商网络。所有<strong>通过 Google Store 购买</strong>的 Pixel 都会自动解锁,所以你不必考虑解锁运营商网络的问题——你可以自由地使用任一运营商。</p></li><li><p>对于那些通过特定运营商或其他零售商购买 Pixel 的人,SIM 卡最长可能被锁定 2 年。在这种情况下,除非销售商解锁 SIM 卡或合约到期,否则手机只能使用该服务提供商提供的移动服务。</p></li><li><p>如果您想在销售合约到期前解锁手机的 SIM 卡,请与您的移动服务提供商联系,以商讨可行的方案。</p></li><li><p>“开发者选项”中的“OEM 解锁”选项,无法在 Verizon 版的 Pixel 机型上启用。 Verizon 版 Pixel 的 bootloader 经过加密无法解锁。</p></li></ul><p><strong>资料来源</strong>:</p><ul><li><ol><li><a href="https://support.google.com/pixelphone/answer/7107188?hl=zh-Hans">搭配任意移动网络使用 Pixel 手机</a></li></ol></li><li><ol start="2"><li><a href="https://www.businessinsider.com/guides/tech/how-to-unlock-google-pixel">How to unlock a Google Pixel phone, so you can switch carrier networks</a></li></ol></li></ul></blockquote> </div> </details><span id="more"></span><h2 id="保修信息查询"><a href="#保修信息查询" class="headerlink" title="保修信息查询"></a>保修信息查询</h2><div class="btns circle center grid3"> <a href='https://store.google.com/us/repair'> <i class='fab fa-google'></i> <b>Google 保修信息查询</b> <p class='p red'>美国</p> <img src='https://cdn.jsdelivr.net/gh/ericclose/images/pixel-repairs-and-carriers/0.png'></a> </div><ol><li><p>点击上面的网站链接,会让你登录谷歌账号,随后跳转到美国地区的查询链接 <code>https://store.google.com/us/repair</code> 。如果你的 Pixel 是其他地区购买的, 你可能需要把链接里的 <code>us</code> 改成购买所在地的区域代码才能查询到信息,如 <code>https://store.google.com/gb/repair</code> (gb, Great Britain 的简写,为英国的区域代码)。</p></li><li><p>用手机拨号器拨打 <code>*#06#</code> ,可以看到手机的 IMEI 和序列号。IMEI 处的内容为 <code>*************** / **</code>,我们这里取 <code>/</code> 前面的内容(也就是前 15 位),输入到网站里即可获知 Pixel 的<strong>容量大小</strong>,<strong>机身颜色</strong>和<strong>保修截止日期</strong>等。有部分人可以查到 Unlocked(无运营商锁),Verizon(Verizon 运营商版),或者是 Refurbished(官翻机)之类的字样,而我这里却什么都查不到🤣。</p></li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/pixel-repairs-and-carriers/1.png' data-fancybox='default' data-caption='Pixel 保修信息查询结果'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-repairs-and-carriers/1.png" alt="Pixel 保修信息查询结果"></a><span class='image-caption'>Pixel 保修信息查询结果</span></div></div><h2 id="确认是否可以解锁-bootloader"><a href="#确认是否可以解锁-bootloader" class="headerlink" title="确认是否可以解锁 bootloader"></a>确认是否可以解锁 bootloader</h2><ol><li><p>前往「<strong>Settings</strong>(设置) -> <strong>About phone</strong>(关于手机) -> <strong>Build number</strong>(版本号)」,连续点击版本号 7 次即可开启「<strong>开发者选项</strong>」。</p></li><li><p>确保手机能够正常访问国际互联网(如路由器翻墙,或手机开代理软件等)</p></li><li><p>前往「<strong>Settings</strong>(设置) -> <strong>System</strong>(系统) -> <strong>Adavanced</strong>(高级) -> <strong>Developer options</strong>(开发者选项)」,<strong>开启</strong>「<strong>OEM unlocking</strong>」选项。如若选项显示为灰色,且为不可开启的状态,则很可能是 Verizon 版(带运营商锁的版本),我手中的这台 Pixel 就是这样😂。</p></li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-repairs-and-carriers/2.png" alt="无法开启的 OEM unlocking 选项"/></div><span class="image-caption">无法开启的 OEM unlocking 选项</span></div><ol start="4"><li>开启「<strong>OEM unlocking</strong>」选项后,手机进入 bootloader 模式(<strong>手机在重启或开机的过程中,长按音量下键即可进入 bootloader 模式</strong>),可以看到 Product/Variant: sailfish-US-PVT 。US 指的是美国,PVT 则是指 <strong>产品验证测试阶段</strong> (production validation test),这么来说也算是正常的销售商品;如若是 EVT 的话则是指 <strong>工程验证测试阶段</strong> (engineering validation test),那么这种手机也就是俗称上的工程机了。</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class="img-wrap"><div class="img-bg"><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/pixel-repairs-and-carriers/3.png' data-fancybox='default' data-caption='image'><img fancybox itemprop="contentUrl" class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-repairs-and-carriers/3.png" alt="image" style="height:512px;"/></a><span></span></div></div></div></div><ol start="5"><li>为了完成下面的操作,请确保满足以下条件:</li></ol><div class='checkbox checked'><input type="checkbox" checked="checked"/> <p>了解什么是 cmd</p> </div><div class='checkbox checked'><input type="checkbox" checked="checked"/> <p>你的电脑已经配置好 ADB 工具的环境变量(不懂的话就请网上自行搜索“ADB 环境变量”)</p> </div><div class='checkbox checked'><input type="checkbox" checked="checked"/> <p>手机已通过数据线连接上电脑</p> </div><ol start="6"><li>完成上述步骤后,手机在 bootloader 模式尝试解锁 bootloader 的命令,电脑打开 cmd 执行:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fasboot flashing unlock</span><br></pre></td></tr></table></figure><ol start="7"><li>如果你前面正常启用「<strong>OEM unlocking</strong>」选项的话,这时手机应该就会询问你是否解锁 bootloader。由于安全设计,<strong>如果你确认解锁 bootloader 手机将会删除所有的数据(即恢复出厂设置)</strong>,取消则不会解锁 bootloader。(而我这边输入命令后,直接报错 <code>FAILED (remote: Flashing Unlock is not allowed)</code> ,也就根本不会询问是否解锁 bootloader。这也是正常的,因为我前面根本无法开启 OEM unlocking 的选项🥺。经过上面的操作,我基本可以确认我这台 Pixel 就是 Verizon 版的了…)</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-repairs-and-carriers/unlock-bootloader.jpg" alt="询问是否解锁 bootloader(图片来自互联网)"/></div><span class="image-caption">询问是否解锁 bootloader(图片来自互联网)</span></div><h2 id="更简单的方法确认是不是-Verizon-版"><a href="#更简单的方法确认是不是-Verizon-版" class="headerlink" title="更简单的方法确认是不是 Verizon 版"></a>更简单的方法确认是不是 Verizon 版</h2><p>最后我查阅资料发现有个简单的方法确认 Pixel 是不是 Verizon 版本的,只需要这么做:</p><ol><li><p>前往「<strong>Settings</strong>(设置) -> <strong>System</strong>(系统) -> <strong>Adavanced</strong>(高级) -> <strong>Developer options</strong>(开发者选项)」,开启「<strong>USB Debuging</strong>(USB 调试)」的选项。</p></li><li><p>然后 cmd 执行:</p></li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">adb start-server</span><br></pre></td></tr></table></figure><ol start="3"><li>期间手机会弹框问询是否允许此电脑对其进行调试,勾选「<strong>Always allow from this computer</strong>(总是允许此电脑调试)」 ,然后点击 <strong>Allow</strong> 即可。</li></ol><p><img src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-repairs-and-carriers/4.png" alt="询问是否允许调试"></p><ol start="4"><li>最后 cmd 执行命令:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">adb shell getprop ro.boot.cid</span><br></pre></td></tr></table></figure><ol start="5"><li>如果返回的值为 <code>VZW__001</code> ,那么很抱歉这个 Pixel 是 Verizon 版的;无运营商锁的版本的返回值应为 <code>11111111</code>。唉,不说了,我这台就是😂。</li></ol><p><img src="https://cdn.jsdelivr.net/gh/ericclose/images/pixel-repairs-and-carriers/5.png" alt="接受命运的折磨吧~"></p><p><strong>后续</strong>:最后我要说的是,尽管不能通过正常渠道解锁 Verizon 版 Pixel 的 bootloader。但是 Pixel 1 还是有办法解锁的(即使是 Pixel 1 最后更新的系统版本 —— 2019 年 12 月),我去了某宝找奸商花费了 50 RMB 成功解锁(为了避免广告嫌疑这里就不说店名了,可以搜索关键词:<em>Pixel bl 锁</em></p>]]></content>
<categories>
<category> Android </category>
</categories>
<tags>
<tag> Google </tag>
<tag> pixel </tag>
<tag> sailfish </tag>
<tag> marlin </tag>
</tags>
</entry>
<entry>
<title>教您如何通过 Google 开机向导</title>
<link href="/google-setup-wizard.html"/>
<url>/google-setup-wizard.html</url>
<content type="html"><![CDATA[<p>当你在没有退出 Google 帐号就刷机的情况下,只是通过 TWRP 直接格式化手机或者是刷了 OpenGapps 后可能会遇到无法跳过开机向导的情况。具体来说,也就是触发了 Android 的 FRP(Factory Reset Protection)机制,详情如下:</p><span id="more"></span><blockquote><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/google-setup-wizard/1.jpg" alt="需要验证 Google 账户" style="width:500px;"/></div><span class="image-caption">需要验证 Google 账户</span></div><p>Android 原生的 FRP 机制,是从 Android 5.1 开始引入的。为了实现这个功能,手机有一个单独的分区,config 或 frp 来存放重置保护状态的相关信息。如果此分区里被标记为非正常重置且存放了特定加密存储后的 Google 账户信息,手机在非正常重置之后开机,会无法跳过 Wi-Fi 连接。连接到能访问到 Google 服务的热点之后,手机会强制搜索系统更新,并要求用户登录重置前使用的 Google 账户来验证用户的所有权。——引用自<a href="https://bbs.letitfly.me/d/856">重置保护 / 谷歌锁 Factory Reset Protection 的解除方法 - LetITFly BBS</a></p></blockquote><p>由于在中国大陆的网络环境下,Google 的服务器是无法正常联通的,所以就会出现难以通过 Google 开机向导的情况,下面我会介绍 3 种方法来教您如何解决这一困境。</p><h2 id="解决方法"><a href="#解决方法" class="headerlink" title="解决方法"></a>解决方法</h2><p><strong>解决方法如下,任选其中一种即可。</strong></p><h3 id="1-点按四角法"><a href="#1-点按四角法" class="headerlink" title="1. 点按四角法"></a>1. 点按四角法</h3><p>这个方法最简单,缺点是仅仅适用于通过刷入 OpenGapps 后开机遇到开机向导过不去的情况,你只要<strong>从左上角沿边缘顺时针点按图中所示的区域</strong>,即可直接跳过烦人的验证。注意不要误触到其他区域。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/google-setup-wizard/2.png" alt="按数字顺序点击图中标记的地方即可" style="width:250px;"/></div><span class="image-caption">按数字顺序点击图中标记的地方即可</span></div><hr><h3 id="2-局域网代理法"><a href="#2-局域网代理法" class="headerlink" title="2. 局域网代理法"></a>2. 局域网代理法</h3><p>这个操作稍显复杂,但通过局域网代理的方法我们可以在手机端没办法使用代理 app 翻墙的情况下,登录 Google 账户来完成向导配置,我个人会更偏好这种做法。</p><h4 id="电脑端的操作"><a href="#电脑端的操作" class="headerlink" title="电脑端的操作"></a>电脑端的操作</h4><hr><p>整体流程如下:</p><div class='checkbox checked'><input type="checkbox" checked="checked"/> <p>电脑启用代理软件</p> </div><div class='checkbox checked'><input type="checkbox" checked="checked"/> <p>允许来自局域网的连接</p> </div><div class='checkbox checked'><input type="checkbox" checked="checked"/> <p>记住<strong>本地 HTTP 代理端口</strong></p> </div><div class='checkbox checked'><input type="checkbox" checked="checked"/> <p>获取电脑的<strong>局域网(LAN)IP</strong></p> </div><hr><p>首先,我们需要在<strong>同一局域网下</strong>的电脑里启用代理软件,这里以 Clash for Windows 为例。</p><p><img src="https://cdn.jsdelivr.net/gh/ericclose/images/google-setup-wizard/3.png"></p><p>启用代理软件后,如上图的标记,打开<strong>允许来自局域网的连接</strong>的选项,并记住代理软件的<strong>本地 HTTP 代理端口</strong>,等下会用到。</p><blockquote><p><strong>注意</strong>:即便是你使用的是不同的代理软件,如 SS / SSR / V2Ray 之类的,应该都是有<strong>允许来自局域网的连接</strong>的这个功能选项,你自己找找看,同时注意下你代理软件的<strong>本地 HTTP 代理端口</strong>(应该是和我的有所不同)。</p></blockquote><p>然后你需要记住你电脑的<strong>局域网(LAN)IP</strong>,可以通过命令获取。<strong>Windows 用户</strong>在 cmd 执行 <code>ipconfig</code> ,而 <strong>Linux / macOS 用户</strong>在 terminal 执行 <code>ifconfig</code> 即可。</p><p>完成上述流程后,就轮到手机端的操作了。</p><h4 id="手机端的操作"><a href="#手机端的操作" class="headerlink" title="手机端的操作"></a>手机端的操作</h4><hr><p>手机连接 Wi-Fi 填写完密码后,不要着急着连接。</p><p>展开「<strong>Advanced options</strong> 高级选项」->「<strong>Proxy</strong> 代理」-> 选择「<strong>Manual</strong> 手动」-> 在「<strong>Proxy hostname</strong> 代理主机名」填写你电脑的<strong>局域网(LAN)IP</strong> ->「<strong>Proxy port</strong> 代理端口」填写你所使用的代理软件的<strong>本地 HTTP 代理端口</strong> -> 最后「<strong>Connect</strong> 连接」Wi-Fi。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/google-setup-wizard/4.png" alt="手机端的配置" style="width:200px;"/></div><span class="image-caption">手机端的配置</span></div><p>之后,你的手机就能通过连接局域网代理直接科学上网登录 Google 账户了,接下来应该不用我多说了。</p><hr><h3 id="3-覆写分区法"><a href="#3-覆写分区法" class="headerlink" title="3. 覆写分区法"></a>3. 覆写分区法</h3><p>前面我们提到过 Google 账户信息是存放在 config 或 frp 分区上的,由于此分区不存在文件系统,所以我们的做法是往这个分区里填零,也就是覆写分区。</p><p>具体来说,我们需要知道当前设备的账户信息是存放在哪个分区。我们可以让手机<strong>进入 TWRP</strong> 之后,通过 USB 与电脑连接,然后在电脑终端上执行下列命令(<strong>请提前配置好 adb</strong>)获知手机的分区信息:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">adb shell</span><br><span class="line"><span class="built_in">ls</span> -l /dev/block/bootdevice/by-name</span><br></pre></td></tr></table></figure><p>输出的结果比较长,注意找找输出的其中一行里是 frp 还是 config,以我的小米 6 为例,其中一行是:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">......</span><br><span class="line">lrwxrwxrwx 1 root root 15 1970-07-17 07:27 frp -> /dev/block/sda7</span><br><span class="line">......</span><br></pre></td></tr></table></figure><p>由此可知我的手机是将 Google 账户信息存放在 <strong>frp</strong> 上的,所以覆写 frp 分区的命令是:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">dd</span> <span class="keyword">if</span>=/dev/zero of=/dev/block/bootdevice/by-name/frp</span><br></pre></td></tr></table></figure><p>如果你的手机是存放在 <strong>config</strong> 上,那么把上面一行的覆写命令里的 <strong>frp</strong> 改为 <strong>config</strong> 就行了。</p><p>可能有无法写入的特殊情况,如果遇到的话(<strong>没遇到就不用管</strong>)可以在覆写命令加上参数,最终命令如下:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">dd</span> <span class="keyword">if</span>=/dev/zero of=/dev/block/bootdevice/by-name/frp bs=512 count=1024</span><br></pre></td></tr></table></figure><hr><p>照理来说,上述 3 种方法都能奏效,<strong>根据你的实际情况</strong>选择就行,操作完成之后应该就能通过 Google 开机向导啦。</p>]]></content>
<categories>
<category> Android </category>
</categories>
<tags>
<tag> Google </tag>
<tag> FRP </tag>
<tag> 账户锁 </tag>
</tags>
</entry>
<entry>
<title>2020年 小米6 刷机 LineageOS 17.1 Official</title>
<link href="/install-lineageos-on-sagit.html"/>
<url>/install-lineageos-on-sagit.html</url>
<content type="html"><![CDATA[<div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/cover.png" alt="image"/></div></div><p>时至今日,依然有很多小米 6 的用户因为各种原因没有换手机,不得不说那些钉子户们也引起了雷军的注意,下面是雷军让钉子户们投票是想要继续使用小米 6 还是换新款的小米 10,又或者换其他手机。结果雷军的脸再次被钉子户们<del>啪啪啪</del>…</p><span id="more"></span><p><a href="https://www.weibo.com/1749127163/IwtxMgTnQ?type=comment"><img src="https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/1.png" alt="图1"></a></p><p>再之后,小米推出 49 元换电池活动,49 元包含电池 + 人工费,不会收取其他费用。支持 15 款机型,包括小米 9 系列、MIX 2/S/3 等~</p><p>网友:为啥没有小米 6… </p><p>然后雷军发话了:小米 6 钉子户们,你们开心吗?49 元换电池,希望大家能继续坚持 3 年!🐶</p><p><a href="https://weibo.com/1749127163/Iz1SjigNI?type=comment"><img src="https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/2.png" alt="图2"></a></p><p>我本人来说不屑使用 MIUI,所以早早就刷上了我永远喜欢的 LineageOS,的确是美滋滋啊。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/3.png" alt="image" style="width:300px;"/></div></div><p>好了,不多说了,老司机带你们走一下刷机流程吧。</p><hr><h2 id="基本要求"><a href="#基本要求" class="headerlink" title="基本要求"></a>基本要求</h2><blockquote><p>重要提示:在实际操作之前,请至少完整阅读一次说明,以避免因为错过任何东西而导致出现问题!</p></blockquote><blockquote><p>确保你的电脑已经配置好 <strong>adb</strong> 和 <strong>fastboot</strong> 的环境变量,详情见<a href="https://wiki.lineageos.org/adb_fastboot_guide">这里</a>。</p></blockquote><hr><h2 id="解锁-bootloader"><a href="#解锁-bootloader" class="headerlink" title="解锁 bootloader"></a>解锁 bootloader</h2><blockquote><p>注意:以下步骤仅需要执行一次。</p></blockquote><blockquote><p>警告:解锁 bootloader 将清除设备上的所有数据!在继续之前,请确保您要保留的数据已备份到您的 PC 或您的 Google 帐户或其他位置。</p></blockquote><hr><ol><li>下载<strong>小米官方解锁工具</strong>。</li></ol><blockquote><p>访问<a href="https://www.miui.com/unlock/index_en.html">小米官方解锁网站</a>,登录小米账号申请解锁权限,下载<strong>官方解锁工具</strong>。</p></blockquote><hr><ol start="2"><li>开启开发者选项</li></ol><blockquote><p>「<strong>设置</strong>」->「<strong>全部参数</strong>」-> 连续点击「<strong>MIUI 版本</strong>」(直至开启开发者选项即可)</p></blockquote><hr><ol start="3"><li>设备绑定小米账号</li></ol><blockquote><p>「<strong>设置</strong>」->「<strong>更多设置</strong>」->「<strong>开发者选项</strong>」->「<strong>设备解锁状态</strong>」(登录小米账号)</p></blockquote><hr><ol start="4"><li>开启 <strong>USB 调试</strong></li></ol><blockquote><p>「<strong>设置</strong>」->「<strong>更多设置</strong>」->「<strong>开发者选项</strong>」->「<strong>USB 调试</strong>」(开启即可)。</p></blockquote><hr><ol start="5"><li>开启 <strong>OEM 解锁</strong></li></ol><blockquote><p>「<strong>设置</strong>」->「<strong>更多设置</strong>」->「<strong>开发者选项</strong>」->「<strong>OEM 解锁</strong>」(开启即可)。</p></blockquote><hr><ol start="6"><li>手机重启至 fastboot 模式</li></ol><blockquote><p>通过 USB 将设备连接到 PC。,由于前面已配置好 <strong>adb</strong> 和 <strong>fastboot</strong> 的环境变量,所以我们可以直接执行相应的命令。(如果手机有弹框是否允许此电脑调试,点击允许即可)</p></blockquote><blockquote><p>打开 <strong>cmd</strong>(命令提示符),执行下列命令</p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">adb reboot bootloader</span><br></pre></td></tr></table></figure><blockquote><p>执行完命令后就会进入 fastboot 模式(也就是米兔修 Android 机器人的界面)</p></blockquote><hr><ol start="7"><li>解压运行小米官方解锁工具</li></ol><blockquote><p>解压完后,文件夹里找到 <strong>miflash_unlock.exe</strong>,双击运行即可。登录账号依照提示完成解锁即可。</p></blockquote><blockquote><p>什么?解锁 bootloader 还需要绑定小米账号满 72 小时(还得相对活跃地使用),可还行 <del>(雷军:求求你们了,不要解锁!不要解锁!不要解锁!人家小米 6 还是处呢)</del> 🐶保命</p></blockquote><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/4.png" alt="image"/></div></div><hr><ol start="8"><li>真正解锁 bootloader 的时候到了</li></ol><blockquote><p>陪伴了 MIUI 三个日夜,它终于满足了,我是一滴<del>念想</del>也没有了,所以它也便不再挽留我。此时重复<strong>步骤 4</strong> ~ <strong>步骤 7</strong> 即可。</p></blockquote><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/5.png" alt="image"/></div></div><hr><h2 id="刷机操作"><a href="#刷机操作" class="headerlink" title="刷机操作"></a>刷机操作</h2><ol><li>下载 TWRP</li></ol><blockquote><p>前往这个<a href="https://github.com/xiaomi-msm8998/twrp_device_xiaomi_sagit/releases/latest">页面</a>,找到 <code>*.img</code> 文件下载即可。</p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class="img-wrap"><div class="img-bg"><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/6.png' data-fancybox='default' data-caption='image'><img fancybox itemprop="contentUrl" class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/6.png" alt="image" style="width:450px;"/></a><span></span></div></div></div></div><hr><ol start="2"><li>通过 USB 将设备连接到 PC。</li></ol><hr><ol start="3"><li>在电脑上,打开 <strong>cmd</strong>,然后输入:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">adb reboot bootloader</span><br></pre></td></tr></table></figure><hr><ol start="4"><li>刷入 TWRP</li></ol><blockquote><p>在 <strong>cmd</strong> 上输入:</p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fastboot flash recovery *.img</span><br></pre></td></tr></table></figure><blockquote><ul><li>如果你用 Linux 或者 macOS 执行 <em>fastboot</em> 命令提示权限不足,请在 <em>fastboot</em> 之前加上 <em>sudo</em>,即(<code>sudo fastboot flash recovery *.img</code>)</li><li>命令里的 <code>*.img</code> 不需要手动输入,直接拖拽文件到 cmd 窗口即可,系统会自动填写文件相应的路径。如图:</li></ul></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/7.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/7.png"></a><span></span></div></div><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/8.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/8.png"></a><span></span></div></div><hr><ol start="5"><li>重启进入 TWRP</li></ol><blockquote><p>执行命令重启</p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fastboot reboot</span><br></pre></td></tr></table></figure><blockquote><p>执行完命令立马长按 <strong>音量 +</strong> ,直至进入 TWRP 即可。</p></blockquote><hr><ol start="6"><li>格式化 Data</li></ol><blockquote><p>「<strong>TWRP主界面</strong>」->「<strong>Wipe</strong>」->「<strong>Format Data</strong>」(输入 yes,打钩确认格式化 data)</p></blockquote><hr><ol start="7"><li>五清</li></ol><blockquote><p>「<strong>TWRP主界面</strong>」->「<strong>Wipe</strong>」->「<strong>Adavanced Wipe</strong>」-> 勾选「<strong>Dalvik / ART Cache</strong>」、「<strong>Cache</strong>」、「<strong>System</strong>」、「<strong>Data</strong>」、「<strong>Internal Storage</strong>」(<strong>切勿</strong>勾选到「<strong>Vendor</strong>」) -> <strong>划过滑动条确认擦除</strong></p></blockquote><hr><ol start="8"><li>在刷入官方 LineageOS 之前您自 2019 年 8 月 4 日起<strong>必须使用</strong> Android 9.0 MIUI 的 firmware。〖LineageOS 17.1 官方安装说明没有提到 firmware 版本的要求(之前 LineageOS 16 的<a href="https://forum.xda-developers.com/t/official-9-lineageos-16-0-for-mi-6.3938146/#post-79702120">安装说明</a>有提过),所以估计是这个 firmware 或以上版本都可以,我还是用的这个 firmware〗</li></ol><ul><li>firmware 下载地址:<a href="https://osdn.net/projects/xiaomifirmwareupdater/storage/Stable/V10/sagit/">https://osdn.net/projects/xiaomifirmwareupdater/storage/Stable/V10/sagit/</a></li></ul><blockquote><p><strong>刷入 firmware</strong> 过程:「<strong>TWRP主界面</strong>」->「<strong>Advanced</strong>」->「<strong>ADB Sideload</strong>」(划过滑条即可),然后电脑打开 cmd,输入命令:</p></blockquote><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">adb sideload *.zip</span><br></pre></td></tr></table></figure><blockquote><p>命令里的 <code>*.zip</code> 也是和之前刷 TWRP 一样也是不需要手动输入的,直接拖拽文件到 cmd 窗口即可,系统会自动填写文件相应的路径。</p><p>刷完后手机会自动退出 <strong>ADB Sideload</strong></p></blockquote><hr><ol start="9"><li>刷入 LineageOS 官方包</li></ol><blockquote><p>LineageOS for 小米 6 下载地址:<a href="https://download.lineageos.org/sagit">https://download.lineageos.org/sagit</a> 嗯~ o(<em> ̄▽ ̄</em>)o,我们下载最新的就行</p></blockquote><blockquote><p>刷入 LineageOS 过程::「<strong>TWRP 主界面</strong>」->:「<strong>Advanced</strong>」->「<strong>ADB Sideload</strong>」(划过滑条即可),电脑打开 cmd,输入命令:</p></blockquote><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">adb sideload *.zip</span><br></pre></td></tr></table></figure><blockquote><p>命令里的 <code>*.zip</code> 也是和之前刷 TWRP 和 firmware 一样的,也是不需要手动输入的,直接拖拽文件到 cmd 窗口即可,系统会自动填写文件相应的路径。</p></blockquote><hr><ol start="10"><li>刷入 OpenGapps 以获取 Google 全家桶(<strong>可选项</strong>)</li></ol><blockquote><p>OpenGapps 地址: <a href="https://opengapps.org/">https://opengapps.org/</a></p></blockquote><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/9.png" alt="image" style="width:300px;"/></div></div><blockquote><p><strong>选择 ARM64,Android 10.0</strong>,Variant 根据需求进行选择</p></blockquote><ul><li>micro:有限的 Google Apps 如 Gmail,日历,Google Now 以及 Play 商店无法提供的额外功能</li><li>nano:最小化安装,但包括 Play 商店无法提供的额外功能</li><li>pico:获得 Google Play 功能的最低要求</li><li>tvstock:适用于 Android TV 设备的选项(电视的,和手机无关,别选这个)</li></ul><blockquote><p>上述选项的注释均由 <strong>Google 机翻</strong>,本人稍作改动,如有误导敬请谅解。<del>本想推荐 aroma 的,文件虽然是最大的,但毕竟可以随自己心意安装组件。</del></p></blockquote><blockquote><p>❗️ 由于 OpenGapps for Android 10 还存在一些<a href="https://github.com/opengapps/opengapps/wiki/Notes-for-Android-10.x">问题</a>,OpenGapps 在当前稳定版本中只启用了 micro 及其以下版本,只有等 OpenGapps 团队解决了相关问题,才会提供更大的包。所以<strong>现在强烈建议使用 nano 包</strong></p></blockquote><blockquote><p>刷入 OpenGapps 也是和前面一样,都是用 <strong>adb sideload</strong>,这里就不再赘述了。</p></blockquote><hr><ol start="11"><li>在完成上述内容后,开机前建议执行「<strong>Format Data</strong>」,分别擦除「<strong>Dalvik / ART Cache</strong>」、「<strong>Cache</strong>」、「<strong>Data</strong>」的操作(❗️ <strong>不要选错了</strong>)。</li></ol><hr><ol start="12"><li><strong>开机测试。</strong></li></ol><blockquote><p>❗️ 我对于<strong>刷入 Magisk 的建议</strong>是,先看看是不是能正常开机,如果可以再刷 Magisk 还来得及。</p></blockquote><ol start="13"><li>所以现在刷入 Magisk 以获取 root 权限(可选项)</li></ol><blockquote><p>众所周知,如今主流的获取 root 权限的方案就是 Magisk(Magisk 是一款帮助 Android 设备获取 root 权限的开源工具)。</p></blockquote><blockquote><p>这里我介绍下 2 种方法。一种是通过 <strong>Adb Sideload</strong> 刷进去,另一种是通过 <strong>fastboot</strong>。(<strong>推荐使用 Adb Sideload 的方式</strong>,不推荐用 fastboot 方式刷是因为这种方式刷入 Magisk 的话,手机每次重启会卡开机动画,得手动进 TWRP 才能正常重启)</p></blockquote><div class="tabs" id="tab-a"><ul class="nav-tabs"><li class="tab active"><a class="#a-1">adb sideload 方式</a></li><li class="tab"><a class="#a-2">fastboot 方式</a></li></ul><div class="tab-content"><div class="tab-pane active" id="a-1"><p><a href="https://github.com/topjohnwu/Magisk/releases/">点此</a>在页面找到最新的 <code>Magisk-v版本号.zip</code> 下载,以我当前的时间为例,目前最新的 Magisk 版本为 20.4,那么就是下载 <code>Magisk-v20.4.zip</code>。</p><blockquote><p>adb sideload 刷入方式和前面说的没什么不同,这里就不说了。</p></blockquote><p>最后再次开机后发现没有 Magisk Manger(Magisk 的管理 app)的话,<a href="https://github.com/topjohnwu/Magisk/releases/">点此</a>在该页面找到最新的 Magisk Manger 的 apk 安装即可。</p></div><div class="tab-pane" id="a-2"><p>❶ <a href="https://github.com/topjohnwu/Magisk/releases/">点此</a>在该页面找到 Magisk Manger 的 apk 安装即可。</p><p>❷ 电脑上解压 LinegaeOS 的刷机包 <code>*.zip</code>,找到 <code>boot.img</code>,传到手机里。</p><p>❸ 打开 Magisk Manager(Magisk 的管理 app,并不是 Magisk 本体),首页会显示 Magisk 未安装,点击旁边的「<strong>Install 安装</strong>」-> 然后弹框会询问你是否现在安装 Magisk ,你选「<strong>Install 安装</strong>」-> 再然后选「<strong>Select and Patch a File 选择并修补一个文件</strong>」,找到刚传的 <code>boot.img</code>,等 patch 完后会生成 <code>内部存储/Download/magisk_patched.img</code> 文件。最后把这个文件传回电脑,然后执行命令:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">fastboot flash boot *.img</span><br></pre></td></tr></table></figure><blockquote><p>一样的,命令里的 <code>*.img</code> 不需要手动填写,把 <code>magisk_patched.img</code> 拖拽到 cmd 就行。</p></blockquote></div></div></div><hr><blockquote><p>搞定完一切后,刷机操作就完成了。我来展示下成果图吧(我装的 lawnchair 启动器)~</p></blockquote><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install_lineageos_on_sagit/result.png" alt="成果图" style="width:250px;"/></div><span class="image-caption">成果图</span></div><hr><h2 id="常见问题"><a href="#常见问题" class="headerlink" title="常见问题"></a>常见问题</h2><details cyan open><summary> 为什么我刷完机后,想要再进 TWRP 玩玩其他东西,但是需要输入密码,密码是什么? </summary> <div class='content'> <blockquote><p>答:这个密码是您设置的锁屏密码,默认情况下,您的设备是全盘加密的,这是为了安全着想而设计的(但是也不排除遭到他人强迫给出密码解密的可能),只有在正确的输入你的<strong>锁屏密码</strong>才能解密设备。</p></blockquote> </div> </details><details cyan><summary> 刷 OpenGapps 后无法通过开机向导该怎么办? </summary> <div class='content'> <p>当你在没有退出 Google 帐号就刷机的情况下,只是通过 TWRP 直接格式化手机或者是刷了 OpenGapps 后可能会遇到无法跳过开机向导的情况。具体来说,也就是触发了 Android 的 FRP(Factory Reset Protection)机制,具体解决办法可以看看<a href="https://ericclose.github.io/google-setup-wizard.html">这篇文章</a>。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/google-setup-wizard/1.jpg" alt="image"/></div></div> </div> </details><details cyan><summary> (没遇到就不用管)如果遇到数据能上网,但打电话显示 sim 卡无信号或无法连接到移动网络该怎么办? </summary> <div class='content'> <blockquote><p>答:系统默认开启了 VoLTE,但是 VoLTE 是不可用的。(我本人电信卡作为主卡是遇到了的,我也不知道是不是我没有开通 VoLTE 的原因,又或者是电信卡的原因,还是这个官方 LineageOS 本身就不能用 VoLTE。)</p><p>解决方法:「<strong>Settings 设置</strong>」->「<strong>Network and Internet 网络 & 互联网</strong>」->「<strong>Mobile network 移动网络</strong>」里选择出现问题的 sim 卡 ->「<strong>Advanced 高级</strong>」-> 找到「<strong>VoLTE</strong> 增强 4G LTE 模式(使用LTE服务来增强语音和其他通讯)」,把这个选项关了就行了。</p><p>总之整完了这个,我测试了电信打电话,和数据上网也没什么问题了。</p></blockquote> </div> </details><details cyan><summary> 晚上关灯搞手机,手机按键的背光灯常亮看起来要瞎了,怎么把背光灯关掉? </summary> <div class='content'> <blockquote><p>答:<del>最好的做法是睡觉不要玩手机!</del> 好啦,告诉你吧。「<strong>设置</strong>」->「<strong>系统</strong>」->「<strong>按钮</strong>」->「<strong>背光灯</strong>」->「<strong>按键亮度</strong>」调节至 <strong>0%</strong> 就可以啦。</p></blockquote> </div> </details><details cyan><summary> 如何在状态栏里显示电池百分比和实时网速? </summary> <div class='content'> <blockquote><p><strong>答</strong></p><ul><li>关于电池百分比:在「<strong>Settings 设置</strong>」-> 「<strong>System 系统</strong>」->「<strong>Status bar 状态栏</strong>」-> 「<strong>Battery percentage 电池百分比</strong>」,建议选择「<strong>Next to the icon 图标旁边</strong>」。</li><li>关于实时显示网速:在「<strong>Settings 设置</strong>」->「<strong>System 系统</strong>」->「<strong>Status bar 状态栏</strong>」->「<strong>Network traffic monitor 网络流量监视器</strong>」->「<strong>Display mode 显示模式</strong>」,选择「<strong>Upload and Download 上传和下载</strong>」->「<strong>Traffic mesurement units 流量测量单位</strong>」,选择 kB/s(记住得是大写的 B,小写的话就是 1000 比特每秒作为单位)</li></ul></blockquote> </div> </details><details cyan><summary> 哪里可以获取 Google 相机? </summary> <div class='content'> <blockquote><p>答:我用的是俄罗斯的一位老哥 <a href="https://www.celsoazevedo.com/files/android/google-camera/dev-alexey070315/">Alexey070315</a> 搞的 Google 相机。现在最新版本是 2020-04-07 的 <code>MGC_MIX2S_JOKER3.apk</code>,<a href="https://www.celsoazevedo.com/files/android/google-camera/dev-alexey070315/">点此</a>下载安装即可。</p></blockquote> </div> </details><details cyan><summary> 手机连点两下亮屏,哪里可以取消? </summary> <div class='content'> <blockquote><p>答:其实这个是系统默认开启的<strong>双击屏幕的任意位置唤醒设备</strong>的功能。如果你想要关掉的话,你可以去「<strong>Settings 设置</strong>」->「<strong>Display 显示</strong>」->「<strong>Advanced 高级</strong>」->「<strong>Tap to wake 点击唤醒</strong>」选项关掉即可。</p></blockquote> </div> </details><details cyan><summary> 不习惯默认的“任务键在左,返回键在右”,需要在哪里设置反转呢? </summary> <div class='content'> <blockquote><p>答:你可以在「<strong>Settings 设置</strong>」->「<strong>System 系统</strong>」->「<strong>Buttons 按键</strong>」->「<strong>Additional buttons 更多按键</strong>」->「<strong>Swap buttons 交换按键</strong>」开启这个选项即可。</p></blockquote> </div> </details><details cyan><summary> 状态栏的 Wi-Fi 显示不可用或者是受限,这是为什么呢,又该如何解决? </summary> <div class='content'> <blockquote><p>详情请参见:</p></blockquote><p><span class='btn center large'><a class="button" href='https://ericclose.github.io/captive-portal-android.html' title='(类)原生 Android 网络去叉/叹号 Android 5.0 - 10.0'><i class='fas fa-wifi'></i>(类)原生 Android 网络去叉/叹号 Android 5.0 - 10.0</a></span></p> </div> </details><p>本文完结,如有其他疑问可以在评论区留言,在我能力允许的情况下我会对此进行答复~</p>]]></content>
<categories>
<category> Android </category>
</categories>
<tags>
<tag> 小米 </tag>
<tag> sagit </tag>
<tag> LineageOS </tag>
</tags>
</entry>
<entry>
<title>Arch Linux with KDE 配置触控板手势</title>
<link href="/libinput-gestures-on-Arch-Linux-with-KDE.html"/>
<url>/libinput-gestures-on-Arch-Linux-with-KDE.html</url>
<content type="html"><![CDATA[<p>本文教你如何配置触控板的手势,以 Arch Linux 为例,桌面环境为 KDE。</p><ul><li>libinput-gestures: 使用libinput在触摸板上执行动作手势</li></ul><ol><li>将当前用户加入到input组(您必须是input用户组的成员才具有读取触控板设备的权限)</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo gpasswd -a <span class="variable">$USER</span> input</span><br></pre></td></tr></table></figure><span id="more"></span><p><strong>注意,注销用户或重启以生效</strong></p><ol start="2"><li>安装 libinput-gestures</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> https://aur.archlinux.org/libinput-gestures.git</span><br><span class="line"><span class="built_in">cd</span> libinput-gestures</span><br><span class="line">makepkg -si</span><br></pre></td></tr></table></figure><ol start="3"><li>开启相应服务并设为开机自启</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">libinput-gestures-setup autostart</span><br><span class="line">libinput-gestures-setup start</span><br></pre></td></tr></table></figure><ol start="4"><li>编辑配置文件</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cp</span> /etc/libinput-gestures.conf ~/.config/libinput-gestures.conf</span><br><span class="line">vim ~/.config/libinput-gestures.conf</span><br></pre></td></tr></table></figure><p>在文件的末尾追加如下内容</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">gesture swipe down 3xdotool key ctrl+F12 # 三指下滑回到桌面</span><br><span class="line">gesture swipe up 3xdotool key ctrl+F10 # 三指上滑查看窗口</span><br><span class="line">gesture swipe right 4xdotool key meta+Tab # 四指右滑切换窗口</span><br><span class="line">gesture swipe left 4xdotool key meta+Tab # 四指左滑切换窗口</span><br></pre></td></tr></table></figure><ol start="5"><li>然后在 「System Settings <strong>系统设置</strong>」 -> 「Input Devices <strong>输入设备</strong>」 -> 「Touchpad <strong>触控板</strong>」 -> 启用 「Tap-to-click <strong>轻触点击</strong>」 和 「Tap-and-drag <strong>连续轻触2下拖拽</strong>」</li></ol><p><strong>最后,注销用户或重启生效。</strong></p>]]></content>
<categories>
<category> Linux </category>
</categories>
<tags>
<tag> Linux </tag>
<tag> 触控板 </tag>
<tag> KDE </tag>
</tags>
</entry>
<entry>
<title>一文让你了解如何为 Git 设置代理</title>
<link href="/git-proxy-config.html"/>
<url>/git-proxy-config.html</url>
<content type="html"><![CDATA[<p>当您在克隆或从远程仓库获取数据时,很可能因为网络状况不佳遇到很慢甚至超时的情况,那么此时您可能需要配置 Git 的代理。</p><details cyan><summary> Git 支持的传输协议以及判断(点击展开) </summary> <div class='content'> <p>在此之前需要先提一下,Git 支持的传输协议有 ssh、git、http 和 https 协议(此外,ftp 和 ftps 也可用于拉取,但在 <a href="https://git-scm.com/docs/git-clone#_git_urls">Git 官方文档</a>中提到是低效且过时的,不建议使用)。</p><p>其原生传输协议(即 git:// URL)不做鉴权,在不安全的网络环境下应谨慎使用。</p><p>要如何分辨 Git 使用的传输协议呢?可以通过 Git URL 来进行判断:</p><ul><li><p>ssh</p><ul><li><code>ssh://[user@]host.xz[:port]/path/to/repo.git/</code> 或 <code>[user@]host.xz:path/to/repo.git/</code></li></ul></li><li><p>git</p><ul><li><code>git://host.xz[:port]/path/to/repo.git/</code></li></ul></li><li><p>http / https</p><ul><li><code>http[s]://host.xz[:port]/path/to/repo.git/</code></li></ul></li><li><p>ftp / ftps</p><ul><li><code>ftp[s]://host.xz[:port]/path/to/repo.git/</code></li></ul></li></ul> </div> </details><p>连接到 Git 仓库最常用的传输协议可以分为两类:</p><ul><li><strong>HTTP</strong> / <strong>HTTPS</strong> 传输协议</li><li><strong>SSH</strong> 传输协议</li></ul><span id="more"></span><hr><ul><li><strong>使用 HTTP / HTTPS 传输协议</strong>连接到 Git 仓库的 URL 实例如下:</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">http://github.com/cms-sw/cmssw.git</span><br><span class="line">https://github.com/cms-sw/cmssw.git</span><br></pre></td></tr></table></figure><ul><li><strong>使用 SSH 传输协议</strong>连接到 Git 仓库的 URL 实例如下:</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">[email protected]:cms-sw/cmssw.git</span><br><span class="line">ssh://[email protected]/cms-sw/cmssw.git</span><br></pre></td></tr></table></figure><hr><h2 id="预先准备"><a href="#预先准备" class="headerlink" title="预先准备"></a>预先准备</h2><p>在<strong>开始操作之前</strong>,你<strong>需要明确</strong>这些内容:</p><ul><li>电脑已经安装了 Git(这不是废话吗,23333)。如果你是 Windows 用户,那么本文的命令你需要通过 Git Bash 来执行;如果你是 Linux 或 macOS 用户直接在终端运行即可。</li><li>知道如何用 vim 编辑文件,退出编辑的基本操作。</li></ul><hr><h2 id="Git-使用-HTTP-HTTPS-传输协议的代理方法"><a href="#Git-使用-HTTP-HTTPS-传输协议的代理方法" class="headerlink" title="Git 使用 HTTP / HTTPS 传输协议的代理方法"></a>Git 使用 HTTP / HTTPS 传输协议的代理方法</h2><p>针对 Git 使用 HTTP / HTTPS 传输协议的代理方法如下:</p><ul><li><strong>针对所有域名的仓库</strong>:</li></ul><blockquote><p><code>git config --global</code> <strong><code>http</code></strong><code>.proxy <protocol>://<host>:<port></code></p></blockquote><details cyan><summary> 命令注解(点击展开) </summary> <div class='content'> <ul><li><code>--glboal</code> 选项指的是修改 Git 的全局配置文件 <code>~/.gitconfig</code>(而非各个 Git 仓库里的配置文件 <code>.git/config</code>)。</li><li><code><protocol></code> 指的是<strong>代理协议</strong>,如 http,https,socks5 等。</li><li><code><host></code> 为代理主机,如使用本地代理主机 127.0.0.1 或 localhost 等。</li><li><code><port></code> 则为代理端口号,如 clash 使用的 7890 或 7891 等。</li><li><strong>常见误用</strong>:<code>git config --global</code> <strong><code>https</code></strong><code>.proxy <protocol>://<host>:<port></code>,这一写法<strong>完全是错误的</strong>。请记住: Git 代理配置项<strong>正确写法</strong>为 <strong><code>http</code></strong><code>.proxy</code>,并不支持 <strong><code>https</code></strong><code>.proxy</code> 这一<strong>错误写法</strong>。</li><li>如果想了解 <code><url></code> 的更多模式,如子域名等的情况,可参照 <a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-httplturlgt">Git 的官方文档</a> 。</li></ul> </div> </details><ul><li>或者<strong>针对特定域名的仓库</strong>:</li></ul><blockquote><p><code>git config --global</code> <strong><code>http</code></strong><code>.<url>.proxy <protocol>://<host>:<port></code></p></blockquote><details cyan><summary> 命令注解(点击展开) </summary> <div class='content'> <ul><li><code>--glboal</code> 选项指的是修改 Git 的全局配置文件 <code>~/.gitconfig</code>(而非各个 Git 仓库里的配置文件 <code>.git/config</code>)。</li><li><code><url></code> 指的是你需要使用代理的远程仓库,该 <code><url></code> 支持 HTTP / HTTPS 传输协议的格式:<ul><li><code><url></code> 格式为 <code>http://example.com</code> 或 <code>https://example.com</code></li></ul></li><li><code><protocol></code> 指的是<strong>代理协议</strong>,如 http,https,socks5 等。</li><li><code><host></code> 为代理主机,如使用本地代理主机 127.0.0.1 或 localhost 等。</li><li><code><port></code> 则为代理端口号,如 clash 使用的 7890 或 7891 等。</li><li><strong>常见误用</strong>:针对 HTTPS 传输协议(即 <code>https://</code> 开头)的 <code><url></code> 代理,命令写成 “<code>git config --global</code> <strong><code>https</code></strong><code>.https://github.com.proxy protocol://127.0.0.1:7890</code>” ,这一写法<strong>完全是错的</strong>。请记住:请记住: Git 代理配置项<strong>正确写法</strong>为 <strong><code>http</code></strong><code>.<url>.proxy</code>,并不支持 <strong><code>https</code></strong><code>.<url>.proxy</code> 这一<strong>错误写法</strong>。</li><li>如果想了解 <code><url></code> 的更多模式,如子域名等的情况,可参照 <a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-httplturlgt">Git 的官方文档</a> 。</li></ul> </div> </details><hr><h3 id="实例"><a href="#实例" class="headerlink" title="实例"></a>实例</h3><blockquote><p>针对 Git 使用 HTTP / HTTPS 传输协议的代理方法,在 Windows,Linux,macOS 上用户的操作均是一样的。</p></blockquote><p>也许你光看我上面的内容还看不明白,不妨我们来看下实例部分:</p><p>此处以 Clash for Windows 为例子。如图:</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/git-proxy-config/1.png" alt="image"/></div></div><p>Clash for Windows 既支持 <strong>HTTP / HTTPS</strong> 协议代理,也支持 <strong>SOCKS v5</strong> 协议代理。如果你使用其他的代理软件,你可以根据你使用的代理软件的<strong>代理协议</strong>和本地<strong>端口号</strong>参考本文修改即可。</p><hr><h4 id="针对所有域名的-Git-仓库"><a href="#针对所有域名的-Git-仓库" class="headerlink" title="针对所有域名的 Git 仓库"></a>针对所有域名的 Git 仓库</h4><p>根据你的代理软件支持的代理协议<strong>选取其中一种</strong>即可:</p><div class="tabs" id="tab-a"><ul class="nav-tabs"><li class="tab active"><a class="#a-1">http 代理</a></li><li class="tab"><a class="#a-2">socks5 代理</a></li></ul><div class="tab-content"><div class="tab-pane active" id="a-1"><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git config --global http.proxy http://127.0.0.1:7890</span><br></pre></td></tr></table></figure><p><strong>注意</strong>:<em>7890</em> 为 Clash for Windows 的 http 代理端口。</p></div><div class="tab-pane" id="a-2"><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git config --global http.proxy socks5://127.0.0.1:7891</span><br></pre></td></tr></table></figure><p><strong>注意</strong>:<em>7891</em> 为 Clash for Windows 的 socks5 代理端口。</p></div></div></div><hr><h4 id="针对特定域名的-Git-仓库"><a href="#针对特定域名的-Git-仓库" class="headerlink" title="针对特定域名的 Git 仓库"></a>针对特定域名的 Git 仓库</h4><p>前面我们说的是,让所有域名下的仓库都走代理的情况,但是在现实情况下我们并不想这么做。那么现在我来介绍一下针对特定域名仓库走代理的做法,此处以 GitHub 为例:</p><p>当我们在 GitHub 仓库使用 HTTPS 传输协议克隆源码时,我们往往是这么做的的:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> https://github.com/<user>/<repository>.git</span><br></pre></td></tr></table></figure><p>那么我前面<strong>命令注解</strong>所提到的 <code><url></code> 就是 <code>https://github.com</code></p><p>根据你的代理软件支持的代理协议<strong>选取其中一种</strong>即可:</p><div class="tabs" id="tab-b"><ul class="nav-tabs"><li class="tab active"><a class="#b-1">http 代理</a></li><li class="tab"><a class="#b-2">socks5 代理</a></li></ul><div class="tab-content"><div class="tab-pane active" id="b-1"><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git config --global http.https://github.com.proxy http://127.0.0.1:7890</span><br></pre></td></tr></table></figure></div><div class="tab-pane" id="b-2"><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git config --global http.https://github.com.proxy socks5://127.0.0.1:7891</span><br></pre></td></tr></table></figure></div></div></div><hr><h2 id="Git-使用-SSH-传输协议的代理方法"><a href="#Git-使用-SSH-传输协议的代理方法" class="headerlink" title="Git 使用 SSH 传输协议的代理方法"></a>Git 使用 SSH 传输协议的代理方法</h2><p>在这种情况下,Git 依靠 ssh 程序处理连接; 为了通过代理进行连接,您必须配置 ssh 程序本身,在 <code>~/.ssh/config</code> 文件中设置 <strong>ProxyCommand</strong> 选项,通过在 <strong>ProxyCommand</strong> 中声明,使用<strong>不同操作系统下</strong>的程序来通过代理建立连接。</p><ul><li><p><strong>macOS</strong> 是通过在 ProxyCommand 中声明 <code>nc</code> 程序(该 nc 程序命令为系统自带的 OpenBSD 版本的 netcat 提供)来代理的;</p></li><li><p><strong>Linux</strong> 一样可以通过 <code>nc</code> 程序、但是 Linux 上 <code>nc</code> 程序有 2 种 netcat 版本可以提供,分为 Nmap 版和 OpenBSD 版。如果是 OpenBSD 的版本,则 <code>nc</code> 命令与 macOS 相同;如果是 Nmap 版本的,<code>nc</code> 其实是指向 <code>ncat</code> 程序的<strong>符号链接</strong>,则其具体命令不一样;各 Linux 发行版本下 netcat 软件包名如下表:</p><table><thead><tr><th align="center">Linux 发行版本 / netcat 软件包名</th><th align="center">Nmap 版</th><th align="center">OpenBSD 版</th></tr></thead><tbody><tr><td align="center">Fedora 系列</td><td align="center"><code>nmap-ncat</code></td><td align="center"><code>netcat</code></td></tr><tr><td align="center">Debian 系列</td><td align="center"><code>ncat</code></td><td align="center"><code>netcat-openbsd</code></td></tr></tbody></table></li><li><p><strong>Windows</strong> 下则是通过安装 Git for Windows 附带的 <code>connect</code> 程序。</p></li></ul><hr><details cyan><summary> 相关 man 手册(点击展开) </summary> <div class='content'> <ul><li><a href="https://man.openbsd.org/ssh_config">ssh_config(5)</a> ProxyCommand 的内容:</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">ProxyCommand</span><br><span class="line"></span><br><span class="line">Specifies the command to use to connect to the server. The command string extends to the end of the line, and is executed using the user's shell ‘exec’ directive to avoid a lingering shell process.</span><br><span class="line"></span><br><span class="line">Arguments to ProxyCommand accept the tokens described in the TOKENS section. The command can be basically anything, and should read from its standard input and write to its standard output. It should eventually connect an sshd(8) server running on some machine, or execute sshd -i somewhere. Host key management will be done using the Hostname of the host being connected (defaulting to the name typed by the user). Setting the command to none disables this option entirely. Note that CheckHostIP is not available for connects with a proxy command.</span><br><span class="line"></span><br><span class="line">This directive is useful in conjunction with nc(1) and its proxy support. For example, the following directive would connect via an HTTP proxy at 192.0.2.0:</span><br><span class="line"></span><br><span class="line">ProxyCommand /usr/bin/nc -X connect -x 192.0.2.0:8080 %h %p</span><br></pre></td></tr></table></figure><ul><li>Nmap 提供的 <a href="https://man7.org/linux/man-pages/man1/ncat.1.html">nc(1)</a> 程序 <code>--proxy</code> 和 <code>--proxy-type</code> 的内容:</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">--proxy host[:port] (Specify proxy address)</span><br><span class="line">Requests proxying through host:port, using the protocol specified by --proxy-type.</span><br><span class="line">If no port is specified, the proxy protocol's well-known port is used (1080 for SOCKS and 3128 for HTTP). When specifying an IPv6 HTTP proxy server using the IP address rather than the hostname, the square-bracket notation (for example [2001:db8::1]:8080) MUST be used to separate the port from the IPv6 address. If the proxy requires authentication, use --proxy-auth.</span><br><span class="line"></span><br><span class="line">--proxy-type proto (Specify proxy protocol)</span><br><span class="line">In connect mode, this option requests the protocol proto to connect through the proxy host specified by --proxy. In listen mode, this option has Ncat act as a proxy server using the specified protocol.</span><br><span class="line">The currently available protocols in connect mode are http (CONNECT), socks4 (SOCKSv4), and socks5 (SOCKSv5). The only server currently supported is http. If this option is not used, the default protocol is http.</span><br></pre></td></tr></table></figure><ul><li>OpenBSD 提供的 <a href="https://man.openbsd.org/nc">nc(1)</a> 程序 <code>-X</code> 和 <code>-x</code> 选项的的内容:</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">-X proxy_protocol</span><br><span class="line">Use proxy_protocol when talking to the proxy server. Supported protocols are 4 (SOCKS v.4), 5 (SOCKS v.5) and connect (HTTPS proxy). If the protocol is not specified, SOCKS version 5 is used.</span><br><span class="line"></span><br><span class="line">-x proxy_address[:port]</span><br><span class="line">Connect to destination using a proxy at proxy_address and port. If port is not specified, the well-known port for the proxy protocol is used (1080 for SOCKS, 3128 for HTTPS). An IPv6 address can be specified unambiguously by enclosing proxy_address in square brackets. A proxy cannot be used with any of the options -lsuU.</span><br></pre></td></tr></table></figure><ul><li>Git for Windows 默认附带的 <a href="https://github.com/gotoh/ssh-connect#more-detail">connect</a> 程序 <code>-H</code> 和 <code>-S</code> 选项的内容</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">-H option specify hostname and port number of http proxy server to relay. If port is omitted, 80 is used. You can specify this value by environment variable HTTP_PROXY and give -h option to use it.</span><br><span class="line"></span><br><span class="line">-S option specify hostname and port number of SOCKS server to relay. Like -H option, port number can be omit and default is 1080. You can also specify this value pair by environment variable SOCKS5_SERVER and give -s option to use it.</span><br><span class="line"></span><br><span class="line">-4 and -5 is for specifying SOCKS protocol version. It is valid only using with -s or -S. Default is -5 (protocol version 5)</span><br></pre></td></tr></table></figure> </div> </details><hr><h3 id="实例-1"><a href="#实例-1" class="headerlink" title="实例"></a>实例</h3><p>接下来的操作,请按照你的<strong>系统</strong>、选择的 <strong>netcat 的实现版本</strong>以及所使用的<strong>代理协议</strong>进行选择:</p><hr><h4 id="Linux(OpenBSD-版-netcat)和-macOS-用户"><a href="#Linux(OpenBSD-版-netcat)和-macOS-用户" class="headerlink" title="Linux(OpenBSD 版 netcat)和 macOS 用户"></a>Linux(OpenBSD 版 netcat)和 macOS 用户</h4><div class="tabs" id="tab-c"><ul class="nav-tabs"><li class="tab active"><a class="#c-1">https 代理</a></li><li class="tab"><a class="#c-2">socks5 代理</a></li></ul><div class="tab-content"><div class="tab-pane active" id="c-1"><p>编辑 <code>~/.ssh/config</code> 文件</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim ~/.ssh/config</span><br></pre></td></tr></table></figure><p>给文件加上如下内容:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Host github.com</span><br><span class="line"> User git</span><br><span class="line"> ProxyCommand nc -X connect -x 127.0.0.1:7890 %h %p</span><br></pre></td></tr></table></figure><blockquote><p><strong>解释</strong>: </p><ul><li><code>Host</code> 后面 接的 <code>github.com</code> 是指定要走代理的仓库域名。</li><li>在 ProxyCommand 中,Linux 和 macOS 用户用的是 OpenBSD 版本的 <code>nc</code>。</li><li><code>-X</code> 选项后面接的是 <code>connect</code> 的意思是 HTTPS 代理。</li><li><code>-x</code> 选项后面加上代理地址和端口号。</li><li>在调用 ProxyCommand 时,<code>%h</code> 和 <code>%p</code> 将会被自动替换为<strong>目标主机名</strong>和 <strong>SSH 命令指定的端口</strong>(<code>%h</code> 和 <code>%p</code> 不要修改,保留原样即可)。</li></ul></blockquote></div><div class="tab-pane" id="c-2"><p>编辑 <code>~/.ssh/config</code> 文件</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim ~/.ssh/config</span><br></pre></td></tr></table></figure><p>给文件加上如下内容,2种任选一个:</p><blockquote><ul><li><code>Host</code> 后面 接的 <code>github.com</code> 是指定要走代理的仓库域名。</li><li>在 ProxyCommand 中,Linux 和 macOS 用户用的是 OpenBSD 版本的 <code>nc</code> 。</li><li>在调用 ProxyCommand 时,<code>%h</code> 和 <code>%p</code> 将会被自动替换为<strong>目标主机名</strong>和 <strong>SSH 命令指定的端口</strong>( <code>%h</code> 和 <code>%p</code> 不要修改,保留原样即可)。</li><li>如果 <code>-X</code> 选项后面接的是数字 <strong>5</strong>,那么指的就是 socks5 代理。</li><li>当然你直接不写上 <code>-X</code> 选项也是可以的,因为在没有指定协议的情况下,默认是使用 socks5 代理的。所以以下 <strong>2 种的写法效果一样</strong> ,都指的是走 socks5 代理:</li></ul></blockquote><p>①. 第一种</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Host github.com</span><br><span class="line"> User git</span><br><span class="line"> ProxyCommand nc -X 5 -x 127.0.0.1:7891 %h %p</span><br></pre></td></tr></table></figure><p>或</p><p>②. 第二种</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Host github.com</span><br><span class="line"> User git</span><br><span class="line"> ProxyCommand nc -x 127.0.0.1:7891 %h %p</span><br></pre></td></tr></table></figure></div></div></div><hr><h4 id="Linux(Nmap-版-netcat)用户"><a href="#Linux(Nmap-版-netcat)用户" class="headerlink" title="Linux(Nmap 版 netcat)用户"></a>Linux(Nmap 版 netcat)用户</h4><div class="tabs" id="tab-d"><ul class="nav-tabs"><li class="tab active"><a class="#d-1">http 代理</a></li><li class="tab"><a class="#d-2">socks5 代理</a></li></ul><div class="tab-content"><div class="tab-pane active" id="d-1"><p>编辑 <code>~/.ssh/config</code> 文件</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim ~/.ssh/config</span><br></pre></td></tr></table></figure><p>给文件加上以下内容:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Host github.com</span><br><span class="line"> User git</span><br><span class="line"> ProxyCommand nc --proxy 127.0.0.1:7890 --proxy-type http %h %p</span><br></pre></td></tr></table></figure><blockquote><p><strong>解释</strong>: </p><ul><li><code>Host</code> 后面 接的 <code>github.com</code> 是指定要走代理的仓库域名。</li><li>在 ProxyCommand 中,Linux 用户用的是 Nmap 版本的 <code>nc</code> 。</li><li><code>--proxy-type</code> 选项后面的 <code>http</code> 的意思是指使用 HTTP 代理。</li><li>在调用 ProxyCommand 时,<code>%h</code> 和 <code>%p</code> 将会被自动替换为<strong>目标主机名</strong>和 <strong>SSH 命令指定的端口</strong>( <code>%h</code> 和 <code>%p</code> 不要修改,保留原样即可)。</li></ul></blockquote></div><div class="tab-pane" id="d-2"><p>编辑 <code>~/.ssh/config</code> 文件</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim ~/.ssh/config</span><br></pre></td></tr></table></figure><p>给文件加上如下内容:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Host github.com</span><br><span class="line"> User git</span><br><span class="line"> ProxyCommand nc --proxy 127.0.0.1:7891 --proxy-type socks5 %h %p</span><br></pre></td></tr></table></figure><blockquote><p><strong>解释</strong>: </p><ul><li><code>Host</code> 后面 接的 <code>github.com</code> 是指定要走代理的仓库域名。</li><li>在 ProxyCommand 中,Linux 用户用的是 Nmap 版本的 <code>nc</code> 。</li><li><code>--proxy-type</code> 选项后面的 <code>socks5</code> 的意思是指使用 socks5 代理。</li><li>在调用 ProxyCommand 时,<code>%h</code> 和 <code>%p</code> 将会被自动替换为<strong>目标主机名</strong>和 <strong>SSH 命令指定的端口</strong>( <code>%h</code> 和 <code>%p</code> 不要修改,保留原样即可)。</li></ul></blockquote></div></div></div><hr><h4 id="Windows-用户"><a href="#Windows-用户" class="headerlink" title="Windows 用户"></a>Windows 用户</h4><div class="tabs" id="tab-e"><ul class="nav-tabs"><li class="tab active"><a class="#e-1">http 代理</a></li><li class="tab"><a class="#e-2">socks5 代理</a></li></ul><div class="tab-content"><div class="tab-pane active" id="e-1"><p>编辑 <code>~/.ssh/config</code> 文件</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim ~/.ssh/config</span><br></pre></td></tr></table></figure><p>给文件加上以下内容:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Host github.com</span><br><span class="line"> User git</span><br><span class="line"> ProxyCommand connect -H 127.0.0.1:7890 %h %p</span><br></pre></td></tr></table></figure><blockquote><p><strong>解释</strong>: </p><ul><li><code>Host</code> 后面 接的 <code>github.com</code> 是指定要走代理的仓库域名。</li><li>在 ProxyCommand 中,Windows 用户用的是 <code>connect</code> 。</li><li><code>-H</code> 选项的意思是 HTTP 代理。</li><li>在调用 ProxyCommand 时,<code>%h</code> 和 <code>%p</code> 将会被自动替换为<strong>目标主机名</strong>和 <strong>SSH 命令指定的端口</strong>( <code>%h</code> 和 <code>%p</code> 不要修改,保留原样即可)。</li></ul></blockquote></div><div class="tab-pane" id="e-2"><p>编辑 <code>~/.ssh/config</code> 文件</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vim ~/.ssh/config</span><br></pre></td></tr></table></figure><p>给文件加上如下内容:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Host github.com</span><br><span class="line"> User git</span><br><span class="line"> ProxyCommand connect -S 127.0.0.1:7891 %h %p</span><br></pre></td></tr></table></figure><blockquote><p><strong>解释</strong>:</p><ul><li><code>Host</code> 后面 接的 <code>github.com</code> 是指定要走代理的仓库域名。</li><li>在 ProxyCommand 中,Windows 用户用的是 <code>connect</code>。</li><li>单独的 <code>-S</code> 选项指的就是 socks5 代理</li><li>在调用 ProxyCommand 时,<code>%h</code> 和 <code>%p</code> 将会被自动替换为<strong>目标主机名</strong>和 <strong>SSH 命令指定的端口</strong>( <code>%h</code> 和 <code>%p</code> 不要修改,保留原样即可)。</li></ul></blockquote></div></div></div><hr><h2 id="如何取消-Git-和-ssh-的代理"><a href="#如何取消-Git-和-ssh-的代理" class="headerlink" title="如何取消 Git 和 ssh 的代理"></a>如何取消 Git 和 ssh 的代理</h2><p>这里就不多说了,说了那么多,我们无非就是修改了 2 个文件,即 <code>~/.gitconfig</code> 和 <code>~/.ssh/config</code> ,<strong>删除</strong>或<strong>注释</strong>我们增加的相应内容(在相应行的开头加上 <code>#</code> 即可)即可完成取消代理。</p><hr><h2 id="参考链接"><a href="#参考链接" class="headerlink" title="参考链接"></a>参考链接</h2><ol><li><a href="https://git-scm.com/docs/git-config">Git - git-config Documentation</a></li><li><a href="https://gist.github.com/evantoli/f8c23a37eb3558ab8765">Configure Git to use a proxy</a></li><li><a href="https://cms-sw.github.io/tutorial-proxy.html">Tutorial: how to use git through a proxy</a></li><li><a href="https://man.openbsd.org/ssh_config">ssh_config(5) - OpenBSD manual pages</a></li><li><a href="https://man7.org/linux/man-pages/man1/ncat.1.html">ncat(1) — Linux manual page</a></li><li><a href="https://man.openbsd.org/nc">nc(1) - OpenBSD manual pages</a></li><li><a href="https://github.com/gotoh/ssh-connect#more-detail">SSH Proxy Command – connect.c</a></li><li><a href="https://superuser.com/a/454211">How can I use SSH with a SOCKS 5 proxy?</a></li><li><a href="https://jeshs.github.io/2019/04/git%E5%9F%BA%E7%A1%80%E4%BB%A3%E7%90%86/">Git 基础——代理</a></li><li><a href="https://www.perkin.org.uk/posts/ssh-via-http-proxy-in-osx.html">SSH via HTTP proxy in OSX</a></li></ol>]]></content>
<categories>
<category> Proxy </category>
</categories>
<tags>
<tag> 代理 </tag>
<tag> Git </tag>
</tags>
</entry>
<entry>
<title>如何通过 HWIDGEN 以数字许可的方式激活 Windows 10</title>
<link href="/active-Windows-10-with-digital-license.html"/>
<url>/active-Windows-10-with-digital-license.html</url>
<content type="html"><![CDATA[<p>HWIDGEN 是一款由国外 Nsane 论坛会员 s1ave77 制作的 Windows 10 数字权利激活工具。这款 Windows 10 数字权利获取工具,可以自动获取 Windows 10 数字许可证激活,无需产品密钥,以最简单的方式永久激活。</p><span id="more"></span><p><strong>HWIDGEN 的源码</strong></p><ul><li><a href="https://github.com/CHEF-KOCH/HWIDGEN-SRC">https://github.com/CHEF-KOCH/HWIDGEN-SRC</a></li></ul><blockquote><p><strong>工具下载地址</strong></p><ul><li><a href="https://drive.google.com/open?id=14swGfWlpXVcfE9U_mu8InPbAqtf78KzO">Google Drive(包含历史版本)</a></li></ul><p><strong>解压密码</strong></p><ul><li><code>3Fs44Rv#tZ4u3UOij656NgF____</code></li></ul><p>支持的 Windows 10 版本(Skus):</p><ul><li>核心(家庭)版(N)</li><li>核心单语言版(N)</li><li>专业版(N)</li><li>专业教育版(N)</li><li>专业工作站版(N)</li><li>教育版(N)</li><li>企业版(N)</li><li>企业 S 版(N)【2015/2016:数字证书】</li><li>企业 S 版(N)【2019:19年的离线 KMS 激活(和企业G版相似)】</li><li>服务器标准(核心)版(N)【2016/2019:19年的离线 KMS 激活(和企业G版相似)】</li><li>服务器数据中心(核心)版(N)【2016/2019:19年的离线 KMS 激活(和企业G版相似)】</li><li>服务器解决方案(核心)版(N)【2016/2019:19年的离线 KMS 激活(和企业G版相似)】</li></ul><p>上述内容均引用自 <a href="https://channel.justf.space/2018/06/17/Windows-activation-HWID/">Windows 10 数字许可证激活(HWID)方法——原创翻译</a></p></blockquote><p><strong>使用说明</strong></p><p>下载 <code>hwid.kms38.gen.mk6.zip</code> 后将压缩包解压,输入上述密码,得到文件 <code>hwid.kms38.gen.mk6.exe</code>,双击它。启动完成后在 <strong>Work Mode</strong> 选中 <strong>HWID</strong>,然后 <strong>Start</strong> 即可,等进度条走完跳出 <strong>Success</strong> 弹框就激活成功啦。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><p><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/active-windows-10-with-digital-license/1.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/active-windows-10-with-digital-license/1.png"></a><span></span></div></p><div class="img-wrap"><div class="img-bg"><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/active-windows-10-with-digital-license/2.png' data-fancybox='default' data-caption='image'><img fancybox itemprop="contentUrl" class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/active-windows-10-with-digital-license/2.png" alt="image" style="width:400px;"/></a><span></span></div></div></div></div><p>进入「<strong>设置</strong>」,「<strong>安全和更新</strong>」,找到「<strong>激活</strong>」的一栏。得到“<em>Windows 已使用数字许可证激活</em>”的提示:</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/active-windows-10-with-digital-license/3.png' data-fancybox='default' data-caption='Windows 已使用数字许可证激活'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/active-windows-10-with-digital-license/3.png" alt="Windows 已使用数字许可证激活"></a><span class='image-caption'>Windows 已使用数字许可证激活</span></div></div>]]></content>
<categories>
<category> Windows </category>
</categories>
<tags>
<tag> Windows </tag>
<tag> 激活 </tag>
</tags>
</entry>
<entry>
<title>竞斗云2.0 ( P&W R619AC ) 刷机教程 ( 免拆机 / 免劫持 )</title>
<link href="/R619AC-OpBoot-and-OpenWrt-flashing.html"/>
<url>/R619AC-OpBoot-and-OpenWrt-flashing.html</url>
<content type="html"><![CDATA[<blockquote><p>目前竞斗云2.0 官方固件版本升级至 <strong>2.5.11.82</strong> 后可轻松刷入第三方固件,这简化了我们刷机的流程。</p></blockquote><p>事前准备:</p><ul><li>电脑、网线、<strong>全新</strong> / <strong>已恢复出厂</strong> 的竞斗云2.0</li><li>请先给路由器通上电后用网线将电脑连接至路由器的 <strong>LAN 口</strong></li><li>下载好下列文件:</li></ul><span id="more"></span><p><strong>竞斗云2.0 刷机相关文件</strong></p><overflow><table><thead><tr><th align="center">文件名</th><th align="center">md5sum</th><th align="center">描述</th><th align="center">下载</th></tr></thead><tbody><tr><td align="center"><code>openwrt-ipq40xx-R9.11.22-unlock-p2w_r619ac-squashfs-nand-factory.bin</code></td><td align="center">d3e8d29d1a37872f37f9070fabb9a7a2</td><td align="center">OpenWrt 过渡包,在竞斗云官方固件更新后刷入</td><td align="center"><a href="https://github.com/ericclose/r619ac-opboot-and-openwrt-flashing/raw/master/1/openwrt-ipq40xx-R9.11.22-unlock-p2w_r619ac-squashfs-nand-factory.bin">链接</a></td></tr><tr><td align="center"><code>opboot-p2w-r619ac-flash-v1.0.8.bin</code></td><td align="center">c3c0efd25aa18ee505debb3a90d75fe3</td><td align="center">OpBoot文件,刷入过渡包后刷入</td><td align="center"><a href="https://github.com/ericclose/r619ac-opboot-and-openwrt-flashing/raw/master/2/opboot-p2w-r619ac-flash-v1.0.8.bin">链接</a></td></tr><tr><td align="center"><code>openwrt-ipq40xx-R9.11.23-p2w_r619ac-squashfs-nand-sysupgrade.bin</code></td><td align="center">856e7571263398a8c976cbf721ac821c</td><td align="center">刷完OpBoot后,最后刷入的OpenWrt固件</td><td align="center"><a href="https://github.com/ericclose/r619ac-opboot-and-openwrt-flashing/raw/master/3/openwrt-ipq40xx-R9.11.23-p2w_r619ac-squashfs-nand-sysupgrade.bin">链接</a></td></tr></tbody></table></overflow><ul><li>MEGA 网盘下载链接: <a href="https://mega.nz/#F!hVgXjACA!CISFW8tyoKLCWs6RbC23LQ">https://mega.nz/#F!hVgXjACA!CISFW8tyoKLCWs6RbC23LQ</a></li></ul><blockquote><p><strong>推荐</strong> 使用梯子在 MEGA 网盘下载相关文件,当然您也可以直接点击表格中的链接下载。</p></blockquote><h2 id="官方固件更新并刷入-OpenWrt-过渡包"><a href="#官方固件更新并刷入-OpenWrt-过渡包" class="headerlink" title="官方固件更新并刷入 OpenWrt 过渡包"></a>官方固件更新并刷入 OpenWrt 过渡包</h2><ol><li>浏览器访问 <strong>192.168.7.1</strong> ,进入官方固件的管理页面。</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/1.png" alt="image"/></div></div><ol start="2"><li><p>选择 「 <strong>自动获取(DHCP模式)</strong> 」 ,下一步</p></li><li><p>设置 WiFi 名称和密码,密码可为空,下一步</p></li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/2.png" alt="image"/></div></div><ol start="4"><li>输入设置的密码,「 <strong>登录</strong> 」(如果没设置密码直接点登录即可)</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/3.png" alt="image"/></div></div><ol start="5"><li>这就进入了主界面,我们点击 「 <strong>高级设置</strong> 」</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/4.png" alt="image"/></div></div><ol start="6"><li>点击 「 <strong>升级检查</strong> 」 -> 「 <strong>检查升级</strong> 」</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/5.png" alt="image"/></div></div><ol start="7"><li><strong>升级提醒</strong> 处点击 「 <strong>确定</strong> 」</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/6.png" alt="image"/></div></div><ol start="8"><li>正在升级系统,请不要关闭电源…</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/7.png" alt="image"/></div></div><ol start="9"><li>升级完成后浏览器会重新进入路由器管理界面,重新输入设置过的密码登录即可。此时我们在主界面点击 「 <strong>高级设置</strong> 」 -> 「 <strong>升级检查</strong> 」 ,这里已经可以看到在新版官方固件(版本号为 <strong>2.5.11.82</strong> )多了上传固件更新系统的功能。如图:</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/8.png" alt="image"/></div></div><ol start="10"><li>点击 「 <strong>选择文件</strong> 」 ,选中过渡包(即 <em>openwrt-ipq40xx-R9.11.22-unlock-p2w_r619ac-squashfs-nand-factory.bin</em> ),无需保存配置,点击 「 <strong>开始刷入</strong> 」 即可。</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/9.png" alt="image"/></div></div><ol start="11"><li>正在升级系统,请不要关闭电源…</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/10.png" alt="image"/></div></div><ol start="12"><li>刷完固件后,原有的 <strong>192.168.7.1</strong> 已经无法访问了,OpenWrt 的默认管理地址是 <strong>192.168.1.1</strong> ,在浏览器的地址栏输入 <strong>192.168.1.1</strong> 即可。</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/11.png" alt="image"/></div></div><p>如果能访问 OpenWrt 登录界面即表示正常刷入固件(此处我们无需登录),如图:</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/12.png" alt="image"/></div></div><p>到这里,如果您是 Windows 用户,建议看 Hyejeong 的针针小站一文 —— <a href="https://web.archive.org/web/20210516031035/https://hyejeong.cn/gdockflash">【Router】G-DOCK 竞斗云2.0 小白刷机教程</a> 。</p><h2 id="电脑上安装-OpenSSH"><a href="#电脑上安装-OpenSSH" class="headerlink" title="电脑上安装 OpenSSH"></a>电脑上安装 OpenSSH</h2><blockquote><p><strong>注意</strong>: 本人电脑使用的 Linux 发行版本是 Arch Linux,其默认的软件包管理器是 <em>pacman</em> 。请根据您使用的发行版本选择合适的包管理器安装 <strong>openssh</strong></p></blockquote><p>电脑上打开终端模拟器执行命令:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[eric@<span class="built_in">arch</span> ~]$ sudo pacman -S openssh</span><br></pre></td></tr></table></figure><h2 id="将电脑上的-OpBoot-文件-opboot-p2w-r619ac-flash-v1-0-8-bin-复制到路由器"><a href="#将电脑上的-OpBoot-文件-opboot-p2w-r619ac-flash-v1-0-8-bin-复制到路由器" class="headerlink" title="将电脑上的 OpBoot 文件 ( opboot-p2w-r619ac-flash-v1.0.8.bin ) 复制到路由器"></a>将电脑上的 OpBoot 文件 ( opboot-p2w-r619ac-flash-v1.0.8.bin ) 复制到路由器</h2><p>将文件从本地主机复制到远程主机,用法如下:</p><p>scp <em>local_file_path</em> <em>username</em>@<em>host_ip</em>:<em>/remote/directory/</em></p><h3 id="操作实例"><a href="#操作实例" class="headerlink" title="操作实例"></a>操作实例</h3><blockquote><p><strong>注意</strong>: 默认密码是 <strong>password</strong></p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">[eric@<span class="built_in">arch</span> ~]$ scp <span class="string">'/home/eric/OpBoot/opboot-p2w-r619ac-flash-v1.0.8.bin'</span> [email protected]:/tmp</span><br><span class="line">The authenticity of host <span class="string">'192.168.1.1 (192.168.1.1)'</span> can<span class="string">'t be established.</span></span><br><span class="line"><span class="string">RSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.</span></span><br><span class="line"><span class="string">Are you sure you want to continue connecting (yes/no/[fingerprint])? yes</span></span><br><span class="line"><span class="string">Warning: Permanently added '</span>192.168.1.1<span class="string">' (RSA) to the list of known hosts.</span></span><br><span class="line"><span class="string">[email protected]'</span>s password: </span><br><span class="line">opboot-p2w-r619ac-flash-v1.0.8.bin 100% 1472KB 3.6MB/s 00:00</span><br></pre></td></tr></table></figure><h2 id="SSH-登录到路由器"><a href="#SSH-登录到路由器" class="headerlink" title="SSH 登录到路由器"></a>SSH 登录到路由器</h2><p>ssh 登录到远程服务器,用法如下:</p><blockquote><p>ssh <em>username</em>@<em>server-address</em></p></blockquote><h3 id="操作实例-1"><a href="#操作实例-1" class="headerlink" title="操作实例"></a>操作实例</h3><blockquote><p><strong>注意</strong>: 密码和前面输入的是同一个,即 <strong>password</strong></p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">[eric@<span class="built_in">arch</span> ~]$ ssh [email protected]</span><br><span class="line">[email protected]<span class="string">'s password: </span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">BusyBox v1.30.0 () built-in shell (ash)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"> _______ ________ __</span></span><br><span class="line"><span class="string"> | |.-----.-----.-----.| | | |.----.| |_</span></span><br><span class="line"><span class="string"> | - || _ | -__| || | | || _|| _|</span></span><br><span class="line"><span class="string"> |_______|| __|_____|__|__||________||__| |____|</span></span><br><span class="line"><span class="string"> |__| W I R E L E S S F R E E D O M</span></span><br><span class="line"><span class="string"> -----------------------------------------------------</span></span><br><span class="line"><span class="string"> OpenWrt SNAPSHOT, r1673-ea47656</span></span><br><span class="line"><span class="string"> -----------------------------------------------------</span></span><br><span class="line"><span class="string">root@OpenWrt:~# </span></span><br></pre></td></tr></table></figure><h2 id="读取路由器的分区表"><a href="#读取路由器的分区表" class="headerlink" title="读取路由器的分区表"></a>读取路由器的分区表</h2><blockquote><p>前面已经登录到路由器的 shell 了,所以命令是在路由器上执行的了。</p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">root@OpenWrt:~<span class="comment"># cat /proc/mtd</span></span><br><span class="line">dev: size erasesize name</span><br><span class="line">mtd0: 04000000 00020000 <span class="string">"rootfs"</span></span><br><span class="line">mtd1: 04000000 00020000 <span class="string">"unused1"</span></span><br><span class="line">mtd2: 00170000 00010000 <span class="string">"Bootloader"</span></span><br><span class="line">mtd3: 00010000 00010000 <span class="string">"ART"</span></span><br><span class="line">mtd4: 00e80000 00010000 <span class="string">"unused"</span></span><br></pre></td></tr></table></figure><p>只要查询到分区里含有 Bootloader ,就可以继续下面的刷写 Bootloader 的操作了。</p><h2 id="校验路由器上的-OpBoot-文件"><a href="#校验路由器上的-OpBoot-文件" class="headerlink" title="校验路由器上的 OpBoot 文件"></a>校验路由器上的 OpBoot 文件</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">root@OpenWrt:~<span class="comment"># md5sum /tmp/opboot-p2w-r619ac-flash-v1.0.8.bin</span></span><br><span class="line">c3c0efd25aa18ee505debb3a90d75fe3 /tmp/opboot-p2w-r619ac-flash-v1.0.8.bin</span><br></pre></td></tr></table></figure><blockquote><p><em>opboot-p2w-r619ac-flash-v1.0.8.bin</em> 的 md5 值是:<br><em>c3c0efd25aa18ee505debb3a90d75fe3</em> ,如果对的上即可放心刷入。</p></blockquote><h2 id="刷写-OpBoot-到-Bootloader"><a href="#刷写-OpBoot-到-Bootloader" class="headerlink" title="刷写 OpBoot 到 Bootloader"></a>刷写 OpBoot 到 Bootloader</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">root@OpenWrt:~<span class="comment"># mtd -r write /tmp/opboot-p2w-r619ac-flash-v1.0.8.bin Bootloader</span></span><br><span class="line">Unlocking Bootloader ...</span><br><span class="line"></span><br><span class="line">Writing from /tmp/opboot-p2w-r619ac-flash-v1.0.8.bin to Bootloader ... </span><br><span class="line">Rebooting ...</span><br><span class="line"></span><br></pre></td></tr></table></figure><blockquote><p>注意: 此处 <em>Rebooting…</em> 并不会自动退出,想要知道是否重启完,浏览器直接访问 <strong>192.168.1.1</strong> 如果能访问 OpenWrt 的登录界面则表示已经重启完成。此时你可以手动关闭电脑的终端模拟器了</p></blockquote><h2 id="进入-OpBoot"><a href="#进入-OpBoot" class="headerlink" title="进入 OpBoot"></a>进入 OpBoot</h2><p>先拔掉路由器的电源,长按路由器背面的 reset 按键( <strong>不要松开</strong> ),然后重新插上电源,直到 <strong>跑马灯跑完</strong> (即 LAN的 指示灯4,3,2,1 依次闪过,最后LAN口的指示灯全亮,过后又熄灭),这时就可以松 reset 键了。然后浏览器直接访问 <strong>192.168.1.1</strong> ,这样就能进入 OpBoot 了。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/13.png" alt="image"/></div></div><h2 id="备份ART"><a href="#备份ART" class="headerlink" title="备份ART"></a>备份ART</h2><p>主界面下点击 「 <strong>高级功能</strong> 」 -> 「 <strong>数据备份</strong> 」 -> 「 <strong>执行</strong> 」 ,浏览器会将 <em>art.bin</em> 自动下载到你的电脑上。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/14.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/14.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/15.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/15.png"></a><span></span></div></div><h2 id="备份编程器固件"><a href="#备份编程器固件" class="headerlink" title="备份编程器固件"></a>备份编程器固件</h2><p>刷新下浏览器然后在 「 <strong>备份分区</strong> 」 处选择 <strong>编程器固件</strong> ,然后再点击 「 <strong>执行</strong> 」 ,浏览器会将 <em>all.bin</em> 自动下载到你的电脑上。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/16.png" alt="image"/></div></div><h2 id="更新-OpenWrt-固件"><a href="#更新-OpenWrt-固件" class="headerlink" title="更新 OpenWrt 固件"></a>更新 OpenWrt 固件</h2><blockquote><p><strong>注意</strong>: 你可以在之前刷入的 OpenWrt 管理界面里更新固件,当然你也可以继续留在 OpBoot 更新固件。</p></blockquote><ol><li>返回 OpBoot 主菜单</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/17.png" alt="image"/></div></div><ol start="2"><li>「 <strong>浏览文件</strong> 」 ,选中需要使用的 OpenWrt 固件 ( <em>openwrt-ipq40xx-R9.11.23-p2w_r619ac-squashfs-nand-sysupgrade.bin</em> ) ,然后点击更新即可。</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/18.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/18.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/19.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/19.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/20.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/20.png"></a><span></span></div></div><ol start="3"><li>浏览器重新访问 <strong>192.168.1.1</strong> ,如果访问的是 OpenWrt 的登录界面即表示更新完成。</li></ol><blockquote><p>注意: 密码默认是 <strong>password</strong></p></blockquote><ol start="4"><li>输入密码登录成后即可进入 OpenWrt 的主界面</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/21.png" alt="image"/></div></div><ol start="5"><li>建议执行一次重置。</li></ol><p>「 <strong>系统</strong> 」 -> 「 <strong>备份/升级</strong> 」</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/22.png" alt="image"/></div></div><p>「 <strong>执行重置</strong> 」</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/23.png" alt="image"/></div></div><p>确认重置</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/24.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/24.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/25.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/25.png"></a><span></span></div></div><p>重置完后浏览器会重新回到 OpenWrt 的登录界面。</p><h2 id="美化-OpenWrt-的管理界面"><a href="#美化-OpenWrt-的管理界面" class="headerlink" title="美化 OpenWrt 的管理界面"></a>美化 OpenWrt 的管理界面</h2><p>默认的 OpenWrt 主题很是复古,这里我要介绍的是我很喜欢的一个主题,名字叫做 <em>luci-theme-argon</em></p><h3 id="操作实例-2"><a href="#操作实例-2" class="headerlink" title="操作实例"></a>操作实例</h3><ol><li><p><a href="https://github.com/jerrykuku/luci-theme-argon/releases">点击此处</a>跳转到主题包release页面,下载最新版本的 <code>*.ipk</code> 文件即可</p></li><li><p>重新接受路由器的密钥</p></li></ol><blockquote><p><strong>注意</strong>: 因为路由器前面经过重置,所以路由器的密钥会发生改变,所以我们需要在电脑上执行 ssh-keygen -R <em>hostname_or_ip</em> 来移除原有属于路由器的密钥,当再次连接路由器时重新接受路由器的密钥即可。如果不执行此操作将无法建立连接。</p></blockquote><p>使用 <strong>man ssh-keygen</strong> 命令可以查看下ssh-keygen命令的详细用法:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">名称</span><br><span class="line"> ssh-keygen - 生成、管理和转换认证密钥</span><br><span class="line">............................................................</span><br><span class="line">............................................................ </span><br><span class="line"> -R hostname</span><br><span class="line"> 从 known_hosts 文件中删除所有属于 hostname 的密钥。</span><br><span class="line"> 这个选项主要用于删除经过散列的主机(参见 -H 选项)的密钥</span><br><span class="line">...........................................................</span><br><span class="line">...........................................................</span><br></pre></td></tr></table></figure><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">[eric@<span class="built_in">arch</span> ~]$ ssh-keygen -R 192.168.1.1</span><br><span class="line"><span class="comment"># Host 192.168.1.1 found: line 8</span></span><br><span class="line">/home/eric/.ssh/known_hosts updated.</span><br><span class="line">Original contents retained as /home/eric/.ssh/known_hosts.old</span><br></pre></td></tr></table></figure><ol start="3"><li>将主题包文件复制到路由器,电脑上打开终端模拟器,执行以下命令:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">[eric@<span class="built_in">arch</span> ~]$ scp <span class="string">'/home/eric/Downloads/luci-theme-argon_1.3-01-20191111_all.ipk'</span> [email protected]:/tmp</span><br><span class="line">The authenticity of host <span class="string">'192.168.1.1 (192.168.1.1)'</span> can<span class="string">'t be established.</span></span><br><span class="line"><span class="string">RSA key fingerprint is SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.</span></span><br><span class="line"><span class="string">Are you sure you want to continue connecting (yes/no/[fingerprint])? yes</span></span><br><span class="line"><span class="string">Warning: Permanently added '</span>192.168.1.1<span class="string">' (RSA) to the list of known hosts.</span></span><br><span class="line"><span class="string">[email protected]'</span>s password: </span><br><span class="line">luci-theme-argon_1.3-01-20191111_all.ipk 100% 1138KB 2.9MB/s 00:00</span><br></pre></td></tr></table></figure><ol start="4"><li>登录到路由器:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">[eric@<span class="built_in">arch</span> ~]$ ssh [email protected]</span><br><span class="line">[email protected]<span class="string">'s password: </span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string">BusyBox v1.30.0 () built-in shell (ash)</span></span><br><span class="line"><span class="string"></span></span><br><span class="line"><span class="string"> _______ ________ __</span></span><br><span class="line"><span class="string"> | |.-----.-----.-----.| | | |.----.| |_</span></span><br><span class="line"><span class="string"> | - || _ | -__| || | | || _|| _|</span></span><br><span class="line"><span class="string"> |_______|| __|_____|__|__||________||__| |____|</span></span><br><span class="line"><span class="string"> |__| W I R E L E S S F R E E D O M</span></span><br><span class="line"><span class="string"> -----------------------------------------------------</span></span><br><span class="line"><span class="string"> OpenWrt SNAPSHOT, r1673-ea47656</span></span><br><span class="line"><span class="string"> -----------------------------------------------------</span></span><br><span class="line"><span class="string">root@OpenWrt:~# </span></span><br></pre></td></tr></table></figure><ol start="4"><li>使用 opkg 安装主题包 luci-theme-argon</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">root@OpenWrt:~<span class="comment"># opkg install /tmp/luci-theme-argon_1.3-01-20191111_all.ipk</span></span><br><span class="line">Installing luci-theme-argon (1.3-01-20191111) to root...</span><br><span class="line">Configuring luci-theme-argon.</span><br><span class="line">uci: Entry not found</span><br><span class="line">uci: Entry not found</span><br><span class="line">uci: Entry not found</span><br><span class="line">root@OpenWrt:~<span class="comment"># </span></span><br></pre></td></tr></table></figure><p>这个时候再用浏览器访问 <strong>192.168.1.1</strong> ,就已经是应用了新主题啦。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/26.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/26.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/cover.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/cover.png"></a><span></span></div></div><p>到这里教程也算是结束了,后续的配置就与本教程无关了。</p><h2 id="后续更新(OpBoot-1-0-9-128-MB-OpenWrt)"><a href="#后续更新(OpBoot-1-0-9-128-MB-OpenWrt)" class="headerlink" title="后续更新(OpBoot 1.0.9 + 128 MB OpenWrt)"></a>后续更新(OpBoot 1.0.9 + 128 MB OpenWrt)</h2><overflow><table><thead><tr><th align="center">文件名</th><th align="center">md5sum</th><th align="center">描述</th><th align="center">下载</th></tr></thead><tbody><tr><td align="center"><code>opboot-p2w-r619ac-flash-v1.0.9.bin</code></td><td align="center">c7d6d14b04d055bf27dad9d9c5d58c7d</td><td align="center">OpBoot 文件,用命令刷入</td><td align="center"><a href="https://github.com/ericclose/r619ac-opboot-and-openwrt-flashing/raw/master/128MB/opboot-p2w-r619ac-flash-v1.0.9.bin">链接</a></td></tr><tr><td align="center"><code>opboot-p2w-r619ac-nor-v1.0.9.img</code></td><td align="center">1eec34ed68043cc601b9a0225a1a3502</td><td align="center">OpBoot 文件,在 OpBoot 里更新刷入</td><td align="center"><a href="https://github.com/ericclose/r619ac-opboot-and-openwrt-flashing/raw/master/128MB/opboot-p2w-r619ac-nor-v1.0.9.img">链接</a></td></tr><tr><td align="center"><code>openwrt-ipq40xx-p2w_r619ac-128MB-squashfs-nand-factory.ubi</code></td><td align="center">0083bbf4b6a5eaf1beb896518f4d6057</td><td align="center">OpenWrt 固件,在 OpBoot 里刷入</td><td align="center"><a href="https://github.com/ericclose/r619ac-opboot-and-openwrt-flashing/raw/master/128MB/openwrt-ipq40xx-p2w_r619ac-128MB-squashfs-nand-factory.ubi">链接</a></td></tr></tbody></table></overflow><ul><li>MEGA 网盘下载链接: <a href="https://mega.nz/#F!hVgXjACA!CISFW8tyoKLCWs6RbC23LQ">https://mega.nz/#F!hVgXjACA!CISFW8tyoKLCWs6RbC23LQ</a></li></ul><blockquote><p><strong>推荐</strong> 使用梯子在 MEGA 网盘下载相关文件,当然您也可以直接点击表格中的链接下载。</p></blockquote><h3 id="OpBoot-升级说明"><a href="#OpBoot-升级说明" class="headerlink" title="OpBoot 升级说明"></a>OpBoot 升级说明</h3><p>竞斗云 2.0 的 NAND 闪存大小是 128 MB,但前期的 OpBoot 仅支持 64 MB 大小,相应的 OpenWrt 固件也是 64 MB 的,也就是说实际可用的空间仅 64 MB。自从 OpBoot 升级至 1.0.9 之后即可支持竞斗云 2.0 的 128 MB 的 NAND 闪存。</p><blockquote><p>注意: 切勿混刷 <strong>opboot-p2w-r619ac-flash-v1.0.9.bin</strong> 和 <strong>opboot-p2w-r619ac-nor-v1.0.9.img</strong>,xxxflashxxx.bin 那个仅通过命令刷入,xxxnorxxx.img 那个则通过 OpBoot 内置的更新功能刷入。自己选错刷入固件后果自负~</p></blockquote><p>下面是更新到 OpBoot 1.0.9 的步骤说明 (有 2 种方法) :</p><h4 id="方法-1"><a href="#方法-1" class="headerlink" title="方法 1"></a>方法 1</h4><p>使用前面通过 scp 命令将 OpBoot 1.0.9 固件 ( <strong>opboot-p2w-r619ac-flash-v1.0.9.bin</strong> ) 上传至路由器的 <em>/tmp</em> 目录下,ssh 登录到路由器的 shell 然后执行下面的命令刷入即可(事前 <strong>请先校验</strong> 文件的md5值是否匹配):</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@OpenWrt:~<span class="comment"># mtd -r write /tmp/opboot-p2w-r619ac-flash-v1.0.9.bin Bootloader</span></span><br></pre></td></tr></table></figure><h4 id="方法-2"><a href="#方法-2" class="headerlink" title="方法 2"></a>方法 2</h4><p>您也可以通过 OpBoot 内置的更新功能刷入 <strong>opboot-p2w-r619ac-nor-v1.0.9.img</strong> 。通过如下操作刷入:</p><p>首先让路由器进入 OpBoot (怎么进入就不多说了,自己翻一翻前面的描述),然后点击 OpBoot 的右上角的 「 <strong>高级功能</strong> 」 -> 「 <strong>更新OpBoot</strong> 」 ,找到 <strong>opboot-p2w-r619ac-nor-v1.0.9.img</strong> 更新即可。</p><h3 id="OpenWrt-128-MB-分区固件刷入说明"><a href="#OpenWrt-128-MB-分区固件刷入说明" class="headerlink" title="OpenWrt 128 MB 分区固件刷入说明"></a>OpenWrt 128 MB 分区固件刷入说明</h3><p>经过前面刷入 OpBoot 1.0.9 之后,您就可以刷入 128 MB 分区的 OpenWrt 了。更新 128 MB 的固件后,你就可以使用之前 64 MB 分区的固件所无法利用的空间了,也就是说你可以用更多的空间装路由器的插件啦。</p><p>因为需要重建 ubi 分区,所以更新过程需要通过 OpBoot 1.0.9 版本刷入 ubi 固件 ( 即 <strong>openwrt-ipq40xx-p2w_r619ac-128MB-squashfs-nand-factory.ubi</strong> )</p><p>所以你只需要让路由器进入 OpBoot ,然后直接选择 128 MB 分区的 ubi 固件更新就完成了。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/27.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/27.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/28.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/r619ac-opboot-and-openwrt-flashing/28.png"></a><span></span></div></div><h2 id="鸣谢"><a href="#鸣谢" class="headerlink" title="鸣谢"></a>鸣谢</h2><p>最后,得在此感谢 <a href="https://github.com/Mleaf">mleaf</a> 大佬提供的 <em>OpBoot</em> 和 <a href="https://github.com/coolsnowwolf">lean</a> 大佬提供的 <em>OpenWrt</em> 固件,同时我还要感谢那些我参考的文章作者。如果没有他们的努力成果,也就没有这篇文章的诞生啦</p><p>参考链接: </p><ol><li><a href="https://mp.weixin.qq.com/s/Oru2HGJpQMu4k9vgsuZ-VA">竞斗云2.0(R619AC)OpBoot1.0.6刷机教程</a></li><li><a href="https://web.archive.org/web/20210516031035/https://hyejeong.cn/gdockflash">【Router】G-DOCK 竞斗云2.0 小白刷机教程</a></li></ol>]]></content>
<categories>
<category> Router </category>
</categories>
<tags>
<tag> 竞斗云 </tag>
<tag> R619AC </tag>
<tag> OpenWrt </tag>
<tag> OpBoot </tag>
<tag> 刷机 </tag>
<tag> 固件 </tag>
</tags>
</entry>
<entry>
<title>在 VMware Workstation 上 安装 Arch Linux ( UEFI + GPT )</title>
<link href="/Installing-Arch-as-a-guest-with-UEFI-and-GPT.html"/>
<url>/Installing-Arch-as-a-guest-with-UEFI-and-GPT.html</url>
<content type="html"><![CDATA[<blockquote><p>以下使用 VMware Workstation 来安装 Arch Linux,全程以图解方式来讲解Arch Linux安装的过程。</p></blockquote><span id="more"></span><h2 id="下载-Arch-Linux-的镜像文件"><a href="#下载-Arch-Linux-的镜像文件" class="headerlink" title="下载 Arch Linux 的镜像文件"></a>下载 Arch Linux 的镜像文件</h2><p>下载链接:<a href="https://archlinux.org/download/">https://archlinux.org/download/</a></p><h2 id="下载-VMware-Workstation"><a href="#下载-VMware-Workstation" class="headerlink" title="下载 VMware Workstation"></a>下载 VMware Workstation</h2><p>下载链接:<a href="https://download3.vmware.com/software/wkst/file/VMware-workstation-full-15.5.0-14665864.exe">https://download3.vmware.com/software/wkst/file/VMware-workstation-full-15.5.0-14665864.exe</a></p><blockquote><p>注意:该软件为商业付费软件,请自行购买许可。(当然如果没有钱钱的话,去网上搜索 <del>VMware Workstation 15 Pro永久激活密钥</del> 即可。小声~</p></blockquote><blockquote><p>本文假定您已下载完 Arch Linux 的镜像文件以及安装和激活了 VMware Workstation。</p></blockquote><h2 id="VMware-Workstation-配置"><a href="#VMware-Workstation-配置" class="headerlink" title="VMware Workstation 配置"></a>VMware Workstation 配置</h2><ol><li>「 <strong>创建新的虚拟机</strong> 」</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/1.png" alt="image"/></div></div><ol start="2"><li>「 <strong>典型安装</strong> 」 > 「 <strong>下一步</strong> 」</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/2.png" alt="image"/></div></div><ol start="3"><li>「 <strong>安装光盘映像文件</strong> 」 > 「 <strong>浏览</strong> 」找到下载好的镜像文件 > 「 <strong>下一步</strong> 」</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/3.png" alt="image"/></div></div><ol start="4"><li>「 <strong>Linux</strong> 」 > 选择「 <strong>版本</strong> 」,「 <strong>其他Linux 5.x或更高版本内核64位</strong> 」 > 「 <strong>下一步</strong> 」</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/4.png" alt="image"/></div></div><ol start="5"><li>修改「 <strong>虚拟机名称</strong> 」 > 「 <strong>下一步</strong> 」</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/5.png" alt="image"/></div></div><ol start="6"><li>「 <strong>最大磁盘大小</strong> 」设为 <strong>40 GB</strong> > 「 <strong>将虚拟硬盘存储为单个文件</strong> 」,有助于提高运行性能 > 「 <strong>下一步</strong> 」</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/6.png" alt="image"/></div></div><ol start="7"><li>「 <strong>自定义硬件</strong> 」 > 「 <strong>内存</strong> 」 > 「 <strong>虚拟机内存大小</strong> 」设为 <strong>3072 MB</strong> 。 (我实体机内存大小 8 GB,所以虚拟机给个 3 GB还是可以的)</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/7.png" alt="image"/></div></div><ol start="8"><li><p>「 <strong>显示</strong> 」 > 「 <strong>加速3D图形</strong> 」</p></li><li><p>「 <strong>处理器数量(number of processors)</strong> 」 和 「 <strong>每个处理器的核心数量(number of cores per processor)</strong> 」的选择。</p></li></ol><ul><li>处理器数量:指 <strong>物理核心数</strong> 。</li><li>每个处理的核心数量:指每个物理核心数所拥有的 <strong>逻辑核心数</strong> 。</li><li>处理器核心总数 (total processor cores):前面两者之积。</li></ul><p>与平常所说的处理器是x核x线程的关系如图:</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/8.png" alt="image"/></div></div><p>正如我电脑的处理器是 <strong>Intel(R) Core(TM) i5-8250U</strong> ,是4核8线程的。</p><p>那么现在问题来了,「 <strong>处理器数量</strong> 」 和 「 <strong>每个处理器的核心数量</strong> 」该怎么填写呢。</p><blockquote><ol><li>如果配置与物理机相同的总核数,其性能可达到90%左右;</li><li>总核数相同的情况下,处理器数量分配越少,每个处理器的核心数越多,虚拟机的单处理器性能会显著提高,但是总性能会有所下降;</li><li>反之,处理器数量分配越多,每个处理器的核心数越少,虚拟机的单处理器性能会有所下降,但是总性能会有所提升。</li></ol></blockquote><blockquote><p>想要看相关细节,请看引用的内容来源:<a href="https://www.jianshu.com/p/da8443f482e9">https://www.jianshu.com/p/da8443f482e9</a></p></blockquote><p>综上所述,只要「 <strong>处理器核心总数</strong> 」与物理机具有相同的总核数就可以达到可观的性能,所以我这里「 <strong>处理器数量</strong> 」 和 「 <strong>每个处理器的核心数量</strong> 」的值分别设置为 <strong>4</strong> 和 <strong>2</strong> 。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/9.png" alt="image"/></div></div><ol start="10"><li>「 <strong>虚拟机</strong> 」 > 「 <strong>设置</strong> 」</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/10.png" alt="image"/></div></div><ol start="11"><li>「 <strong>选项</strong> 」 > 「 <strong>高级</strong> 」> 「 <strong>UEFI</strong> 」 > 「 <strong>OK</strong> 」</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/11.png" alt="image"/></div></div><ol start="12"><li>至此,VMware Workstation 的配置告一段落。</li></ol><h3 id="开启虚拟机"><a href="#开启虚拟机" class="headerlink" title="开启虚拟机"></a>开启虚拟机</h3><ol><li>开机,UEFI 成功启动以后像这样</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/12.png" alt="image"/></div></div><p>直接选择第一项「 <strong>Arch Linux archiso x86_64 UEFI CD</strong> 」,回车即可</p><ol start="2"><li>然后等待一会以后,出现</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/13.png" alt="image"/></div></div><p>这就是说已经正常启动到 Arch Linux 的 Live CD 环境啦。</p><h2 id="安装-Arch-Linux-的全过程"><a href="#安装-Arch-Linux-的全过程" class="headerlink" title="安装 Arch Linux 的全过程"></a>安装 Arch Linux 的全过程</h2><h3 id="联网"><a href="#联网" class="headerlink" title="联网"></a>联网</h3><ol><li>确保系统已经启用了网络接口,用 <strong>ip link</strong> 检查</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># ip link</span></span><br></pre></td></tr></table></figure><ol start="2"><li>使用 <strong>dhcpcd</strong> 联网</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># dhcpcd</span></span><br></pre></td></tr></table></figure><ol start="3"><li>确保联网,能 ping 通 <strong>baidu.com</strong> 即可(百度最佳的作用就是测试网络是否可用了,其他的没啥了,ε=ε=ε=┏(゜ロ゜;)┛ 逃)。VMware Workstation 默认使用 NAT,只要宿主机能联网,通常虚拟机内也可以直接联网的。用 ping 检查网络连接</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># ping -c 4 baidu.com</span></span><br></pre></td></tr></table></figure><blockquote><p><strong>-c</strong> 选项:用于指定 ping 的次数</p></blockquote><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/14.png" alt="image"/></div></div><h3 id="时间同步"><a href="#时间同步" class="headerlink" title="时间同步"></a>时间同步</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># timedatectl set-ntp true</span></span><br></pre></td></tr></table></figure><p>正确的(误差之内的)时间在验证连接或证书的可信程度时非常重要,例如 HTTPS 和 GnuPG 都需要准确的时间来验证证书的有效性。</p><h3 id="准备磁盘分区"><a href="#准备磁盘分区" class="headerlink" title="准备磁盘分区"></a>准备磁盘分区</h3><h4 id="分区示例"><a href="#分区示例" class="headerlink" title="分区示例"></a>分区示例</h4><p>本文只针对 UEFI with GPT 启动方式,并基于最简单的硬盘结构,采用最简单的分区策略。(其中 SWAP 分区可选,我这里 SWAP 的大小就直接是虚拟机内存大小乘以2)</p><p><strong>UEFI with GPT</strong></p><overflow><table><thead><tr><th align="center">挂载点</th><th align="center">分区</th><th align="center">分区类型</th><th align="center">大小</th></tr></thead><tbody><tr><td align="center"><code>/mnt/boot</code></td><td align="center"><code>/dev/sda1</code></td><td align="center">EFI system partition</td><td align="center">512 MiB</td></tr><tr><td align="center">[<code>SWAP</code>]</td><td align="center"><code>/dev/sda2</code></td><td align="center">Linux swap (交换空间)</td><td align="center">6 GiB</td></tr><tr><td align="center"><code>/mnt</code></td><td align="center"><code>/dev/sda3</code></td><td align="center">Linux x86-64 根目录 (<code>/</code>)</td><td align="center">剩余空间</td></tr></tbody></table></overflow><h4 id="fdisk-和-分区操作"><a href="#fdisk-和-分区操作" class="headerlink" title="fdisk 和 分区操作"></a>fdisk 和 分区操作</h4><ol><li>显示所有分区</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># fdisk -l</span></span><br></pre></td></tr></table></figure><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/15.png" alt="image"/></div></div><p>其中 <strong>/dev/sda</strong> 是虚拟机上的硬盘</p><ol start="2"><li>开始分区</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># fdisk /dev/sda</span></span><br></pre></td></tr></table></figure><p>进入分区程序。输入 <strong>m</strong> 可以查看 fdisk 的帮助。在决定写入之前,所有的更改都不会被保存。</p><ul><li>按照上面描述的分区示例,我们输入 <strong>g</strong> 新建一个 空的 GPT 分区表;</li><li>输入 <strong>n</strong> 建立第一个分区,首先会问你选择分区号(默认是可用的最小分区号), <strong>回车</strong> 即可;</li><li>不用填写 first sector(默认值为可用的最小扇区号),直接 <strong>回车</strong> ,在提示输入 last sector 的时候输入 <strong>+512M</strong> 来依据分区大小自动计算终止扇区。</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/16.png" alt="image"/></div></div><p>完成上图的操作后即得到一个512 MB 大小的分区。</p><p>重复上面的步骤,再建立一个 6 GB 大小(或你自己决定 SWAP 分区的大小,当然你也可以不创建 SWAP 分区)的分区;最后重复上面的步骤,但最后一次不填写 last sector 从而自动将所有的剩余空间划分给第三个分区。如下图:</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/17.png" alt="image"/></div></div><ol start="3"><li>修改分区类型</li></ol><p>按 <strong>t</strong> ,会询问需要修改的分区号,然后则是询问你要修改的类型(按 L 会列出各个分区类型的编号),编号 <strong>1</strong> 是 <strong>EFI System Partition</strong> ,编号 <strong>19</strong> 是 <strong>swap</strong> ,分区3的类型不做修改(默认的分区类型是 Linux Filesystem)。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/18.png" alt="image"/></div></div><blockquote><p><strong>注意</strong> :最后要让建立的分区生效,需要输入 <strong>w</strong> 把分区表写入磁盘</p></blockquote><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/19.png" alt="image"/></div></div><ol start="4"><li>显示 <strong>/dev/sda</strong> 上的分区(确认是否生效 )</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># fdisk -l /dev/sda</span></span><br></pre></td></tr></table></figure><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/20.png" alt="image"/></div></div><h4 id="格式化分区-和-设置-swap-分区"><a href="#格式化分区-和-设置-swap-分区" class="headerlink" title="格式化分区 和 设置 swap 分区"></a>格式化分区 和 设置 swap 分区</h4><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># mkfs.fat -F32 /dev/sda1</span></span><br><span class="line">root@archiso ~ <span class="comment"># mkswap /dev/sda2</span></span><br><span class="line">root@archiso ~ <span class="comment"># mkfs.ext4 /dev/sda3</span></span><br></pre></td></tr></table></figure><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/21.png" alt="image"/></div></div><blockquote><p>Linux 对磁盘分区的命名也很直观。设备 <strong>/dev/sda</strong> 上的第一个分区就是 <strong>/dev/sda1</strong> ,第二个分区就是 <strong>/dev/sda2</strong> ,以此类推。</p></blockquote><p>在上面的指令第一句中,我们为 <strong>/dev/sda1</strong> 分区,也就是 sda 磁盘的第一块分区,建立了 fat 文件系统;**-F32** 表明我们建立的是 fat32 而非 fat16 或其它不是我们想要的 fat。</p><blockquote><p>UEFI规范要求对FAT12,FAT16和FAT32文件系统的支持,但是任何符合条件的供应商都可以选择添加对其他文件系统的支持。 例如,Apple macOS 中的固件支持 HFS+ 文件系统。</p></blockquote><p>而在第二句中,我们为 /dev/sda2 创建了专用于 swap 的存储系统;这是一个特殊的分区类型,它很难被当作 filesystem,所以建立它的指令是 mkswap 而非 mkfs.* 。</p><h4 id="启用交换分区-和-文件系统的挂载"><a href="#启用交换分区-和-文件系统的挂载" class="headerlink" title="启用交换分区 和 文件系统的挂载"></a>启用交换分区 和 文件系统的挂载</h4><ol><li>启用交换分区</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># swapon /dev/sda2</span></span><br></pre></td></tr></table></figure><p>可以使用 <strong>swapon –show</strong> 来检查交换分区有没有被正确启用。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/22.png" alt="image"/></div></div><ol start="2"><li>然后挂载整个新系统的根,这里我们将它挂载到 Arch ISO 环境的 <strong>/mnt</strong> 下。不要担心,Linux 有一个实用工具 chroot,可以将目录结构的任意点作为新的根。</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># mount /dev/sda3 /mnt</span></span><br></pre></td></tr></table></figure><ol start="3"><li>按照我们对新系统目录结构的理解,**/dev/sda1** 应该被挂载于新系统的 <strong>/boot</strong> ,也就是 Arch ISO 环境的 <strong>/mnt/boot</strong> 。但是这个目录目前仍不存在,所以我们手动创建这个挂载点,然后再进行挂载。</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># mkdir /mnt/boot</span></span><br><span class="line">root@archiso ~ <span class="comment"># mount /dev/sda1 /mnt/boot</span></span><br></pre></td></tr></table></figure><h3 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h3><h4 id="选择镜像源"><a href="#选择镜像源" class="headerlink" title="选择镜像源"></a>选择镜像源</h4><p>文件 <strong>/etc/pacman.d/mirrorlist</strong> 定义了软件包会从哪个 <strong>镜像源</strong> 下载。在 LiveCD 启动的系统上,所有的镜像源都被启用。</p><p>在 <strong>列表中越前</strong> 的镜像源在下载软件包时有 <strong>越高的优先权</strong> 。</p><p>这个文件接下来还会被 <em>pacstrap</em> 复制到新系统里,所以请确保正确设置。</p><blockquote><p><strong>注意</strong> :以下需要用到 <em>vim</em> 这个编辑器,建议先去自行学习一下 <em>vim</em> 的基本使用,不然我怕新手碰到这个编辑器会一脸懵逼,后面还会涉及到 <em>vim</em> 的相关操作哦。</p></blockquote><ol><li>vim 编辑 <strong>/etc/pacman.d/mirrorlist</strong></li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># vim /etc/pacman.d/mirrorlist</span></span><br></pre></td></tr></table></figure><p>执行完上行命令后,键入 <strong>:set nu</strong> ,然后 <strong>回车</strong> 即显示行号,如图:</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/23.png" alt="image"/></div></div><p>然后继续键入 <strong>/China</strong> ,然后 <strong>回车</strong> 搜索中国的源,光标会跳到相应字符串的行。如图:</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/24.png" alt="image"/></div></div><p>键入 <strong>V</strong> (注意是 <strong>大写</strong> 的 <strong>V</strong> ,后面的相应字母都要认清楚大小写) 并移动光标进行选择,选中上图用红框括起来的2行,然后按 <strong>d</strong> 进行剪切,再按 <strong>6G</strong> 移动到文件的第 6 行,按 <strong>p</strong> 进行粘贴。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/25.png" alt="image"/></div></div><p>继续键入 <strong>:wq</strong> ,然后 <strong>回车</strong> ,即保存并退出。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/26.png" alt="image"/></div></div><h4 id="安装必须的软件包"><a href="#安装必须的软件包" class="headerlink" title="安装必须的软件包"></a>安装必须的软件包</h4><blockquote><p>使用 <em>pacstrap</em> 脚本,安装 <em>base</em> 软件包和 Linux 内核以及常规硬件的固件:</p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># pacstrap /mnt base linux linux-firmware</span></span><br></pre></td></tr></table></figure><blockquote><p>装完前面的东西,只是装完能做到开机的必须组件而已,但还有一些必备的东西要装,比如说网络管理器 <em>NetworkManager</em> , <em>NetworkManager</em> 是检测网络、自动连接网络的程序。无论是无线还是有线连接,它都可以令您轻松管理。这一步也是必备的一步:</p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># pacstrap /mnt networkmanager</span></span><br></pre></td></tr></table></figure><h3 id="配置系统"><a href="#配置系统" class="headerlink" title="配置系统"></a>配置系统</h3><h4 id="生成-fstab-文件"><a href="#生成-fstab-文件" class="headerlink" title="生成 fstab 文件"></a>生成 fstab 文件</h4><p><strong>fstab</strong> 文件可用于定义磁盘分区,包括各种块设备或者远程文件系统应该如何装入到文件系统。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># genfstab -U /mnt >> /mnt/etc/fstab</span></span><br></pre></td></tr></table></figure><p><strong>-U</strong> 选项指的是 使用UUID作为源标识符</p><h4 id="arch-chroot"><a href="#arch-chroot" class="headerlink" title="arch-chroot"></a>arch-chroot</h4><blockquote><p><strong>arch-chroot</strong> bash 脚本是软件包 <a href="https://archlinux.org/packages/?name=arch-install-scripts">arch-install-scripts</a> 的一部分,在运行 <strong>/usr/bin/chroot</strong> 前,这个脚本会挂载 <strong>/proc</strong> api 文件系统,建立可用的 <strong>/etc/resolv.conf</strong> 。</p></blockquote><p>前文中提到过,<em>chroot</em> 工具能指定目录结构任意的位置为新的根;由于我们需要进行的配置应该在新系统上完成,所以我们应该 <em>chroot</em> 到新系统的根,也就是 /mnt。不过这里我们不是直接就使用 <em>chroot</em> ,而是通过镜像里提供的 <strong>arch-chroot</strong> 来完成额外的配置。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># arch-chroot /mnt</span></span><br></pre></td></tr></table></figure><h4 id="设置时区"><a href="#设置时区" class="headerlink" title="设置时区"></a>设置时区</h4><blockquote><p>中国的时区是 <em>Asia/Shanghai</em></p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime</span></span><br></pre></td></tr></table></figure><blockquote><p>您可以使用以下命令将硬件时钟设置为当前系统时间:</p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># hwclock --systohc</span></span><br></pre></td></tr></table></figure><h4 id="在新安装的系统上安装-vim-编辑器"><a href="#在新安装的系统上安装-vim-编辑器" class="headerlink" title="在新安装的系统上安装 vim 编辑器"></a>在新安装的系统上安装 vim 编辑器</h4><blockquote><p><strong>Vim</strong> 是从 <strong>vi</strong> 发展出来的一个文本编辑器。其代码补全、编译及错误跳转等方便编程的功能特别丰富,在程序员中被广泛使用。和 <strong>Emacs</strong> 并列成为类Unix系统用户最喜欢的编辑器。</p></blockquote><p>这里我们安装 <strong>vim</strong> :</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># pacman -S vim</span></span><br></pre></td></tr></table></figure><p><strong>Y</strong> 确认安装即可。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/27.png" alt="image"/></div></div><h4 id="本地化"><a href="#本地化" class="headerlink" title="本地化"></a>本地化</h4><blockquote><p><strong>/etc/locale.gen</strong> 是一个仅包含注释文档的文本文件。指定您需要的本地化类型,去掉对应行前面的注释符号(#)就可以啦,还是用 vim 来编辑,建议选择 <strong>en_US.UTF-8 UTF-8</strong> 的项:</p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># vim /etc/locale.gen</span></span><br></pre></td></tr></table></figure><p>找到 <strong>#en_US.UTF-8 UTF-8</strong> 这一行,光标移动到开头的 “#” ,然后键入 <strong>x</strong> ,再键入 <strong>:wq</strong> 保存并退出即可。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/28.png" alt="image"/></div></div><p>接着执行 <strong>locale-gen</strong> 以生成 locale 讯息:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># locale-gen</span></span><br></pre></td></tr></table></figure><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/29.png" alt="image"/></div></div><p>创建 <strong>locale.conf</strong> 文件,并相应地设置 <em>LANG</em> 变量:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># echo LANG=en_US.UTF-8 > /etc/locale.conf</span></span><br></pre></td></tr></table></figure><h4 id="网络配置"><a href="#网络配置" class="headerlink" title="网络配置"></a>网络配置</h4><ol><li>创建 <strong>hostname</strong> 文件:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># echo YourNewHostname > /etc/hostname</span></span><br></pre></td></tr></table></figure><blockquote><p><strong>注意</strong>:<em>YourNewHostname</em> 是你要设置的主机名,名字任取。后面如果还出现,也指的是你取的主机名。</p></blockquote><ol start="2"><li>添加对应的信息到 <strong>hosts</strong> :</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># vim /etc/hosts</span></span><br></pre></td></tr></table></figure><p>键入 <strong>i</strong> 进入插入模式,编辑后得到的内容如下:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Static table lookup for hostnames.</span></span><br><span class="line"><span class="comment"># See hosts(5) for details.</span></span><br><span class="line">127.0.0.1 localhost</span><br><span class="line">::1 localhost</span><br><span class="line">127.0.1.1 YourNewHostname.localdomain YourNewHostname</span><br></pre></td></tr></table></figure><p>填写完成后就键入 <strong>Esc</strong> 键,退回命令模式,再键入 <strong>:wq</strong> 保存并退出。</p><ol start="3"><li><em>NetworkManager</em> 服务</li></ol><ul><li>将 <em>NetworkManager</em> 服务设为开机自启:</li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># systemctl enable NetworkManager</span></span><br></pre></td></tr></table></figure><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/30.png" alt="image"/></div></div><h4 id="设置-root-用户密码"><a href="#设置-root-用户密码" class="headerlink" title="设置 root 用户密码"></a>设置 root 用户密码</h4><p>执行 passwd 命令修改当前用户(即 root 用户)的密码。</p><blockquote><p><strong>注意</strong> :密码输入时不可见,反正输入完后只管回车就行,第二次输入密码是系统要你确认密码。</p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># passwd</span></span><br><span class="line">New password:</span><br><span class="line">Retype new password:</span><br><span class="line">passwd: password updated successfully</span><br></pre></td></tr></table></figure><h4 id="安装引导程序"><a href="#安装引导程序" class="headerlink" title="安装引导程序"></a>安装引导程序</h4><blockquote><p>启动加载器是 BIOS 或 UEFI 启动的第一个程序。它负责使用正确的内核参数加载内核, 并根据配置文件加载初始化 RAM disk。</p></blockquote><blockquote><p><strong>注意</strong> :这一步相当重要,如果没有配置正确的话,你重启后将无法正常启动到系统。</p></blockquote><blockquote><p>systemd-boot (以前被称为gummiboot) 是可以执行 EFI 镜像文件的简单 UEFI 启动管理器。启动的内容可以通过一个配置(glob)或者屏幕菜单选择。Arch 默认安装的 systemd 提供了这个功能。配置很简单,但是只能启动 EFI 可执行程。</p></blockquote><ol><li>安装 EFI 启动管理器</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># bootctl --path=/boot install</span></span><br></pre></td></tr></table></figure><blockquote><p><strong>–path=</strong> 后面接的就是我们一开始创建的 esp (EFI system partition) 的挂载路径</p></blockquote><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/31.png" alt="image"/></div></div><ol start="2"><li>基本配置</li></ol><p>基本设置保存在 <strong>/boot/loader/loader.conf</strong> ,有三个选项:</p><ul><li>default – 默认加载的配置文件 (不含 .conf 后缀)。</li><li>timeout – 启动选单的超时时间,如果不设置的话,启动选单只有在按键时才显示。</li><li>editor - 是否允许用户编辑内核参数. yes 是允许, no 是阻止。</li></ul><p>用 vim 编辑 <strong>/boot/loader/loader.conf</strong> :</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># vim /boot/loader/loader.conf</span></span><br></pre></td></tr></table></figure><p>下面是我编辑好的 <strong>/boot/loader/loader.conf</strong> ,内容如下:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">default arch</span><br><span class="line">timeout 4</span><br><span class="line">console-mode max</span><br><span class="line">editor no</span><br></pre></td></tr></table></figure><ol start="3"><li>添加启动选项</li></ol><p>前面我们不是已经在 <strong>/boot/loader/loader.conf</strong> 中的选项指定了一个 default 选项嘛,所以我们现在就来配置一下这个默认启动选项。</p><p>我们要编辑的配置文件是 <strong>/boot/loader/entries/arch.conf</strong> 同样也是用 vim 来编辑:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># vim /boot/loader/entries/arch.conf</span></span><br></pre></td></tr></table></figure><p>下面是我暂时编辑好的 <strong>/boot/loader/entries/arch.conf</strong> ,内容如下:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">title Arch Linux</span><br><span class="line">linux /vmlinuz-linux</span><br><span class="line">initrd /initramfs-linux.img</span><br><span class="line">options root=PARTUUID=</span><br></pre></td></tr></table></figure><p>保存并退出编辑后,我们执行一下这么一行命令:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># blkid -s PARTUUID -o value /dev/sda3 >> /boot/loader/entries/arch.conf</span></span><br></pre></td></tr></table></figure><p>上面的命令将会把根分区的UUID的值追加到 <strong>/boot/loader/entries/arch.conf</strong> 的最后一行。则文件 <strong>/boot/loader/entries/arch.conf</strong> 的内容现在为(<strong>注意</strong> :PARTUUID的值都是因人而异的):</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">title Arch Linux</span><br><span class="line">linux /vmlinuz-linux</span><br><span class="line">initrd /initramfs-linux.img</span><br><span class="line">options root=PARTUUID=</span><br><span class="line">14420948-2cea-4de7-b042-40f67c618660</span><br></pre></td></tr></table></figure><p>最后一次用 vim 编辑 <strong>/boot/loader/entries/arch.conf</strong> ,完成编辑后的文件内容如下:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">title Arch Linux</span><br><span class="line">linux /vmlinuz-linux</span><br><span class="line">initrd /initramfs-linux.img</span><br><span class="line">options root=PARTUUID=14420948-2cea-4de7-b042-40f67c618660 rw</span><br></pre></td></tr></table></figure><h4 id="重启系统"><a href="#重启系统" class="headerlink" title="重启系统"></a>重启系统</h4><p>根据前面所有的步骤走完一遍,也算是配置好了,让我们重启吧:</p><p>首先 <strong>exit</strong> 退回到 Arch ISO 环境:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@archiso /]<span class="comment"># exit</span></span><br></pre></td></tr></table></figure><p>然后执行命令重启:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">root@archiso ~ <span class="comment"># systemctl reboot</span></span><br></pre></td></tr></table></figure><p>开机后会有个标题为 “Arch Linux” 的启动选项,即是我们之前添加的选项。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/32.png" alt="image"/></div></div><p>成功进入系统后,就会让你登陆了,当然一开始只有root用户,密码也是你之前设置的那个,输入密码的时候依然不会显示出来。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/33.png" alt="image"/></div></div><h3 id="可选配置"><a href="#可选配置" class="headerlink" title="可选配置"></a>可选配置</h3><h4 id="更新系统和软件包"><a href="#更新系统和软件包" class="headerlink" title="更新系统和软件包"></a>更新系统和软件包</h4><p>一个 <em>pacman</em> 命令就可以升级整个系统。花费的时间取决于系统有多老。这个命令会同步非本地(local)软件仓库并升级系统的软件包</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@<span class="built_in">arch</span> ~] <span class="comment"># pacman -Syu</span></span><br></pre></td></tr></table></figure><h4 id="用户与权限配置"><a href="#用户与权限配置" class="headerlink" title="用户与权限配置"></a>用户与权限配置</h4><blockquote><p>正经的 Linux 用户不会用 root 干所有的事情,如果这么做的话将会很危险。创建一个普通的用户,并让它可以通过 <em>sudo</em> 指令用 root 权限执行命令是一般的解决方案。</p></blockquote><ol><li>在用 <em>sudo</em> 之前,我们需要先安装 <strong>sudo</strong> 这个软件包:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@<span class="built_in">arch</span> ~] <span class="comment"># pacman -S sudo</span></span><br></pre></td></tr></table></figure><ol start="2"><li>配置 <strong>sudoers</strong></li></ol><p>执行 visudo 来修改 <strong>/etc/sudoers</strong> 文件。使用它的好处是,它会在保存时作语法检查,以避免错误的更改使 sudo 彻底不可用。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@<span class="built_in">arch</span> ~] <span class="comment"># EDITOR=vim visudo</span></span><br></pre></td></tr></table></figure><blockquote><p>此处通过环境变量 <em>EDITOR</em> 来声明使用 vim 来编辑文件,默认的情况下 visudo 是用 vi 来编辑的。(vi 和 vim 的用法略有不同)</p></blockquote><p>找到这一行:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"># %wheel ALL=(ALL) ALL</span><br></pre></td></tr></table></figure><p>去掉找到的那一行开头的注释,即 <strong>#</strong> 和 <strong>空格</strong> ,不要误删掉 <strong>%</strong> 哦。弄完之后保存即可,得:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">%wheel ALL=(ALL) ALL</span><br></pre></td></tr></table></figure><blockquote><p>去掉注释的作用:取消注释以允许 <em>wheel</em> 组成员执行任何命令。</p></blockquote><ol start="3"><li>添加一个 wheel 组普通用户</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@<span class="built_in">arch</span> ~] <span class="comment"># useradd -m -G wheel 你想要取的用户名</span></span><br></pre></td></tr></table></figure><blockquote><p>用户名必须是合法的。最简单的就是 <strong>不带空格的字母</strong> 和 <strong>数字</strong> 的组合。 <strong>-m</strong> 参数表示同时创建该用户的家目录,这会被默认置为 /home/用户名。 <strong>-G wheel</strong> 表示同时将该用户加入 wheel 用户组。</p></blockquote><ol start="4"><li>设置普通用户的密码</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[root@<span class="built_in">arch</span> ~] <span class="comment"># passwd 用户名</span></span><br></pre></td></tr></table></figure><p>完成上述操作之后,注销当前用户之后就可以登录我们新建的普通用户了。</p><p><strong>Ctrl</strong> + <strong>d</strong> 退出账户</p><ol start="5"><li>重新登陆你新建的普通账户。</li></ol><p>登录完你会发现,之前的用户名不是 <strong>root</strong> 而是我创建的一个叫做 <strong>admin</strong> 的用户, <strong>#</strong> 也变成了 <strong>$</strong> ,这就意味着这是普通用户。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/34.png" alt="image"/></div></div><h4 id="VMware-相关软件包和服务"><a href="#VMware-相关软件包和服务" class="headerlink" title="VMware 相关软件包和服务"></a>VMware 相关软件包和服务</h4><blockquote><p>安装 VMware Tools 是创建新的虚拟机过程的一部分,而升级 VMware Tools 是使虚拟机符合最新标准过程的一部分。尽管客户机操作系统在未安装 VMware Tools 的情况下仍可运行,但许多 VMware 功能只有在安装 VMware Tools 后才可用,如虚拟机显示器填满屏幕,宿主机和虚拟机之间拖拽或复制粘贴文件等。</p></blockquote><blockquote><ul><li><strong>open-vm-tools</strong> : VMware Tools 的开源实现</li></ul></blockquote><ol><li>安装 <strong>open-vm-tools</strong></li></ol><ul><li><strong>注意</strong> :如遇安装失败,请再试一次。</li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S open-vm-tools</span><br></pre></td></tr></table></figure><blockquote><ul><li><strong>vmtoolsd</strong> : 负责汇报虚拟机状态的服务</li><li><strong>vmware-vmblock-fuse</strong> : 文件系统实用程序。 通过FUSE(用户空间中的文件系统)实现宿主 / 虚拟机之间拖拽文件。</li></ul></blockquote><ol><li>将 <strong>vmtoolsd</strong> 和 <strong>vmware-vmblock-fuse</strong> 两个服务设为开机自启</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ systemctl <span class="built_in">enable</span> vmtoolsd vmware-vmblock-fuse</span><br></pre></td></tr></table></figure><blockquote><ul><li><strong>gtkmm3</strong> : 如要启用客户机的拖拽与复制粘贴功能,则需要安装 gtkmm3</li></ul></blockquote><ol start="3"><li>安装 <strong>gtkmm3</strong></li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S gtkmm3</span><br></pre></td></tr></table></figure><blockquote><ul><li><strong>xf86-input-vmmouse</strong> : VMWare鼠标输入驱动程序</li><li><strong>xf86-video-vmware</strong> : vmware显示驱动程序,如果想要让虚拟机显示器填满屏幕,就必须要安装这个软件包</li><li><strong>mesa</strong> : OpenGL规范的开源实现</li></ul></blockquote><ol start="4"><li>安装相关驱动</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S xf86-input-vmmouse xf86-video-vmware mesa</span><br></pre></td></tr></table></figure><h4 id="安装桌面环境"><a href="#安装桌面环境" class="headerlink" title="安装桌面环境"></a>安装桌面环境</h4><h5 id="显示服务"><a href="#显示服务" class="headerlink" title="显示服务"></a>显示服务</h5><blockquote><p><strong>X 窗口管理系统</strong> ( X11 或者 X ) 是基于网络的显示协议,提供了窗口功能,包含建立图形用户界面(GUI)的标准工具和协议。 <em>Xorg</em> 是 X 窗口的开源实现,提供图形用户界面。</p></blockquote><blockquote><p><strong>Wayland</strong> 是一种更新的可用显示服务协议, <em>Weston</em> 是其参考实现。</p></blockquote><p>这里我安装 <strong>xorg</strong> :</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S xorg</span><br></pre></td></tr></table></figure><h5 id="桌面环境"><a href="#桌面环境" class="headerlink" title="桌面环境"></a>桌面环境</h5><blockquote><p>尽管 <em>Xorg</em> 提供了用于构建图形环境的基本框架,但是为了获得完整的用户体验,可能还需要其他组件。 GNOME,KDE,LXDE 和 Xfce 等桌面环境将各种 X 客户端捆绑在一起,例如窗口管理器,面板,文件管理器,终端仿真器,文本编辑器,图标和其他实用程序。</p></blockquote><ul><li><strong>plasma-meta</strong> : 用以安装 KDE Plasma 的元软件包</li></ul><p>我个人偏好 kde,所以执行下面的命令:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S plasma-meta</span><br></pre></td></tr></table></figure><h5 id="显示管理器"><a href="#显示管理器" class="headerlink" title="显示管理器"></a>显示管理器</h5><blockquote><p>大多数桌面环境都包括一个显示管理器,用于自动启动图形环境和管理用户登录。</p></blockquote><blockquote><ul><li><strong>sddm</strong> : 基于QML的X11和Wayland显示管理器</li></ul></blockquote><ol><li>安装 <strong>sddm</strong> :</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S sddm</span><br></pre></td></tr></table></figure><ol start="2"><li>将 <strong>sddm</strong> 服务设为开机自启:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ systemctl <span class="built_in">enable</span> sddm</span><br></pre></td></tr></table></figure><ol start="3"><li>重启虚拟机</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ systemctl reboot</span><br></pre></td></tr></table></figure><h4 id="登录图形界面"><a href="#登录图形界面" class="headerlink" title="登录图形界面"></a>登录图形界面</h4><p>就这样,我们开机了,此时虚拟机的显示区域已经能填满我们宿主机的屏幕了:</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/35.png" alt="image"/></div></div><p>输入密码登录即可。</p><h4 id="修改系统显示缩放"><a href="#修改系统显示缩放" class="headerlink" title="修改系统显示缩放"></a>修改系统显示缩放</h4><blockquote><p>在较小尺寸下却拥有较高分辨率的显示器,进入桌面环境后,如果你发现系统的字体和图标等等显得非常小,那么你就必须要设置显示缩放了。</p></blockquote><blockquote><p>如何判断大概怎样的缩放比例才合适呢?最简单的方法就是回到你的 Windows 宿主机,在宿主机桌面空白处「鼠标右键」 > 「显示设置」 > 「缩放和布局」,数值为 <strong>150%</strong> ,即缩放比例为 <strong>1.5x</strong> 。</p></blockquote><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/36.png" alt="image"/></div></div><p>这时,我们再回到虚拟机这边:</p><blockquote><p>「 <strong>开始菜单</strong> 」 > 「 <strong>System Settings</strong> 」 > 「 <strong>Display Configuration</strong> 」 > 「 <strong>Global scale</strong> 」,下面有一个可拖动的条,拖至 <strong>1.5x</strong> 的位置(这里拖拽的位置取决于你 Windows 的「 <strong>缩放和布局</strong> 」的取值),然后我们点击 「 <strong>Apply</strong> 」 应用。</p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/37.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/37.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/38.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/38.png"></a><span></span></div></div><p>最后我们在 「 <strong>开始菜单</strong> 」 > 「 <strong>Leave</strong> 」 > 「 <strong>Restart</strong> 」 重启一下虚拟机以让显示缩放生效,到这里我们就算是解决完系统显示缩放的问题了。</p><h4 id="安装终端模拟器"><a href="#安装终端模拟器" class="headerlink" title="安装终端模拟器"></a>安装终端模拟器</h4><p>等等,前面我们装完 kDE 是不是忘了安装什么东西,我们在桌面环境里怎么输入命令呢?这就需要我们安装 <strong>终端模拟器(Terminal Emulator)</strong> 了</p><blockquote><p>终端模拟器有很多,这里就举几个经典的例子:</p><ul><li>GNU/Linux:gnome-terminal、Konsole;</li><li>macOS:Terminal.app、iTerm2;</li><li>Windows:Win32 控制台、ConEmu 等等</li></ul></blockquote><blockquote><p>在正式安装之前,建议先去看看这么一篇文章:<a href="https://printempw.github.io/the-difference-between-cli-terminal-shell-tty/">命令行界面 (CLI)、终端 (Terminal)、Shell、TTY,傻傻分不清楚?</a></p></blockquote><p>然后这里我要安装的终端模拟器是 <strong>deepin-terminal</strong> (属于Deepin的默认终端仿真应用程序,源码仓库地址:<a href="https://github.com/linuxdeepin/deepin-terminal">https://github.com/linuxdeepin/deepin-terminal</a> ,我选择这个的原因是因为它开源,而且无需任何配置就已经很美观了,还有一点就是不会有 <strong>konsole</strong> 在系统显示缩放比例为 <strong>小数倍</strong> 时随机出现横线或竖线的 bug。)在安装终端模拟器之前,我们需要按下 <strong>Ctrl</strong> + <strong>Alt</strong> + <strong>F2</strong> 切换至 <strong>tty2</strong> ,登录,然后输入命令:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S deepin-terminal</span><br></pre></td></tr></table></figure><p>安装完之后,我们按下 <strong>Ctrl</strong> + <strong>Alt</strong> + <strong>F1</strong> 切换回桌面环境。这时我们就可以在「 <strong>开始菜单</strong> 」找到 <strong>deepin-terminal</strong> 了。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/39.png" alt="image"/></div></div><p>由于 deepin-terminal 默认的主题配色(绿色)我不喜欢,所有我换了另一个。如图:</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/40.png" alt="image"/></div></div><h4 id="安装中文字体"><a href="#安装中文字体" class="headerlink" title="安装中文字体"></a>安装中文字体</h4><blockquote><p>在没安装中文字体之前,系统是无法正常显示中文的,大概就是会显示 <strong>口口口口</strong> 。所以这里推荐安装下 Google Noto Fonts 系列:<strong>noto-fonts-sc</strong> 和 <strong>noto-fonts-emoji</strong></p></blockquote><p>打开终端模拟器,执行下面的命令安装 <strong>noto-fonts-sc</strong> 和 <strong>noto-fonts-emoji</strong> :</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">sudo pacman -S base-devel git</span><br><span class="line">git <span class="built_in">clone</span> https://aur.archlinux.org/noto-fonts-sc.git</span><br><span class="line"><span class="built_in">cd</span> noto-fonts-sc</span><br><span class="line">makepkg -si</span><br><span class="line">sudo pacman -S noto-fonts-emoji</span><br></pre></td></tr></table></figure><h4 id="安装中文输入法"><a href="#安装中文输入法" class="headerlink" title="安装中文输入法"></a>安装中文输入法</h4><blockquote><p>前面系统已经能正常显示中文了,但是我们却仍无法输入中文。因为还没有安装中文输入法。</p></blockquote><blockquote><p>输入法(IM)是一种输入特定字符和符号集的方法,通常是因为键盘不直接输入它们。大多数输入法是输入法框架的一部分,它使用户可以轻松地在多种输入法之间切换。<br>Linux 下有两种主流的输入法框架,<em>ibus</em> 和 <em>fcitx</em> ,对于 KDE 来说, <em>fcitx</em> 是比较好的选择。</p></blockquote><ol><li>使用下面的指令安装 <strong>fcitx</strong> :</li></ol><ul><li><strong>fcitx-im</strong> :软件包组,包含 <strong>fcitx</strong> 本身,和让 fcitx 能正常运行在各版本 qt 和 gtk 程序里的组件( <strong>fcitx-gtk2</strong> 、 <strong>fcitx-gtk3</strong> 、 <strong>fcitx-qt5</strong> )</li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S fcitx-im</span><br></pre></td></tr></table></figure><ol start="2"><li>fcitx 提供有一个集成到 KDE 系统设置内的 fcitx 设置程序 ( <strong>kcm-fcitx</strong> ),输入下面的指令安装 fcitx 的 GUI 配置工具:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S kcm-fcitx</span><br></pre></td></tr></table></figure><ol start="3"><li>安装完 fcitx 输入法框架后,我们来具体安装一个叫做 <strong>rime</strong> 的输入法,输入下面的指令安装即可:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S fcitx-rime</span><br></pre></td></tr></table></figure><blockquote><p>此时我们仍不能正确输入中文。因为我们还未配置环境变量来让程序们使用 fcitx。创建或修改 <strong>~/.pam_environment</strong> 文件,用它来指定环境变量。</p></blockquote><ol start="4"><li>用 vim 编辑 <strong>~/.pam_environment</strong></li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ vim ~/.pam_environment</span><br></pre></td></tr></table></figure><p>在里面加上如下内容</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">GTK_IM_MODULE=fcitx</span><br><span class="line">QT_IM_MODULE=fcitx</span><br><span class="line">XMODIFIERS=@im=fcitx</span><br></pre></td></tr></table></figure><p>它们会指定 fcitx 为几乎所有程序的 IM。当然某些不听话的程序除外,比如 Sublime,但这类程序几乎遇不到。</p><ol start="5"><li>重启系统</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ systemctl reboot</span><br></pre></td></tr></table></figure><ol start="6"><li>添加 rime 输入法</li></ol><p>「 <strong>开始菜单</strong> 」 > 「 <strong>System Settings</strong> 」 > 「 <strong>Personalization</strong> 」 一栏下面的 「 <strong>Regional Settings</strong> 」 > 「 <strong>Input Method</strong> 」,取消勾选 「Only Show Current Language」 > 「 <strong>Rime</strong> 」 > 「 <strong>></strong> 」 > 「 <strong>Apply</strong> 」 应用生效。如图:</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/41.png" alt="image"/></div></div><ol start="7"><li>移除默认的 <strong>Keyboard - English (US)</strong></li></ol><p>「Keyboard - English (US)」 > 「**<**」 > 「Apply」 应用生效。如图:</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/42.png" alt="image"/></div></div><ol start="8"><li>等待 Rime 维护至就绪即可使用 rime 输入法了。</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/43.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/43.png"></a><span></span></div><br><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/44.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/44.png"></a><span></span></div></div><ol start="9"><li>修改繁体输入为简体输入。你可以这么做:</li></ol><p>在可输入区域(如 terminal等),按下 <strong>F4</strong> ,然后会有个 <strong>方案选单</strong> 。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/45.png" alt="image"/></div></div><p>我们按 <strong>1</strong> 键</p><p>然后我们再选 <strong>4</strong> 键</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/46.png" alt="image"/></div></div><p>弄完这个以后输入的中文就是简体的了。</p><blockquote><p>如果要中英文的切换,我们只需要通过 <strong>Shift</strong> 键就可了。</p></blockquote><h4 id="安装浏览器"><a href="#安装浏览器" class="headerlink" title="安装浏览器"></a>安装浏览器</h4><p>浏览器我个人喜欢用 <em>Chromium</em> ,直接用 <em>pacman</em> 安装就是了:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S chromium</span><br></pre></td></tr></table></figure><h4 id="安装-shadowsocks-qt5"><a href="#安装-shadowsocks-qt5" class="headerlink" title="安装 shadowsocks-qt5"></a>安装 shadowsocks-qt5</h4><blockquote><ul><li><strong>shadowsocks-qt5</strong> : 快速,可靠且跨平台的 Shadowsocks 的 GUI 客户端。</li></ul></blockquote><ol><li>Arch Linux 的仓库里有 <strong>shadowsocks-qt5</strong> ,直接安装即可:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S shadowsocks-qt5</span><br></pre></td></tr></table></figure><ol start="2"><li>下载机场的 shadowsocks 配置文件:</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/47.png" alt="image"/></div></div><ol start="3"><li>导入 shadowsocks 配置文件:</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/48.png" alt="image"/></div></div><ol start="4"><li>连接可用的机场节点,并记住本地的端口号:</li></ol><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/49.png" alt="image"/></div></div><ol start="5"><li>设置系统代理</li></ol><p>「 <strong>开始菜单</strong> 」 > 「 <strong>System Settings</strong> 」 > 「 <strong>Network</strong> 」 > 「 <strong>Settings</strong> 」 > 勾选 「 <strong>Use manually specified proxy configuration</strong> 」</p><p>在 「 <strong>Socks Proxy</strong> 」 里填写 <strong>socks5://127.0.0.1</strong> ,其中 「Port」 为 <strong>1080</strong> ,就是我之前让你记住的本地端口号。<br>在 「 <strong>Exceptions</strong> 」 里填写 <strong>localhost,127.0.0.0/8,::1</strong> 。<br>最后点击 「 <strong>Apply</strong> 」,应用即可。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/50.png" alt="image"/></div></div><blockquote><p>如果要关掉代理,就勾选 「 <strong>No Proxy</strong> 」 再 「 <strong>Apply</strong> 」 应用即可,然后断开shadowsocks的连接就好了。</p></blockquote><h4 id="安装文件管理器"><a href="#安装文件管理器" class="headerlink" title="安装文件管理器"></a>安装文件管理器</h4><p>这里我就不多赘述了,文件管理器我选择 <em>dolphin</em> ,用 <em>pacman</em> 安装即可:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S dolphin</span><br></pre></td></tr></table></figure><h4 id="安装归档管理器"><a href="#安装归档管理器" class="headerlink" title="安装归档管理器"></a>安装归档管理器</h4><ul><li>engrampa: 可视化解压缩软件</li><li>其余均为依赖,安装这些软件包后 <em>engrampa</em> 才能解压缩 7z、rar、zip 格式的压缩包</li></ul><p>用 <em>pacman</em> 安装即可:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S p7zip unrar zip unzip engrampa</span><br></pre></td></tr></table></figure><h3 id="安装完后的-装逼"><a href="#安装完后的-装逼" class="headerlink" title="安装完后的 装逼"></a>安装完后的 <del>装逼</del></h3><p>只需要先安装 <em>neofetch</em> 即可</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ sudo pacman -S neofetch</span><br></pre></td></tr></table></figure><p>然后直接在 terminal 输入:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">[admin@<span class="built_in">arch</span> ~]$ neofetch</span><br></pre></td></tr></table></figure><p>没错,你应该不止一次看到过类似这样的一张图,这就是信仰啊~ ( 😀</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/installing-arch-as-a-guest-with-uefi-and-gpt/cover.png" alt="image"/></div></div>]]></content>
<categories>
<category> Linux </category>
</categories>
<tags>
<tag> VMware </tag>
<tag> Arch </tag>
</tags>
</entry>
<entry>
<title>StarUML 3 破解</title>
<link href="/staruml-3-registration.html"/>
<url>/staruml-3-registration.html</url>
<content type="html"><![CDATA[<p>导语:尽管不注册StarUML也不会有使用时间的限制,但是时不时的弹窗请求注册就让人很闹心,而且不注册的话导出的图片会带水印,再加上官网高昂的费用… 于是乎此文就此产生。</p><span id="more"></span><h2 id="事先准备"><a href="#事先准备" class="headerlink" title="事先准备"></a>事先准备</h2><ul><li><a href="https://staruml.io/">StarUML</a><ul><li>首先下载好 StarUML,然后双击安装包,它会自己安装到 <code>C:\Program Files\StarUML</code> ,而且没法选择更改安装路径…</li></ul></li><li><a href="https://nodejs.org/en">Node.js</a><ul><li>首先下载LTS版(长期支持版) Node.js ,安装选项全部默认,一路点击Next。最后安装好之后,cmd 输入 <code>node -v</code> 和 <code>npm -v</code> ,如果出现版本号,那么就安装成功了。</li></ul></li></ul><h2 id="注册过程"><a href="#注册过程" class="headerlink" title="注册过程"></a>注册过程</h2><ol><li>安装 <code>asar</code> ,以 <strong>管理员模式</strong> 运行cmd,输入命令:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm install -g asar</span><br></pre></td></tr></table></figure><ol start="2"><li>切换工作目录到 <code>C:\Program Files\StarUML\resources</code> ,输入命令:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /d <span class="string">"C:\Program Files\StarUML\resources"</span></span><br></pre></td></tr></table></figure><ol start="3"><li>解包 <code>app.asar</code> ,输入命令:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">asar extract app.asar app</span><br></pre></td></tr></table></figure><ol start="4"><li>将 <code>app.asar</code> 重命名为 <code>app.asar.bak</code> ,即输入命令:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rename app.asar app.asar.bak</span><br></pre></td></tr></table></figure><ol start="5"><li>使用你喜欢的 <strong>带语法高亮</strong> 的编辑器修改 <em>C:\Program Files\StarUML\resources\app\src\engine\license-manager.js</em> 这个文件</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/staruml-3-registration/1.png' data-fancybox='default' data-caption='license-manager.js'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/staruml-3-registration/1.png" alt="license-manager.js"></a><span class='image-caption'>license-manager.js</span></div></div><blockquote><p><strong>注</strong> :如图找到 <code>checkLicenseValidity () { ... }</code> 这一块代码,修改为这样:</p></blockquote><figure class="highlight javascript"><figcaption><span>license-manager.js</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">checkLicenseValidity () {</span><br><span class="line"> <span class="variable language_">this</span>.<span class="title function_">validate</span>().<span class="title function_">then</span>(<span class="function">() =></span> {</span><br><span class="line"> <span class="title function_">setStatus</span>(<span class="variable language_">this</span>, <span class="literal">true</span>)</span><br><span class="line"> }, <span class="function">() =></span> {</span><br><span class="line"> <span class="comment">// setStatus(this, false) <- 注释这一行(其中"//"用于注释)</span></span><br><span class="line"> <span class="comment">// UnregisteredDialog.showDialog() <- 注释这一行(其中"//"用于注释)</span></span><br><span class="line"> <span class="title function_">setStatus</span>(<span class="variable language_">this</span>, <span class="literal">true</span>) <span class="comment">// <- 添加这一行</span></span><br><span class="line"> })</span><br><span class="line">}</span><br></pre></td></tr></table></figure><ol start="6"><li>修改完后现在可以重新打包了,输入命令:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">asar pack app app.asar</span><br></pre></td></tr></table></figure><ol start="7"><li>就这样完成了一切的工作。</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/staruml-3-registration/cover.png' data-fancybox='default' data-caption='成果图'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/staruml-3-registration/cover.png" alt="成果图"></a><span class='image-caption'>成果图</span></div></div>]]></content>
<categories>
<category> Crack </category>
</categories>
<tags>
<tag> 破解 </tag>
<tag> StarUML </tag>
</tags>
</entry>
<entry>
<title>Office Tool Plus 使用教程(KMS 激活)</title>
<link href="/office_tool_plus_usage.html"/>
<url>/office_tool_plus_usage.html</url>
<content type="html"><![CDATA[<h2 id="下载-Office-Tool-Plus"><a href="#下载-Office-Tool-Plus" class="headerlink" title="下载 Office Tool Plus"></a>下载 Office Tool Plus</h2><ul><li><a href="https://github.com/YerongAI/Office-Tool/releases/latest">下载页面</a></li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/office/1.png' data-fancybox='default' data-caption='下载页面'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/office/1.png" alt="下载页面"></a><span class='image-caption'>下载页面</span></div></div><p>选择带运行时解压缩版本,点击下载</p><h2 id="解压运行-Office-Tools"><a href="#解压运行-Office-Tools" class="headerlink" title="解压运行 Office Tools"></a>解压运行 Office Tools</h2><p>解压缩完后,点击主程序 <code>Office Tool Plus.exe</code> 即可</p><h2 id="部署选项"><a href="#部署选项" class="headerlink" title="部署选项"></a>部署选项</h2><ul><li><p>主界面『部署』→</p></li><li><p>『产品』→『添加产品』:选择任意<strong>批量许可证版本</strong>即可。首选『<strong>Office 专业增强版 2019 - 批量许可证</strong>』(选择批量许可证版本是因为<strong>只有该版本支持 KMS 激活方式</strong>)</p><p>『应用程序』:根据自身需求勾选即可(常见三件套:Excel、PowerPoint、Word)</p><p>『语言』:看你喜欢</p><p>『部署设置』:</p><ul><li><p>『体系结构』:不是吧不是吧,这个年代了,还有人不是用64位处理器和系统的吗?<strong>首选64位</strong>(当然你的电脑如果是 32 位的处理器或操作系统,自然选择 32 位)</p></li><li><p>『通道』:『Office 2019 企业长期版』</p></li></ul></li></ul><p>当您完成上述配置后,找到右上角的『开始部署』,耐心等其完成在线下载、安装的流程</p><h2 id="关于激活"><a href="#关于激活" class="headerlink" title="关于激活"></a>关于激活</h2><ul><li><p>安装完成后首先打开 Office 套件任意一个程序,完成初始化设置,新建一个文档后关闭窗口</p></li><li><p>然后『<strong>以管理员身份运行</strong>』cmd 命令提示符,执行如下命令:</p></li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">cd /d "C:\Program Files\Microsoft Office\Office16"</span><br><span class="line">cscript ospp.vbs /sethst:kms.03k.org</span><br><span class="line">cscript ospp.vbs /act</span><br><span class="line"></span><br><span class="line">cscript OSPP.VBS /dstatus</span><br></pre></td></tr></table></figure><h2 id="检验激活是否成功"><a href="#检验激活是否成功" class="headerlink" title="检验激活是否成功"></a>检验激活是否成功</h2><p>当您执行完上面最后一行命令时,反馈的结果就可以看到是否激活成功,看不懂程序反馈的内容?没有关系,您可以这么做:</p><p>任意打开 Office 套件的一个程序,找到左下角的『账户选项』,即可在『产品信息』区域看到激活的情况,如果显示『<strong>激活的产品</strong>』:『Microsoft Office 专业增强版 2019』 字样即说明激活成功。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/office/2.png' data-fancybox='default' data-caption='激活成功'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/office/2.png" alt="激活成功"></a><span class='image-caption'>激活成功</span></div></div>]]></content>
<categories>
<category> Windows </category>
</categories>
<tags>
<tag> 激活 </tag>
<tag> Office </tag>
<tag> 破解 </tag>
<tag> Office Tool </tag>
<tag> Office Tool Plus </tag>
<tag> Word </tag>
<tag> Excel </tag>
<tag> PowerPoint </tag>
<tag> Visio </tag>
<tag> KMS </tag>
<tag> crack </tag>
</tags>
</entry>
<entry>
<title>Fedora 30 安装 VMware Workstation</title>
<link href="/install-vmware-workstation-on-fedora-30.html"/>
<url>/install-vmware-workstation-on-fedora-30.html</url>
<content type="html"><![CDATA[<p>本文介绍了 Fedora 30 安装 VMware Workstation 全过程</p><span id="more"></span><h2 id="下载-VMware-Workstation-安装程序"><a href="#下载-VMware-Workstation-安装程序" class="headerlink" title="下载 VMware Workstation 安装程序"></a>下载 VMware Workstation 安装程序</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> ~/Downloads</span><br><span class="line">wget https://download3.vmware.com/software/wkst/file/VMware-Workstation-Full-15.0.4-12990004.x86_64.bundle</span><br></pre></td></tr></table></figure><h2 id="执行安装程序"><a href="#执行安装程序" class="headerlink" title="执行安装程序"></a>执行安装程序</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">chmod</span> a+x VMware-Workstation-Full-15.0.4-12990004.x86_64.bundle</span><br><span class="line">./VMware-Workstation-Full-15.0.4-12990004.x86_64.bundle</span><br></pre></td></tr></table></figure><blockquote><p>接下来,根据终端上的提示进行安装即可。<br>等安装完成后还不要急着启动,如果启动,将无法正常运行,会显示 <em>Before you can run VMware several modules must be compiled and loaded into the running kernel</em> ,所以这个时候就需要patch了。</p></blockquote><h2 id="安装依赖"><a href="#安装依赖" class="headerlink" title="安装依赖"></a>安装依赖</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo dnf install kernel-devel kernel-headers gcc gcc-c++ make git</span><br></pre></td></tr></table></figure><h2 id="patch-过程"><a href="#patch-过程" class="headerlink" title="patch 过程"></a>patch 过程</h2><h3 id="注意"><a href="#注意" class="headerlink" title="注意"></a>注意</h3><p>根据您的 VMware Workstation 版本号,将下面命令里出现的“x.y.z”替换为您安装的版本号,比如说 <strong>15.0.4</strong></p><ul><li>查看vmware的版本号</li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">vmware -v</span><br></pre></td></tr></table></figure><h3 id="方法一(编译并安装)"><a href="#方法一(编译并安装)" class="headerlink" title="方法一(编译并安装)"></a>方法一(编译并安装)</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">wget https://github.com/mkubecek/vmware-host-modules/archive/workstation-x.y.z.tar.gz</span><br><span class="line">tar -xzf workstation-x.y.z.tar.gz</span><br><span class="line"><span class="built_in">cd</span> vmware-host-modules-workstation-x.y.z</span><br><span class="line">make</span><br><span class="line">sudo make install</span><br></pre></td></tr></table></figure><h3 id="方法二(替换原始的tarball,推荐)"><a href="#方法二(替换原始的tarball,推荐)" class="headerlink" title="方法二(替换原始的tarball,推荐)"></a>方法二(替换原始的tarball,<strong>推荐</strong>)</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">wget https://github.com/mkubecek/vmware-host-modules/archive/workstation-x.y.z.tar.gz</span><br><span class="line">tar -xzf workstation-x.y.z.tar.gz</span><br><span class="line"><span class="built_in">cd</span> vmware-host-modules-workstation-x.y.z</span><br><span class="line">tar -cf vmmon.tar vmmon-only</span><br><span class="line">tar -cf vmnet.tar vmnet-only</span><br><span class="line">sudo <span class="built_in">cp</span> -v vmmon.tar vmnet.tar /usr/lib/vmware/modules/source/</span><br><span class="line">sudo vmware-modconfig --console --install-all</span><br></pre></td></tr></table></figure><h2 id="运行"><a href="#运行" class="headerlink" title="运行"></a>运行</h2><p>经过 patch,这时再运行,就可以正常运行了。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/install-vmware-workstation-on-fedora-30.png' data-fancybox='default' data-caption='成果图'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-vmware-workstation-on-fedora-30.png" alt="成果图"></a><span class='image-caption'>成果图</span></div></div>]]></content>
<categories>
<category> Linux </category>
</categories>
<tags>
<tag> VMware </tag>
<tag> Fedora </tag>
</tags>
</entry>
<entry>
<title>VMware Workstation 安装 macOS 10.13(多图预警)</title>
<link href="/install-macos-10-13-on-vmware-workstation.html"/>
<url>/install-macos-10-13-on-vmware-workstation.html</url>
<content type="html"><![CDATA[<p>由于安装黑苹果需要配备兼容的硬件且难度较大,如果想要更轻松的在 Windows 和 Linux 的机子上体验 macOS 的一种方法就是把它装在 VMware Workstation 上。这样做的好处是方便安装,通过使用虚拟机,您可以同时使用 macOS 和 Windows 或 Linux;但是缺点也很明显,无法充分调动硬件性能。本文将指导您如何在 VMware Workstation 上安装 macOS:</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/cover.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/cover.png"></a><span></span></div></div><span id="more"></span><h2 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h2><p>下载好以下文件:</p><ul><li><p>VMware Workstation</p><blockquote><p>VMware Workstation是VMware公司推出的一款桌面虚拟计算软件,至于下载和安装,填写license这里不赘述,请自行使用搜索引擎查询。 </p></blockquote></li><li><p>unlocker (项目发行地址<a href="https://github.com/paolo-projects/unlocker/releases">点此</a>,此处下载最新版本的zip)</p><blockquote><p>在用VMware安装macOS前需要对VMware打补丁,unlocker就起到这个作用。 </p></blockquote></li><li><p>macOS High Sierra 10.13.iso</p><ul><li>链接:<a href="https://pan.baidu.com/share/init?surl=eSGmiwq">https://pan.baidu.com/share/init?surl=eSGmiwq</a></li><li>密码:2zk6</li><li>MD5 :3E3048A0BD26A03D54DBED7706548726</li><li>SHA-1 :31094D7B58D67002B9824E428675E895F81F4B47</li></ul></li></ul><blockquote><p><strong>macOS High Sierra 10.13.iso</strong> 是macOS的镜像文件。MD5 和 SHA-1 用于校验文件是否完整无损坏。如果不知道如何校验,请自行使用搜索引擎查询。</p></blockquote><h2 id="应用-unlocker-补丁"><a href="#应用-unlocker-补丁" class="headerlink" title="应用 unlocker 补丁"></a>应用 unlocker 补丁</h2><p>把下载好的unlocker解压,此处我以解压到 <code>H:\unlocker</code> 为例。<br>使用 <strong>管理员模式</strong> 打开cmd,执行以下命令:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /d H:\unlocker</span><br><span class="line">win-install</span><br></pre></td></tr></table></figure><p>执行命令后期间会下载 <strong>VMware Tools</strong> ,所以过程需要稍微比较久的时间,当显示Finished后即表明已完成打补丁的操作,截图如下:</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/1.png" alt="image"/></div></div><h2 id="打开-VMware-新建虚拟机"><a href="#打开-VMware-新建虚拟机" class="headerlink" title="打开 VMware 新建虚拟机"></a>打开 VMware 新建虚拟机</h2><ul><li>打开VMware,选择 <strong>新建虚拟机</strong></li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/2.png" alt="image"/></div></div><ul><li>选择 <strong>典型安装</strong> ,下一步</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/3.png" alt="image"/></div></div><ul><li>点击 <strong>浏览</strong> ,找到下载好的iso文件,然后下一步</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/4.png" alt="image"/></div></div><ul><li>选择安装 Apple Mac OS X<br>由于我们之前打过了补丁,所以这时我们能看到有<strong>Apple Mac OS X</strong>这个选项,选择,然后选中<strong>macOS 10.13</strong>,下一步</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/5.png" alt="image"/></div></div><ul><li>选择虚拟机存放的路径,自行选择合适的路径下一步</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/6.png" alt="image"/></div></div><ul><li>选择存储为单个文件(因为存储为多个文件会影响性能)</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/7.png" alt="image"/></div></div><ul><li>自定义硬件</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/8.png" alt="image"/></div></div><p>建议把内存调大点,我这里设置成4GB,视实际内存大小而定。其他选项无需调整,点击关闭,完成即可。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/9.png" alt="image"/></div></div><ul><li>开启虚拟机</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/10.png" alt="image"/></div></div><ul><li>等待载入安装界面</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/11.jpg" alt="image"/></div></div><ul><li>选择 <strong>简体中文</strong> ,下一步</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/12.jpg" alt="image"/></div></div><ul><li>点击继续</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/13.jpg" alt="image"/></div></div><ul><li>继续,同意许可条款</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/14.jpg" alt="image"/></div></div><ul><li>在左上角的菜单栏,点击【实用工具】->【磁盘工具】</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/15.jpg" alt="image"/></div></div><ul><li>选中分配给虚拟机的磁盘,点击 <strong>抹掉</strong></li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/16.png" alt="image"/></div></div><ul><li>名称随意,格式,方案默认即可。点击 <strong>抹掉</strong></li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/17.jpg" alt="image"/></div></div><ul><li>点击完成,关闭磁盘工具的窗口。</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/18.png" alt="image"/></div></div><ul><li>选中刚刚的磁盘,点击 <strong>继续</strong></li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/19.jpg" alt="image"/></div></div><ul><li>安装开始,此处大概需要10~20分钟,泡杯咖啡静待吧。</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/20.jpg" alt="image"/></div></div><ul><li>等待重启</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/21.jpg" alt="image"/></div></div><ul><li>鼠标滚轮滚动到最下面,选择 <strong>中国</strong> ,继续</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/22.jpg" alt="image"/></div></div><ul><li>简体拼音,继续</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/23.jpg" alt="image"/></div></div><ul><li>现在不传输任何信息,继续</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/24.jpg" alt="image"/></div></div><ul><li>此处我选择 <strong>不登陆</strong> ,跳过这一步</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/25.jpg" alt="image"/></div></div><ul><li>同意软件许可协议</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/26.jpg" alt="image"/></div></div><ul><li>创建电脑账户(即本地账户),输入全名,密码。提示部分可不填写,填写完成后,点击继续即可。</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/27.png" alt="image"/></div></div><ul><li>快捷设置,点击继续。</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/28.jpg" alt="image"/></div></div><ul><li>正在设置您的 Mac…</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/29.jpg" alt="image"/></div></div><ul><li>进入桌面发现显示区域不能适配屏幕大小,这是因为我们还没有安装 <strong>VMware Tools</strong> 。这里我们先点击左上角菜单,选择关机</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/30.jpg" alt="image"/></div></div><ul><li>点击 <strong>CD/DVD (SATA)</strong></li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/31.png" alt="image"/></div></div><ul><li>使用 <strong>物理驱动</strong> ,<strong>自动检测</strong> ,OK</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/32.png" alt="image"/></div></div><ul><li><strong>开启 macOS</strong></li><li>在VMware的菜单栏里,选择【虚拟机】->【安装 VMware Tools】</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/33.jpg" alt="image"/></div></div><ul><li>这时在桌面的右上角会出现 <strong>VMware Tools</strong> 的图标,双击图标,然后点击 <strong>安装 VMware Tools</strong></li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/34.jpg" alt="image"/></div></div><ul><li>安装过程中会请求输入密码,输入密码后点击 <strong>安装软件</strong> 即可</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/35.png" alt="image"/></div></div><ul><li>安装完成后需要重新启动</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/36.jpg" alt="image"/></div></div><ul><li>重启完后,弹窗提示 <strong>VMware Tools 已被阻止</strong> ,我们打开 <strong>dock栏</strong> 上的 <strong>系统偏好设置</strong></li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/37.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/37.png"></a><span></span></div></div><ul><li>点击【安全性与隐私】</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/38.png" alt="image"/></div></div><ul><li>点击【允许】VMware Tools的载入,然后再点击左下角的【锁】按钮进行更改</li></ul><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/39.png" alt="image"/></div></div><ul><li>最后,弄完上述所有操作后重启就OK了。此处附上成果图,如下:</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/40.jpg' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/install-macos-10.13-on-vmware-workstation/40.jpg"></a><span></span></div></div>]]></content>
<categories>
<category> VM </category>
</categories>
<tags>
<tag> 虚拟机 </tag>
<tag> macOS </tag>
</tags>
</entry>
<entry>
<title>CentOS 7 使用 Tor 代理访问 Tor 暗网(.onion 域名的网站)</title>
<link href="/access-onionland-with-tor-on-centos-7.html"/>
<url>/access-onionland-with-tor-on-centos-7.html</url>
<content type="html"><![CDATA[<p>说到使用 Tor,人们通常只会想到使用 Tor 浏览器(Tor Browser)。但是 Tor 只能用于 Tor 浏览器代理使用吗?答案是否定的。你可以借助 Tor 给你的系统进行代理,其默认监听端口为 <strong>9050</strong>,下面将简单的介绍下具体流程。</p><blockquote><p>注意:Tor 代理不仅仅只能用于浏览器,其他非浏览器应用也可使用其代理。当然我还是要强调一下,本文的主题是使用 Tor 代理访问暗网,本文以使用 Chrome 访问 .onion 站点为例,不考虑到匿名和安全的防护。</p></blockquote><span id="more"></span><blockquote><p>顺便澄清一下暗网并没有那些人为吸引眼球的媒体或个人所说的全都那般的阴暗危险,这里引用下一则我认为比较中肯的评说。(<psw>江来如果报道上出了偏差,你们是要负泽任的,你識得唔識得噶。</psw>)</p></blockquote><blockquote><p>暗网技术是很厉害的技术,有人说是平民的武器。因此,可以说和任何技术一样,暗网技术有两面性。暗网上的服务器到现在有多少,由于暗网的特性,恐怕很难说得清楚。 在此之中,又有多少服务器是非法的,也很难说清楚。即使能举出一个数字来,因为总数不知道,我们甚至不知道比例。 但是,我想不管是普通的互联网还是暗网,想通过互联网犯罪的人总是有的,想正常使用互联网的人也是有的。此外值得指出,虽然暗网上有一定比例的节点在提供违法犯罪的服务,但是这不代表暗网本身是违法的技术。 我们可以说,暗网是一种构建在互联网上的“虚拟互联网”, 它继承了互联网的思想,但因为互联网的物理结构和底层协议都已经形成, 不可能另起炉灶,所以建设在互联网的应用层次,作为一种“虚拟”的完善。 所以,就如同我们不能因为互联网上有网站是违法就否定互联网的价值一样,我们也不能否定暗网的价值。笔者在此希望本文的读者,能首先,实事求是地从纯技术的角度来深入认识暗网, 知道它确实是可以被滥用的媒介,但也可以是有利于构建更加安全的网络结构的工具。 这种认识不仅在道德上有助于正确评价暗网的功过是非, 也有助于在运用暗网时了解它可能的危险,例如运行一个暗网出口代理的危险,并进而安全使用; 更重要的是,能了解暗网技术的巨大优势,发掘出它的潜力,这将有助于开发更好的基于网络的计算机程序。——引用自 <a href="https://neoatlantis.org/%E7%94%B5%E5%B7%A5%E7%94%B5%E5%AD%90%E5%8F%8A%E4%BF%A1%E6%81%AF%E6%8A%80%E6%9C%AF/2015/05/02/darknet-intro.html">NeoAtlantis 应用科学和神秘学实验室</a></p></blockquote><h2 id="安装-Tor"><a href="#安装-Tor" class="headerlink" title="安装 Tor"></a>安装 Tor</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">sudo yum install epel-release</span><br><span class="line">sudo yum install tor</span><br></pre></td></tr></table></figure><h2 id="编辑配置文件"><a href="#编辑配置文件" class="headerlink" title="编辑配置文件"></a>编辑配置文件</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo vim /etc/tor/torrc</span><br></pre></td></tr></table></figure><p>添加下列 3 行内容即可</p><figure class="highlight plaintext"><figcaption><span>/etc/tor/torrc</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Socks5Proxy 127.0.0.1:1080 # 将 shadowsocks 作为 Tor 的前置代理</span><br><span class="line">ExcludeNodes {cn},{hk},{mo},{kp},{ir},{sy},{pk},{cu},{vn} # 表示排除这些国家/地区的节点</span><br><span class="line">StrictNodes 1 # 表示强制执行</span><br></pre></td></tr></table></figure><p>如图所示:</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/access-onionland-with-tor-on-centos_7/1.png' data-fancybox='default' data-caption='/etc/tor/torrc'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/access-onionland-with-tor-on-centos_7/1.png" alt="/etc/tor/torrc"></a><span class='image-caption'>/etc/tor/torrc</span></div></div><h2 id="启动-shadowsocks-代理"><a href="#启动-shadowsocks-代理" class="headerlink" title="启动 shadowsocks 代理"></a>启动 shadowsocks 代理</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ss-local -c ~/shadowsocks.json</span><br></pre></td></tr></table></figure><h2 id="启动-Tor-代理"><a href="#启动-Tor-代理" class="headerlink" title="启动 Tor 代理"></a>启动 Tor 代理</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl start tor</span><br></pre></td></tr></table></figure><h2 id="启动系统代理"><a href="#启动系统代理" class="headerlink" title="启动系统代理"></a>启动系统代理</h2><p>「<strong>设置</strong>」->「<strong>网络</strong>」->「<strong>网络代理</strong>」->「<strong>手动</strong>」,如图所示。</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/access-onionland-with-tor-on-centos_7/2.jpg' data-fancybox='default' data-caption='Network Proxy'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/access-onionland-with-tor-on-centos_7/2.jpg" alt="Network Proxy"></a><span class='image-caption'>Network Proxy</span></div></div><p>Socks Host 这一项填写的内容为 <code>127.0.0.1</code> 和 <code>9050</code></p><p><strong>注意</strong>:<code>9050</code> 是 Tor 代理的默认端口号</p><h2 id="成功截图"><a href="#成功截图" class="headerlink" title="成功截图"></a>成功截图</h2><p>浏览器访问 .onion 域名截图:</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/access-onionland-with-tor-on-centos_7/3.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/access-onionland-with-tor-on-centos_7/3.png"></a><span></span></div></div><p>截图里的测试地址为:<code>msydqstlz2kzerdg.onion</code></p><h2 id="停用-Tor-代理"><a href="#停用-Tor-代理" class="headerlink" title="停用 Tor 代理"></a>停用 Tor 代理</h2><p>当你不需要使用 Tor 代理的时候在终端输入这个命令:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">systemctl stop tor</span><br></pre></td></tr></table></figure><h2 id="关闭系统代理"><a href="#关闭系统代理" class="headerlink" title="关闭系统代理"></a>关闭系统代理</h2><p>「<strong>设置</strong>」->「<strong>网络</strong>」->「<strong>网络代理</strong>」->「<strong>禁用</strong>」即可</p>]]></content>
<categories>
<category> Linux </category>
</categories>
<tags>
<tag> 暗网 </tag>
<tag> Tor </tag>
<tag> 代理 </tag>
</tags>
</entry>
<entry>
<title>斐讯 K2P 刷 BREED 和 Padavan</title>
<link href="/phicomm-k2p-Padavan.html"/>
<url>/phicomm-k2p-Padavan.html</url>
<content type="html"><![CDATA[<p>本文介绍了 斐讯 K2P 刷 BREED 和 Padavan 的全过程</p><p>这里简要讲一下 <strong>斐讯 K2P</strong> 有如下版本</p><ul><li>K2P (A1)</li><li>K2P (A2)</li><li>K2P (B1)</li><li>K2P (B2)</li></ul><span id="more"></span><blockquote><p>A1和A2采用的处理器是联发科 MT7621A,二者的区别在于A2少了屏蔽罩和电源缩水,A1和A2的固件可以通刷。B1和B2采用的处理器是博通BCM47189,其他的不清楚了。 </p></blockquote><p>本教程针对以我的机子为例(建议先参考下<a href="https://web.archive.org/web/20230502030333/http://help.gocloud.cn/InstallationGuide/FILES/GoCloudK2PShuaJiJiaoChengV2.0.html">K2P刷机指南说明</a>食用)</p><ul><li>斐讯 K2P A2版</li><li>官方系统 <strong>软件版本</strong> 为 <code>22.7.8.5</code></li></ul><h2 id="启用-Telnet"><a href="#启用-Telnet" class="headerlink" title="启用 Telnet"></a>启用 Telnet</h2><h3 id="Windows-启用-Telnet-客户端"><a href="#Windows-启用-Telnet-客户端" class="headerlink" title="Windows 启用 Telnet 客户端"></a>Windows 启用 Telnet 客户端</h3><p>「控制面板」–>「程序」–>「程序和功能」–>「启用或关闭 Windows 功能」,找到「Telnet 客户端」启用即可,如图。 </p><p><img src="https://cdn.jsdelivr.net/gh/ericclose/images/phicomm-k2p-padavan/1.png"></p><h3 id="启用路由器的-Telnet"><a href="#启用路由器的-Telnet" class="headerlink" title="启用路由器的 Telnet"></a>启用路由器的 Telnet</h3><ul><li>准备1:电脑、网线2根、<strong>全新</strong> / <strong>已恢复出厂</strong> 的K2P。 </li><li>准备2:下载K2P的telnet开启工具。<a href="https://github.com/ericclose/cdn-assets/raw/master/blog/K2P_telnet_tool.zip">【点击下载】</a></li></ul><h4 id="步骤1"><a href="#步骤1" class="headerlink" title="步骤1"></a>步骤1</h4><p>请先给K2P上电后用网线将电脑连接路由器的LAN口</p><h4 id="步骤2"><a href="#步骤2" class="headerlink" title="步骤2"></a>步骤2</h4><p>全新K2P默认IP是 <code>192.168.2.1</code> ,请使用浏览器登录K2P的WEB管理页面完成配置引导,具体操作如下:<br>1). 在浏览器输入 <code>192.168.2.1</code> ,访问全新K2P的WEB管理页面会进入配置引导,请根据提示完成上网配置。</p><blockquote><p>请在这个时候再确认一下K2P的版本号,如果版本号与刷机方式不匹配,容易出现刷机设备等问题。</p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/phicomm-k2p-padavan/2.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/phicomm-k2p-padavan/2.png"></a><span></span></div></div><h4 id="步骤3"><a href="#步骤3" class="headerlink" title="步骤3"></a>步骤3</h4><p>开始使用“开启telnet”,请打开【telnet开启工具】为K2P开启telnet服务,操作如下。</p><blockquote><p>注意:请确保PC的telnet客户端已经开启。</p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/phicomm-k2p-padavan/3.jpg' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/phicomm-k2p-padavan/3.jpg"></a><span></span></div></div><h2 id="刷入BREED"><a href="#刷入BREED" class="headerlink" title="刷入BREED"></a>刷入<a href="https://breed.hackpascal.net/">BREED</a></h2><p>首先下载好BREED,<a href="https://breed.hackpascal.net/breed-mt7621-phicomm-k2p.bin">【点击下载】</a><br>按 快捷键Win+R 输入 <code>telnet 192.168.2.1</code> 登录到路由器,进去后如下: </p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/phicomm-k2p-padavan/4.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/phicomm-k2p-padavan/4.png"></a><span></span></div></div><p>登陆后,照如下输入命令</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">root@K2P:/<span class="comment">#cd /tmp</span></span><br><span class="line">root@K2P:/tmp<span class="comment">#opkg install http://downloads.openwrt.org/chaos_calmer/15.05/ramips/mt7621/packages/packages/wget_1.16.3-1_ramips_1004kc.ipk</span></span><br></pre></td></tr></table></figure><p>安装成功应该可以看到有wget-ssl文件了</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">root@K2P:/tmp<span class="comment"># ls /overlay/usr/bin/</span></span><br><span class="line">dbclient dropbearkey scp ssh wget-ssl</span><br></pre></td></tr></table></figure><p>然后下载breed:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">wget-ssl --no-check-certificate https://breed.hackpascal.net/breed-mt7621-phicomm-k2p.bin</span><br></pre></td></tr></table></figure><p>下载完成后校对一下md5是不是与官方公布的一致即可 ,如果OK,继续下一步操作.</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">root@K2P:/tmp<span class="comment"># md5sum breed-mt7621-phicomm-k2p.bin</span></span><br><span class="line">4b757898df85bff44668a0987768180f breed-mt7621-phicomm-k2p.bin</span><br></pre></td></tr></table></figure><p>写入breed:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">root@K2P:/tmp<span class="comment"># cat /proc/mtd</span></span><br><span class="line">dev: size erasesize name</span><br><span class="line">mtd0: 01000000 00010000 <span class="string">"ALL"</span></span><br><span class="line">mtd1: 00030000 00010000 <span class="string">"Bootloader"</span></span><br><span class="line">mtd2: 00010000 00010000 <span class="string">"Config"</span></span><br><span class="line">mtd3: 00010000 00010000 <span class="string">"Factory"</span></span><br><span class="line">mtd4: 00050000 00010000 <span class="string">"permanent_config"</span></span><br><span class="line">mtd5: 00f60000 00010000 <span class="string">"firmware"</span></span><br><span class="line">mtd6: 00c48b96 00010000 <span class="string">"rootfs"</span></span><br><span class="line">mtd7: 00200000 00010000 <span class="string">"rootfs_data"</span></span><br><span class="line">root@K2P:/tmp<span class="comment"># mtd -r write /tmp/breed-mt7621-phicomm-k2p.bin Bootloader</span></span><br></pre></td></tr></table></figure><p>写入成功的情况下会自动重启的.</p><p>重启后路由断电,按住reset键,接通电源继续长按10秒左右即可进入BREED。<br>进入BREED后即可刷机了。</p><h2 id="固件备份"><a href="#固件备份" class="headerlink" title="固件备份"></a>固件备份</h2><p>浏览器输入 <code>192.168.1.1</code> 进入BREED<br><strong>切记:一定要做好备份工作</strong><br>「备份」-> 分别选择EEPROM,固件,编程器固件,如图: </p><p><img src="https://cdn.jsdelivr.net/gh/ericclose/images/phicomm-k2p-padavan/5.png"></p><h2 id="开始刷机"><a href="#开始刷机" class="headerlink" title="开始刷机"></a>开始刷机</h2><p>开刷前,请必须记得先「恢复出厂设置」->「Config 区 (公版)」,然后点「执行」<br>Padavan 下载地址:<a href="https://opt.cn2qq.com/padavan/">https://opt.cn2qq.com/padavan/</a><br>找到 <code>K2P_DRV_3.4.3.9-099.trx</code> 下载<br>恢复出厂设置以后,选择「固件升级」->勾选固件->浏览,选中你下载好的 K2P 的Padavan固件,比如我这次是「K2P_DRV_3.4.3.9-099.trx」,点击「上传」即可,如图: </p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/phicomm-k2p-padavan/6.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/phicomm-k2p-padavan/6.png"></a><span></span></div></div><p>等待路由器刷机成功并重启即可访问管理后台 </p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/phicomm-k2p-padavan/7.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/phicomm-k2p-padavan/7.png"></a><span></span></div></div><p>不同固件的默认管理后台地址不一样,我这里 Padavan 的例子是 <strong>192.168.123.1</strong>,而用户名密码则均是 <strong>admin</strong> 。<br>补充一句:WiFi的默认密码为:<strong>1234567890</strong> ,大家要记得这个,因为以后如果将Padavan重置的时候,很多人都不知道WiFi密码是多少,以为还是原来你设置的密码,其实不是的,已经变成了默认密码了。</p>]]></content>
<categories>
<category> Router </category>
</categories>
<tags>
<tag> 刷机 </tag>
<tag> 固件 </tag>
<tag> 斐讯 </tag>
<tag> Phicomm </tag>
<tag> Padavan </tag>
<tag> BREED </tag>
</tags>
</entry>
<entry>
<title>(类)原生 Android 网络去叉/叹号 Android 5.0 - 13.0</title>
<link href="/captive-portal-android.html"/>
<url>/captive-portal-android.html</url>
<content type="html"><![CDATA[<p>使用(类)原生 Android 的用户在中国大陆会发现状态栏的网络信号有个叉或者是感叹号,这是为什么呢?又该如何去除? </p><span id="more"></span><h2 id="说明"><a href="#说明" class="headerlink" title="说明"></a>说明</h2><p><a href="https://developer.android.com/reference/android/net/CaptivePortal">CaptivePortal</a> 是 Android 5.0 引入的一种检测网络是否正常连接的机制,通过 HTTP 返回的状态码是否是 204 来判断是否成功,如果访问得到了 200,那你就可能处在一个需要登录验证才能上网的环境里,比如说校园网,再比如说一些酒店提供的客户才能免费使用的 Wi-Fi(其实是通过 DNS 劫持实现的),如果连接超时(根本就连接不上)就在 Wi-Fi 图标和信号图标上加一个标志,Android 5 和 Android 6 是叹号,Android 7 改成一个叉了。只不过默认访问的是谷歌自家的验证服务器,然而 Google 是被墙掉了,导致 Android 没有办法正确评估网络。所以,系统每隔一定时间都会重新尝试连接,就在不知不觉中消耗了数据流量。更恐怖的就是 Android 认为在 Wi-Fi 下无法连接互联网,就让联网的程序通通走流量…</p><h2 id="ADB-工具"><a href="#ADB-工具" class="headerlink" title="ADB 工具"></a>ADB 工具</h2><p>要想去除,需要用到一个工具,那就是 ADB,<a href="https://dl.google.com/android/repository/platform-tools-latest-windows.zip">点此</a> 下载(需要科学上网)。然后请自行搞定 ADB 的环境变量配置,如果不会请<a href="https://ericclose.github.io/How-to-Convert-Edge-S-Pro-to-Retail-Europe.html#%E9%85%8D%E7%BD%AE-ADB-%E7%9A%84%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F">点此</a>。配置好后,请在<strong>手机设置</strong>里开启<strong>开发者选项</strong>,然后再打开<strong>USB 调试</strong>。最后通过数据线连接电脑,就可以开搞了。</p><h2 id="解决方法"><a href="#解决方法" class="headerlink" title="解决方法"></a>解决方法</h2><h3 id="Android-5-0-6-0"><a href="#Android-5-0-6-0" class="headerlink" title="Android 5.0 - 6.0"></a>Android 5.0 - 6.0</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 删除地址就可以恢复默认的谷歌服务器</span></span><br><span class="line">adb shell settings delete global captive_portal_server</span><br><span class="line"><span class="comment"># 设置一个可用地址</span></span><br><span class="line">adb shell settings put global captive_portal_server http://developers.google.cn/generate_204</span><br><span class="line"><span class="comment"># 查询当前地址</span></span><br><span class="line">adb shell settings get global captive_portal_server</span><br></pre></td></tr></table></figure><p><strong>注意</strong>:执行完后请打开飞行模式后再关闭</p><h3 id="Android-7-0-Android-13-0"><a href="#Android-7-0-Android-13-0" class="headerlink" title="Android 7.0 - Android 13.0"></a>Android 7.0 - Android 13.0</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 删除(删除默认用 HTTPS )</span></span><br><span class="line">adb shell settings delete global captive_portal_https_url</span><br><span class="line">adb shell settings delete global captive_portal_http_url</span><br><span class="line"><span class="comment"># 设置一个可用地址</span></span><br><span class="line">adb shell settings put global captive_portal_http_url http://developers.google.cn/generate_204</span><br><span class="line">adb shell settings put global captive_portal_https_url https://developers.google.cn/generate_204</span><br></pre></td></tr></table></figure><p><strong>注意</strong>:最后,请打开飞行模式后再把飞行模式关掉就好啦~</p><hr><h2 id="更改-NTP-服务器(网络时间校准)"><a href="#更改-NTP-服务器(网络时间校准)" class="headerlink" title="更改 NTP 服务器(网络时间校准)"></a>更改 NTP 服务器(网络时间校准)</h2><p>如果更改完 Captive Portal 的服务器(即上述操作)后信号仍然显示叉叉,或者说网络受限。原因可能是因为当地网络环境 NTP 服务器受限,导致时间无法校准。</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 删除(删除默认用 NTP 服务器 )</span></span><br><span class="line">adb shell settings delete global ntp_server</span><br><span class="line"><span class="comment"># 设置一个可用的 NTP 服务器(此处为 Apple 公司在亚洲的 NTP 服务器,我知道 Android 机器用 Apple 的时间服务器很不清真,哈哈哈哈)</span></span><br><span class="line">adb shell settings put global ntp_server time.asia.apple.com</span><br></pre></td></tr></table></figure><p>请前往「<strong>Settings</strong> 设置」 -> 「<strong>System</strong> 系统」 -> 「<strong>Advanced</strong> 高级」 -> 「<strong>Date and time</strong> 日期和时间」,确保「<strong>Use network-provided time</strong> 使用网络提供时间」和「<strong>Use network-provided timezone</strong> 使用网络提供的时区」2 个选项已启用,然后重新开关一次飞行模式应该就可以了。</p>]]></content>
<categories>
<category> Android </category>
</categories>
<tags>
<tag> Android </tag>
<tag> 类原生 </tag>
</tags>
</entry>
<entry>
<title>使用 you-get 下载视频</title>
<link href="/you-get-tutorial.html"/>
<url>/you-get-tutorial.html</url>
<content type="html"><![CDATA[<p>You-get 是一个小巧的能够用于下载网络媒体内容(视频,音频,图片)的命令行程序。开发者是<a href="https://github.com/soimort">soimort</a>,仓库<a href="https://github.com/soimort/you-get">点击这里</a>访问</p><p><img src="https://cdn.jsdelivr.net/gh/ericclose/images/you-get.png"></p><span id="more"></span><h2 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h2><p>以下乃必要依赖,需要单独安装:</p><ul><li><strong>Python 3</strong> 的下载链接: <a href="https://www.python.org/downloads/">https://www.python.org/downloads/</a></li><li><strong>FFmpeg</strong> 的下载链接: <a href="https://ffmpeg.org/download.html">https://ffmpeg.org/download.html</a></li></ul><blockquote><p>必备配置:自行解决 Python 和 FFmpeg <strong>环境变量</strong> 的配置,此处不赘述,不懂怎么配置就用用万能的搜索引擎。</p></blockquote><h2 id="安装-you-get-和-PySocks"><a href="#安装-you-get-和-PySocks" class="headerlink" title="安装 you-get 和 PySocks"></a>安装 you-get 和 PySocks</h2><blockquote><p>经过前面的准备工作后,就可以开始安装 you-get 了</p></blockquote><p>打开 <code>cmd</code> ,通过 <code>pip</code> 安装 <code>you-get</code> ,即输入如下命令:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pip3 install you-get</span><br></pre></td></tr></table></figure><blockquote><p>如果需要 <code>you-get</code> 通过 SOCKS5 代理(如 Shadowsocks / ShadwoskcsR)下载 <a href="https://www.youtube.com/">YouTube</a> 的视频,还得安装 <strong>PySocks</strong></p></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pip3 install PySocks</span><br></pre></td></tr></table></figure><h2 id="使用说明"><a href="#使用说明" class="headerlink" title="使用说明"></a>使用说明</h2><ul><li>当观赏感兴趣的视频之前,您可以使用 –info/-i 以查看所有可用画质与格式。如:<br>在 <code>cmd</code> 上输入 <em>you-get -i <a href="https://www.bilibili.com/video/av33503264">https://www.bilibili.com/video/av33503264</a></em> ,输出如下:</li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">site: Bilibili</span><br><span class="line">title: 【官方双语】游戏本?轻薄本?谁才是便携游戏之本?#linus谈科技</span><br><span class="line">streams: # Available quality and codecs</span><br><span class="line"> [ DEFAULT ] _________________________________</span><br><span class="line"> - format: hdflv</span><br><span class="line"> container: flv</span><br><span class="line"> size: 192.0 MiB (201363047 bytes)</span><br><span class="line"> # download-with: you-get --format=hdflv [URL]</span><br><span class="line"></span><br><span class="line"> - format: flv720</span><br><span class="line"> container: flv</span><br><span class="line"> size: 150.1 MiB (157350612 bytes)</span><br><span class="line"> # download-with: you-get --format=flv720 [URL]</span><br><span class="line"></span><br><span class="line"> - format: flv</span><br><span class="line"> container: flv</span><br><span class="line"> size: 82.2 MiB (86192476 bytes)</span><br><span class="line"> # download-with: you-get --format=flv [URL]</span><br></pre></td></tr></table></figure><ul><li>使用以下命令即可下载默认画质:</li></ul><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">you-get -o <span class="string">"F:\Downloads"</span> -O <span class="string">"谁才是便携游戏之本?"</span> https://www.bilibili.com/video/av33503264</span><br></pre></td></tr></table></figure><p><strong>这里值得说明的是:</strong></p><ul><li><code>-o</code> 后面的是视频需要下载至的路径,如果你输入的时候没有这个选项的话就默认下载到 cmd 的工作目录下,如下图的工作目录就是 <code>C:\Users\Innovation</code></li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/you-get/cmd-workplace.png' data-fancybox='default' data-caption='cmd 的工作路径'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/you-get/cmd-workplace.png" alt="cmd 的工作路径"></a><span class='image-caption'>cmd 的工作路径</span></div></div><ul><li><code>-O</code> 后面则是保存的名字,你输入的时候 <strong>没有</strong> 这个选项的的话,文件名字就是默认为前面的 Title,即 <code>【官方双语】游戏本?轻薄本?谁才是便携游戏之本?#linus谈科技</code></li></ul><p>那么如果你想要下载其他画质或格式的视频你又该怎样呢?</p><p>比如说我们选择上面示例中的 <code>82.2 MiB</code> 大小的那个画质,只需要在url(即 <em><a href="https://www.bilibili.com/video/av33503264">https://www.bilibili.com/video/av33503264</a></em> )之前添加 <code>--format=flv</code> (根据前面的 <code># download-with: you-get --format=flv [URL]</code> 得知)即可</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/you-get/download-with.png' data-fancybox='default' data-caption='画质格式选择'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/you-get/download-with.png" alt="画质格式选择"></a><span class='image-caption'>画质格式选择</span></div></div><p>如果中途想暂停了,怎么办?</p><ul><li>暂停与恢复下载<ul><li>可以使用 <kbd>Ctrl</kbd> + <kbd>C</kbd> 暂停下载.</li><li>临时的 <code>*.download</code> 文件将保存于输出目录。下次使用 you-get 传入相同参数时,下载将从上次继续开始。</li></ul></li></ul><h2 id="代理问题"><a href="#代理问题" class="headerlink" title="代理问题"></a>代理问题</h2><p>当需要使用SOCKS5代理(Shdowsocks / ShadowsocksR)时,您可以使用 <code>-s</code> 选项设置socks代理。如:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">you-get -s 127.0.0.1:1080 https://www.youtube.com/watch?v=jNQXAC9IVRw</span><br></pre></td></tr></table></figure><blockquote><p>注意:上面的 <code>1080</code> 是我 Shadowsocks / ShadowsocksR 的端口号,如果你的不是这个端口号,请自行更改。</p></blockquote>]]></content>
<categories>
<category> Tools </category>
</categories>
<tags>
<tag> you-get </tag>
<tag> 下载 </tag>
<tag> 工具 </tag>
</tags>
</entry>
<entry>
<title>Navicat 软件官网及其 Crack</title>
<link href="/navicat.html"/>
<url>/navicat.html</url>
<content type="html"><![CDATA[<p>本文提供 Navicat 的官网,如果条件允许请支持正版。当然本文依然会提供 crack 过程</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/navicat.png" alt="image" style="width:450px;"/></div></div><span id="more"></span><h2 id="Navicat-官网"><a href="#Navicat-官网" class="headerlink" title="Navicat 官网"></a>Navicat 官网</h2><ul><li>中文官网产品页面:<a href="https://www.navicat.com.cn/">https://www.navicat.com.cn/</a></li><li>英文官网产品页面:<a href="https://www.navicat.com/en/">https://www.navicat.com/en/</a></li></ul><h2 id="Crack-激活"><a href="#Crack-激活" class="headerlink" title="Crack 激活"></a>Crack 激活</h2><blockquote><p>准备:进入官方产品页面,选中 Free Trail(免费试用),然后下载相应的安装包,下载完后安装后即可。经测试该工具已支持 Navicat 软件的 12.1.22 版本。</p></blockquote><p>工具由<a href="https://github.com/DoubleLabyrinth">DoubleLabyrinth</a>开发,如果感兴趣<a href="https://github.com/DoubleLabyrinth/navicat-keygen">点此</a>跳转到仓库,使用方法如下:</p><ol><li><p>下载 <code>navicat-keygen-for-x64.zip</code> ,<a href="https://github.com/DoubleLabyrinth/navicat-keygen/releases/latest">点此</a>下载</p></li><li><p>解压 <code>navicat-keygen-for-x64.zip</code> 至合适目录,如 <code>D:\Program Files\navicat-keygen\</code> 目录下</p></li><li><p>以 <strong>管理员身份运行</strong> cmd,执行下列两行命令(命令的解释在命令后面一行提供)。如:</p></li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /d <span class="string">"D:\Program Files\navicat-keygen"</span></span><br></pre></td></tr></table></figure><blockquote><p>此处我解压的具体路径为 <code>D:\Program Files\navicat-keygen</code> ,所以 <code>cd /d</code> 后面就接着这个路径。</p></blockquote><ol start="4"><li>在cmd上使用 <strong>navicat-patcher.exe</strong> 替换掉 <strong>navicat.exe</strong> 和 <strong>libcc.dll</strong> 里的Navicat激活公钥。即执行如下命令:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">navicat-patcher.exe <span class="string">"D:\Program Files\PremiumSoft\Navicat 12 for MySQL"</span></span><br></pre></td></tr></table></figure><p><code>D:\Program Files\PremiumSoft\Navicat 12 for MySQL</code> 是我以Navicat 12 for MySQL的安装路径为例,请根据你需要 Crack 的 Navicat <strong>任一软件</strong> 的安装路径进行修改<br>执行完这条命令后的一份样例输出:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br></pre></td><td class="code"><pre><span class="line">***************************************************</span><br><span class="line">* Navicat Patcher by @DoubleLabyrinth *</span><br><span class="line">* Version: 4.0 *</span><br><span class="line">***************************************************</span><br><span class="line"></span><br><span class="line">Press Enter to continue or Ctrl + C to abort.</span><br><span class="line"></span><br><span class="line">[+] Try to open Navicat.exe ... Ok!</span><br><span class="line">[+] Try to open libcc.dll ... Ok!</span><br><span class="line"></span><br><span class="line">[+] PatchSolution0 ...... Ready to apply</span><br><span class="line"> [*] Patch offset = +0x029bccd8</span><br><span class="line">[+] PatchSolution1 ...... Ready to apply</span><br><span class="line"> [*] [0] Patch offset = +0x02206c00</span><br><span class="line"> [*] [1] Patch offset = +0x0074c489</span><br><span class="line"> [*] [2] Patch offset = +0x02206910</span><br><span class="line"> [*] [3] Patch offset = +0x0074c46f</span><br><span class="line"> [*] [4] Patch offset = +0x02206904</span><br><span class="line">[-] PatchSolution2 ...... Omitted</span><br><span class="line">[+] PatchSolution3 ...... Ready to apply</span><br><span class="line"> [*] [ 0] Instruction RVA = 0x016539c8, Patch Offset = +0x023e64d4</span><br><span class="line"> [*] [ 1] Instruction RVA = 0x01653a1f, Patch Offset = +0x01652e23</span><br><span class="line"> [*] [ 2] Instruction RVA = 0x01653a25, Patch Offset = +0x01652e28</span><br><span class="line"> [*] [ 3] Instruction RVA = 0x01653a8c, Patch Offset = +0x01652e8e</span><br><span class="line"> ...</span><br><span class="line"> ...</span><br><span class="line"> ...</span><br><span class="line"> [*] [108] Instruction RVA = 0x016604e1, Patch Offset = +0x023e66d8</span><br><span class="line"> [*] [109] Instruction RVA = 0x01660518, Patch Offset = +0x0165f91c</span><br><span class="line"> [*] [110] Instruction RVA = 0x0166051e, Patch Offset = +0x0165f921</span><br><span class="line"></span><br><span class="line">[*] PatchSolution0 is suppressed in order to keep digital signature valid.</span><br><span class="line"></span><br><span class="line">[*] Generating new RSA private key, it may take a long time...</span><br><span class="line">[*] Your RSA public key:</span><br><span class="line">-----BEGIN PUBLIC KEY-----</span><br><span class="line">MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1hV66HgU4LrKXWW6O7bK</span><br><span class="line">AN6ZTr5W+Mq8ClTQ+Pc+BdhLu6rww55kVq7OXKGpvx0G4eTafYMGrrBETgDSTaMq</span><br><span class="line">Bx+8bZbGBWh2LtNfqU+xUrpHHBSz0ByBc3iTEzzthJl+Fzf8suDX2lWYIc/Ym/eW</span><br><span class="line">YtxdJ7xOzLb68z4N0zVmA0jFX2FOm75DRYgKqy4SGixapfucL9dVaWVLTUdbrVdj</span><br><span class="line">4LX78t4t5ykbYoThrat4yuLvj/BxLaQ6ivKD+ScfHdtCoY+NA5jmBoUfBq3Q1SXB</span><br><span class="line">iNaoXctbi0/H3MiPu0cRojryAocooF89yFm5/mNnzWGAYPr6DvBI8CDTZmjaQ4oC</span><br><span class="line">aQIDAQAB</span><br><span class="line">-----END PUBLIC KEY-----</span><br><span class="line"></span><br><span class="line">*******************************************************</span><br><span class="line">* PatchSolution1 *</span><br><span class="line">*******************************************************</span><br><span class="line">[*] Previous:</span><br><span class="line">+0x0000000002206c00 44 37 35 31 32 35 42 37 30 37 36 37 42 39 34 31 D75125B70767B941</span><br><span class="line">+0x0000000002206c10 34 35 42 34 37 43 31 43 42 33 43 30 37 35 35 45 45B47C1CB3C0755E</span><br><span class="line">+0x0000000002206c20 37 43 43 42 38 38 32 35 43 35 44 43 45 30 43 35 7CCB8825C5DCE0C5</span><br><span class="line">...</span><br><span class="line">...</span><br><span class="line">[*] After:</span><br><span class="line">+0x0000000002206c00 33 43 32 39 30 39 35 38 33 34 38 41 42 43 35 39 3C290958348ABC59</span><br><span class="line">+0x0000000002206c10 36 44 39 30 43 45 45 38 31 36 42 36 39 38 34 44 6D90CEE816B6984D</span><br><span class="line">+0x0000000002206c20 35 32 35 34 37 45 30 32 34 31 42 36 42 43 31 41 52547E0241B6BC1A</span><br><span class="line">...</span><br><span class="line">...</span><br><span class="line"></span><br><span class="line">[*] Previous:</span><br><span class="line">+0x000000000074c480 fe ea bc 01 ....</span><br><span class="line">[*] After:</span><br><span class="line">+0x000000000074c480 08 00 00 00 ....</span><br><span class="line"></span><br><span class="line">[*] Previous:</span><br><span class="line">+0x0000000002206910 45 31 43 45 44 30 39 42 39 43 32 31 38 36 42 46 E1CED09B9C2186BF</span><br><span class="line">+0x0000000002206920 37 31 41 37 30 43 30 46 45 32 46 31 45 30 41 45 71A70C0FE2F1E0AE</span><br><span class="line">+0x0000000002206930 46 33 42 44 36 42 37 35 32 37 37 41 41 42 32 30 F3BD6B75277AAB20</span><br><span class="line">...</span><br><span class="line">...</span><br><span class="line">[*] After:</span><br><span class="line">+0x0000000002206910 41 33 39 42 41 36 43 34 31 36 33 32 35 30 46 45 A39BA6C4163250FE</span><br><span class="line">+0x0000000002206920 42 32 41 39 31 41 34 32 46 44 42 46 30 41 32 31 B2A91A42FDBF0A21</span><br><span class="line">+0x0000000002206930 33 34 46 34 36 44 43 45 34 30 42 46 41 42 33 35 34F46DCE40BFAB35</span><br><span class="line">...</span><br><span class="line">...</span><br><span class="line"></span><br><span class="line">[*] Previous:</span><br><span class="line">+0x000000000074c460 59 Y</span><br><span class="line">+0x000000000074c470 08 01 00 ...</span><br><span class="line">[*] After:</span><br><span class="line">+0x000000000074c460 06 .</span><br><span class="line">+0x000000000074c470 00 00 00 ...</span><br><span class="line"></span><br><span class="line">[*] Previous:</span><br><span class="line">+0x0000000002206900 39 32 39 33 33 92933</span><br><span class="line">[*] After:</span><br><span class="line">+0x0000000002206900 42 34 34 33 38 B4438</span><br><span class="line"></span><br><span class="line">*******************************************************</span><br><span class="line">* PatchSolution3 *</span><br><span class="line">*******************************************************</span><br><span class="line">[*] +023e64d4: 4d 49 49 ---> 4d 49 49</span><br><span class="line">[*] +01652e23: 42 49 ---> 42 49</span><br><span class="line">[*] +01652e28: 6a ---> 6a</span><br><span class="line">...</span><br><span class="line">...</span><br><span class="line">...</span><br><span class="line">[*] +023e66d8: 77 49 44 41 ---> 51 49 44 41</span><br><span class="line">[*] +0165f91c: 51 41 ---> 51 41</span><br><span class="line">[*] +0165f921: 42 ---> 42</span><br><span class="line"></span><br><span class="line">[*] New RSA-2048 private key has been saved to</span><br><span class="line">D:\Program Files\navicat-keygen\RegPrivateKey.pem</span><br><span class="line"></span><br><span class="line">*******************************************************</span><br><span class="line">* PATCH HAS BEEN DONE SUCCESSFULLY! *</span><br><span class="line">* HAVE FUN AND ENJOY~ *</span><br><span class="line">*******************************************************</span><br></pre></td></tr></table></figure><ol start="5"><li>接下来 <strong>cmd</strong> 上使用 <code>navicat-keygen.exe</code> 来生成序列号和激活码,即执行如下命令:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">navicat-keygen.exe -text .\RegPrivateKey.pem</span><br></pre></td></tr></table></figure><ol start="6"><li>执行步骤5后,你会被要求选择Navicat产品类别、语言以及输入主版本号。之后会随机生成一个序列号。输出如下:</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br></pre></td><td class="code"><pre><span class="line">Select Navicat product:</span><br><span class="line">0. DataModeler</span><br><span class="line">1. Premium</span><br><span class="line">2. MySQL</span><br><span class="line">3. PostgreSQL</span><br><span class="line">4. Oracle</span><br><span class="line">5. SQLServer</span><br><span class="line">6. SQLite</span><br><span class="line">7. MariaDB</span><br><span class="line">8. MongoDB</span><br><span class="line">9. ReportViewer</span><br><span class="line"></span><br><span class="line">(Input index)> 2</span><br><span class="line"></span><br><span class="line">Select product language:</span><br><span class="line">0. English</span><br><span class="line">1. Simplified Chinese</span><br><span class="line">2. Traditional Chinese</span><br><span class="line">3. Japanese</span><br><span class="line">4. Polish</span><br><span class="line">5. Spanish</span><br><span class="line">6. French</span><br><span class="line">7. German</span><br><span class="line">8. Korean</span><br><span class="line">9. Russian</span><br><span class="line">10. Portuguese</span><br><span class="line"></span><br><span class="line">(Input index)> 0</span><br><span class="line"></span><br><span class="line">(Input major version number, range: 0 ~ 15, default: 12)> 12</span><br><span class="line"></span><br><span class="line">Serial number:</span><br><span class="line">NAVO-2ORP-IN5A-GQEE</span><br><span class="line"></span><br><span class="line">Your name: </span><br></pre></td></tr></table></figure><blockquote><ul><li>由于我以 <code>Navicat 12 for MySQL</code> 英文版为例,所以我第一个输入(<code>产品类别</code>) 是 <code>2</code> ,第二个输入 (<code>语言</code>) 是 <code>0</code> ,第三个输入(主版本号)是 <code>12</code> ,最后生成了序列号 <code>NAVO-2ORP-IN5A-GQEE</code> (<strong>留着等下用</strong>)。</li></ul></blockquote><p>接下来你会被要求输入 <strong>用户名</strong> 和 <strong>组织名</strong> ;请随便填写,但不要太长。</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">Your name: username</span><br><span class="line">Your organization: Organization</span><br><span class="line">Input request code (in Base64), input empty line to end:</span><br></pre></td></tr></table></figure><ul><li>如上我将用户名设为 <code>username</code> ,组织名设为 <code>Organization</code> 。</li></ul><blockquote><p>之后你会被要求填入请求码。注意:<strong>不要关闭</strong>cmd.</p></blockquote><ol start="8"><li><p><strong>断开网络</strong> 并打开 Navicat 软件。找到注册窗口,并填入刚才程序生成的序列号。然后点击 <code>激活</code> 按钮。</p></li><li><p>然后 Navicat 软件会说激活失败,并询问你是否 <code>手动激活</code> ,直接选择 <code>手动激活</code> 即可</p></li></ol><p>在 <code>手动激活窗口</code> 你会得到一个请求码,复制它并把它粘贴到 cmd 里。最后别忘了连按至少两下回车结束输入。</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">[*] Your name: username</span><br><span class="line">[*] Your organization: Organization</span><br><span class="line">[*] Input request code in Base64: (Input empty line to end)</span><br><span class="line">Gz7OvJvHLKAxokLXKwhDjhvj0LsRL5C019OMDMJBRwapfMUbyXTYFzgvOF1VJw0hH5BWUvm5vUWq</span><br><span class="line">pJzGFRdtOew8oc3gKEkJNWamoqZmJqXgEROXDGxm/6WTjZDVeXUA1YZkHmzqN+MfC3gKwW/OlBpb</span><br><span class="line">s3cdaQnqQqmVyb9Pa+G+/x8RxsgxgBg0mhrtaWJj9QTlOtP1L7+OfTreSINTHF634iEtVlT5ppUb</span><br><span class="line">5oSWgyHlHHqDNP+bVKIaPStRLri3+7HSi2SVN+GAiXLWSf2oXemQmqWFcMckh187PBPvxvjAOSs7</span><br><span class="line">NJRMOeKC4s/IDLlOCGsXfIbVEA2aUYPfbIeqrQ==</span><br><span class="line"></span><br><span class="line">[*] Request Info:</span><br><span class="line">{"K":"NAVP3B3ISW2WKNFP", "DI":"+ZnYuzjIyVrKpNGSWB4k", "P":"WIN 8"}</span><br><span class="line"></span><br><span class="line">[*] Response Info:</span><br><span class="line">{"K":"NAVP3B3ISW2WKNFP","DI":"+ZnYuzjIyVrKpNGSWB4k","N":"User","O":"Organization","T":1571627725}</span><br><span class="line"></span><br><span class="line">[*] Activation Code:</span><br><span class="line">sdNrmWhr/uPZI4lyIgtSyf+00CZwng5ItzIh59VDKjKGloKPW5DZoSa6bSKxRXaJhlL+NrKEZmfk4zZA4yG0sinEZML4xCeSy0Wf/nlInZqzuvdgJD+cj4tb5HlpN3BGFAR3s3tfTd8WR9YoG/lBXC6UG6J1BWDB1Se5yuKoD12puWMxt3hc2bodrQRUrPDle1vOTS16iMd2b2Ck1kSok1ef5nK48N28IN9iTiNhQ7xTae2u9/1NCWS5VNDW9oZ4SnR99kmfZMxsK00STZntcboUGaYuW3TbJcs2UHrilESYE58XXhs1BFHSSy2Gu7HTOWrUBkRLZQB1oBNNLVS2Kw==</span><br></pre></td></tr></table></figure><ol start="11"><li>如果不出意外,你会得到一个 <code>Activation Code</code> 。直接复制它,并把它粘贴到Navicat的 <code>手动激活窗口</code> ,最后点激活按钮。如果没什么意外的话应该能成功激活。<br>复制的 <code>Activation Code</code> 内容为:</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sdNrmWhr/uPZI4lyIgtSyf+00CZwng5ItzIh59VDKjKGloKPW5DZoSa6bSKxRXaJhlL+NrKEZmfk4zZA4yG0sinEZML4xCeSy0Wf/nlInZqzuvdgJD+cj4tb5HlpN3BGFAR3s3tfTd8WR9YoG/lBXC6UG6J1BWDB1Se5yuKoD12puWMxt3hc2bodrQRUrPDle1vOTS16iMd2b2Ck1kSok1ef5nK48N28IN9iTiNhQ7xTae2u9/1NCWS5VNDW9oZ4SnR99kmfZMxsK00STZntcboUGaYuW3TbJcs2UHrilESYE58XXhs1BFHSSy2Gu7HTOWrUBkRLZQB1oBNNLVS2Kw==</span><br></pre></td></tr></table></figure><p>大功告成,自行测试是否已激活。</p>]]></content>
<categories>
<category> Windows </category>
</categories>
<tags>
<tag> 激活 </tag>
<tag> Navicat </tag>
<tag> 破解 </tag>
</tags>
</entry>
<entry>
<title>用 Windows 内置工具制作安装U盘</title>
<link href="/windows-diskpart-tutorial.html"/>
<url>/windows-diskpart-tutorial.html</url>
<content type="html"><![CDATA[<p>Diskpart 命令是 Windows 环境下的一个命令,利用 Diskpart 和解压缩软件即可制作好 Windows 安装U盘。</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/diskpart.jpg" alt="image" style="width:350px;"/></div></div><span id="more"></span><h2 id="过程"><a href="#过程" class="headerlink" title="过程"></a>过程</h2><h3 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h3><ul><li><p>由于制作过程需要格式化U盘,在操作之前切记先备份好数据!</p></li><li><p>从微软官方下载好 Windows 映像文件 (即 ISO 文件), 点击<a href="https://www.microsoft.com/zh-cn/software-download/windows10">此处</a></p><ul><li>虽说利用微软的工具可以直接制作好Windows 10 的安装U盘,但是每次需要重装的时候就要再次联网下载映像文件就太麻烦了。所以此处骚操作(斜眼笑~</li></ul></li></ul><ol><li><p>点击进入前面提供的网站后,以 Chrome浏览器 为例子, 按 <strong>Ctrl + Shift + I</strong> 打开 Chrome 的开发人员工具。</p></li><li><p>点击开发人员工具右上方的“…”按钮,选择“More Tools”、“Network conditions”。如下图</p></li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/diskpart_tutorial1.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/diskpart_tutorial1.png"></a><span></span></div></div><ol start="3"><li>反选 “Select automatically”</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/diskpart_tutorial2.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/diskpart_tutorial2.png"></a><span></span></div></div><ol start="4"><li>选择 Safari - Mac</li></ol><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/diskpart_tutorial3.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/diskpart_tutorial3.png"></a><span></span></div></div><ol start="5"><li><p>不要关闭 Chrome 的开发人员工具,刷新网页,这时就可以直接在这个网站里下载 ISO 文件了。</p></li><li><p>选择 “Windows 10”,而不是 “Windows 10家庭中文版”</p></li></ol><p><img src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/diskpart_tutorial4.png"></p><blockquote><p>理由:虽说大多数人买来的电脑预装的 Windows 10 都是家庭中文版的,但是这种家庭版是独具“中国特色”的,与国际版的不同是,不能在设置里面修改系统显示语言,只能是中文,至于其他差别倒是没注意啦。除此之外,不选“Windows 10 家庭中文版”还有一部分原因是因为有些电脑预装的系统不是家庭版的,比如说专业版或者企业版,考虑到这种情况,所以统一选择“Windows 10”。</p></blockquote><blockquote><p><strong>注意</strong></p><p>下载 “Windows 10” 的用户,在启动的时候有家庭版,专业版,单语言版等提供选择。具体选择应该是根据你电脑预装的系统来选择,这样系统才会自动激活。安装了错误版本的系统将无法自动激活。打个比方,我电脑预装的是 “Windows 10 家庭中文版”,如果我安装的时候选择的是”家庭版”,那么开机联网后 Windows 就会自动激活,但如果选错了,如”专业版”,”单语言版”等非”家庭版”的开机联网都不会激活的。</p></blockquote><ol start="7"><li><p>选完之后点击“确定”</p></li><li><p>选择“简体中文”,确定就好了,(当然你可以选择其他偏好的语言(家庭中文版除外))</p></li><li><p>这个时候就会有“32 bit” 和“64 bit”,根据自己实际情况选择即可。</p></li><li><p>选完后就开始下载了。</p></li><li><p>直到下载完毕就完成一大半了。</p></li></ol><h3 id="开始动手"><a href="#开始动手" class="headerlink" title="开始动手"></a>开始动手</h3><p>经过之前的备份和下载,现在终于可以开工了。<br>Win + R ,输入diskpart,回车确认</p><p><img src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/diskpart_tutorial5.png"></p><hr><h4 id="分区方案"><a href="#分区方案" class="headerlink" title="分区方案"></a>分区方案</h4><table><thead><tr><th align="center">分区用途</th><th align="center">文件系统</th><th align="center">大小</th><th align="center">盘符</th></tr></thead><tbody><tr><td align="center">启动分区</td><td align="center">FAT32</td><td align="center">1 GB</td><td align="center"><code>G</code></td></tr><tr><td align="center">sources 分区</td><td align="center">NTFS</td><td align="center">6 GB</td><td align="center"><code>H</code></td></tr><tr><td align="center">用户数据分区</td><td align="center">exFAT</td><td align="center">取决于你的U盘的大小</td><td align="center"><code>I</code></td></tr></tbody></table><ul><li>BIOS 支持启动分区的文件系统只有 FAT32,所以我们创建了 1 GB 的分区,专门<strong>用于存放启动相关的文件</strong></li><li>创建的 6 GB 大小的分区,使用 NTFS 文件系统的理由是,镜像文件里的 sources 文件夹存在单个文件大于 4 GB 的情况,FAT32 不能超过这个限制,所以我们建了这个 NTFS 分区</li><li>剩余的分区全部分完,此分区采用 exFAT 的文件系统(该文件系统支持单个文件超过 4GB 的情况,同时支持 Windows、Linux、和 Android 系统),专门用于存放用户数据</li></ul><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/1.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/1.png"></a><span></span></div></div><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/2.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/2.png"></a><span></span></div></div><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/3.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/3.png"></a><span></span></div></div><hr><h4 id="制作启动盘"><a href="#制作启动盘" class="headerlink" title="制作启动盘"></a>制作启动盘</h4><p>完成上述分区操作后,我们将系统镜像(<code>*.iso</code> 文件)先通过解压缩软件(如 <a href="https://7-zip.org/">7-zip</a>)解压至硬盘的某处。</p><ol><li>启动分区(G 盘)</li></ol><p>将解压得到的内容,<strong>除 <code>sources</code> 文件夹外</strong>复制到启动分区(本文例子为<code>G</code>盘):</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/4.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/4.png"></a><span></span></div></div><p>手动在 G 盘创建 <code>sources</code> 文件夹,然后将前面解压系统镜像得到的 <code>sources\boot.wim</code> 复制到 <code>G:\sources\</code></p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/5.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/5.png"></a><span></span></div></div><ol start="2"><li>sources 分区(H 盘)</li></ol><p>只需将前面解压得到的 <code>souces</code> 文件夹完整的复制到 H 盘即可</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/6.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/6.png"></a><span></span></div></div><ol start="3"><li>用户数据分区(I 盘)</li></ol><p>U盘用来存放其他文件的分区,以后存数据放这里就行</p><ol start="4"><li>重新分配盘符</li></ol><p>为了让<strong>启动分区</strong>和 <strong>sources 分区</strong>在资源管理器中不可见,我们可以移除相应的盘符 G、H,然后可以将用户数据分区的盘符分配为 G 盘(因为前面的分区盘符移除了,盘符 G 得以释放)</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/7.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/7.png"></a><span></span></div></div><p>最终成果如下:</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/8.png' data-fancybox='default' data-caption='undefined'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/diskpart-tutorial/8.png"></a><span></span></div></div><h2 id="命令总结"><a href="#命令总结" class="headerlink" title="命令总结"></a>命令总结</h2><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">list disk //显示本机的所有磁盘,以便正确操作目标磁盘</span><br><span class="line">list partition //显示选中磁盘的所有分区</span><br><span class="line"><span class="keyword">select</span> disk 0 //选择 0 号磁盘</span><br><span class="line"><span class="keyword">select</span> partition 1 //选择 1 号分区</span><br><span class="line">clean //清除选中磁盘上的所有分区(包括数据)</span><br><span class="line">create partition primary size=xxxx //创建主分区,容量为:xxxx MB </span><br><span class="line">active //将选中分区标记为活动分区(当该分区作为启动分区的时候才需要这个操作)</span><br><span class="line">format fs=文件系统 quick //快速格式化当前分区(自行选择合适的文件系统)</span><br><span class="line">remove letter=盘符 //移除选中分区的盘符</span><br><span class="line">create partition primary //将选中磁盘的未分配的所有空间用来创建主分区</span><br><span class="line">assign letter=盘符 //给选中分区分配盘符</span><br></pre></td></tr></table></figure><p>完结~</p>]]></content>
<categories>
<category> Windows </category>
</categories>
<tags>
<tag> Windows </tag>
<tag> diskpart </tag>
<tag> 启动盘 </tag>
</tags>
</entry>
<entry>
<title>GitHub + Hexo 博客搭建</title>
<link href="/github-pages-with-hexo.html"/>
<url>/github-pages-with-hexo.html</url>
<content type="html"><![CDATA[<p>此文介绍了搭建 Hexo 博客的全过程。然而在安装前,您必须检查电脑中是否已安装下列应用程序</p><div class="img-wrap"><div class="img-bg"><img class="img" src="https://cdn.jsdelivr.net/gh/ericclose/images/github-pages-with-hexo/github-hexo-logo.png" alt="image" style="width:350px;"/></div></div><span id="more"></span><h2 id="必备应用"><a href="#必备应用" class="headerlink" title="必备应用"></a>必备应用</h2><ul><li><a href="https://nodejs.org/en">Node.js</a><ul><li>首先下载最新的 LTS(长期支持版)的 Node.js,除了安装路径自选外,其它选项全部默认,一路点击 Next 即可。最后安装好之后,cmd 输入 <code>node -v</code>,如果出现版本号,那么就安装成功了。</li></ul></li><li><a href="https://git-scm.com/">Git</a><ul><li>除了安装路径自选外,有一步我们要确保勾选 <strong>Git Bash Here</strong>,取消 <strong>Git GUI Here</strong> 的选项,其余选项默认,一路点击 Next,安装完后就可以直接在鼠标右键菜单选项里打开 Git Bash 了。可以在 Git Bash 输入 <code>git --version</code> 验证是否安装成功</li></ul></li><li><a href="https://yarnpkg.com/">yarn</a><ul><li><code>Node.js</code> >=16.10 版本之后本身就包含了 yarn 这个包管理器,但是默认没有启用。我们可以通过<strong>以管理员身份运行</strong> cmd,执行命令启用:</li></ul></li></ul><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">corepack enable</span><br></pre></td></tr></table></figure><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/github-pages-with-hexo/1.png' data-fancybox='default' data-caption='经过验证,上述软件均安装成功'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/github-pages-with-hexo/1.png" alt="经过验证,上述软件均安装成功"></a><span class='image-caption'>经过验证,上述软件均安装成功</span></div></div><p>本教程假定你已经安装上述必备程序。这里我还想说一句,很多教程是用 <code>npm</code> 包管理器来安装依赖的,我这里则是用的 <code>yarn</code>,<code>yarn</code> 和 <code>npm</code> 相比有很多优势,更多详情和 <code>npm</code> 命令之间的差异建议自行去网上搜索。</p><h2 id="Hexo-安装及建站过程"><a href="#Hexo-安装及建站过程" class="headerlink" title="Hexo 安装及建站过程"></a>Hexo 安装及建站过程</h2><hr><ol><li>全局安装 Hexo(在 cmd 输入)</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">yarn global add hexo-cli</span><br></pre></td></tr></table></figure><hr><ol start="2"><li>配置环境变量</li></ol><blockquote><p>桌面上的「<strong>此电脑</strong>」图标,鼠标右键,「<strong>属性</strong>」,「<strong>高级系统设置</strong>」,「<strong>环境变量</strong>」,在「<strong>系统变量</strong>」一栏的「<strong>Path</strong>」,点击「<strong>编辑</strong>」,「<strong>新建</strong>」,把路径 <code>C:\Users\<用户名>\AppData\Local\Yarn\bin</code> 写进去(此处路径取决于你电脑的用户名),保存即可。</p></blockquote><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/github-pages-with-hexo/2.png' data-fancybox='default' data-caption='环境变量的配置'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/github-pages-with-hexo/2.png" alt="环境变量的配置"></a><span class='image-caption'>环境变量的配置</span></div></div><hr><ol start="3"><li>找个目录建立站点(在你认为合适的目录下鼠标右键,点击 <strong>Git Bash Here</strong>,下面的 <strong>your_blog_name</strong> 是自定义的,随你喜好设定),然后输入命令:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">hexo init your_blog_name</span><br><span class="line"><span class="built_in">cd</span> your_blog_name</span><br><span class="line">yarn</span><br><span class="line">yarn add hexo-deployer-git</span><br></pre></td></tr></table></figure><blockquote><p>完成上述操作后接下来就该部署到 GitHub Pages 上了。</p></blockquote><hr><h2 id="GitHub-Pages-必备条件"><a href="#GitHub-Pages-必备条件" class="headerlink" title="GitHub Pages 必备条件"></a>GitHub Pages 必备条件</h2><ul><li>拥有一个 GitHub 账号<ul><li>如果还没有账号的自行 <a href="https://github.com/join?source=header-home">点击这里</a> 注册<br>创建一个名为 <code>your_username.github.io</code> 的 repository(此处的your_username指的是你的 GitHub 用户名)</li></ul></li></ul><h2 id="配置-SSH-密钥"><a href="#配置-SSH-密钥" class="headerlink" title="配置 SSH 密钥"></a>配置 SSH 密钥</h2><p>配置 GitHub 的 SSH 密钥可以让本地 Git 项目与远程的 GitHub 建立联系,让我们在本地写了代码之后直接通过git操作就可以实现本地代码库与 GitHub 代码库同步。操作如下:</p><h3 id="检查本地上是否已有-SSH-密钥"><a href="#检查本地上是否已有-SSH-密钥" class="headerlink" title="检查本地上是否已有 SSH 密钥"></a>检查本地上是否已有 SSH 密钥</h3><p>打开 Git Bash,并运行:</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">ls</span> ~/.ssh</span><br></pre></td></tr></table></figure><blockquote><ul><li>如果提示 No such file or directory 的就说明你之前还没有创建过 SSH 密钥,如下:</li></ul></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ <span class="built_in">ls</span> ~/.ssh</span><br><span class="line"><span class="built_in">ls</span>: cannot access <span class="string">'/c/Users/Innovation/.ssh'</span>: No such file or directory</span><br></pre></td></tr></table></figure><blockquote><ul><li>如果有 <code>id_*</code> 和 <code>id_*.pub</code> (其中 <code>*</code> 是生成密钥的签名类型),说明您之前已经生成过 SSH 密钥了,如:</li></ul></blockquote><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ <span class="built_in">ls</span> ~/.ssh</span><br><span class="line">id_ecdsa id_ecdsa.pub</span><br></pre></td></tr></table></figure><h4 id="还没有-SSH-密钥看这里"><a href="#还没有-SSH-密钥看这里" class="headerlink" title="还没有 SSH 密钥看这里"></a>还没有 SSH 密钥看这里</h4><ol><li>创建一对新的 SSH 密钥,输入以下命令</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh-keygen -t ecdsa -C <span class="string">"your_email"</span></span><br></pre></td></tr></table></figure><ul><li>上面的 <code>your_email</code> 以你 GitHub 的邮箱地址替换即可</li></ul><ol start="2"><li>按回车确认key保存的路径</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">Generating public/private ecdsa key pair.</span><br><span class="line">Enter file in which to save the key (/c/Users/Innovation/.ssh/id_ecdsa):</span><br></pre></td></tr></table></figure><p>上面的意思是询问你保存密钥的路径,我们默认即可,<strong>此处直接回车</strong>。</p><ol start="3"><li>输入密码</li></ol><blockquote><p>此处建议不要设置密码,<strong>直接回车</strong>,不然每次你本地文件发生变化要部署到 GitHub 仓库的时候都要繁琐的输入密码</p></blockquote><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">Created directory '/c/Users/Innovation/.ssh'.</span><br><span class="line">Enter passphrase (empty for no passphrase):</span><br></pre></td></tr></table></figure><ol start="4"><li>确认密码</li></ol><blockquote><p>是让你确认密码,<strong>没设置密码的直接回车</strong></p></blockquote><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Enter same passphrase again:</span><br></pre></td></tr></table></figure><ol start="5"><li>输入完成之后,屏幕大致会显示如下信息:</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">Your identification has been saved in /c/Users/Innovation/.ssh/id_ecdsa</span><br><span class="line">Your public key has been saved in /c/Users/Innovation/.ssh/id_ecdsa.pub</span><br><span class="line">The key fingerprint is:</span><br><span class="line">SHA256:snXEmouBdXZbc9EdpkJJCeVhbMuTimnhvCr7Sv/xFeg [email protected]</span><br></pre></td></tr></table></figure><h4 id="已有-SSH-密钥看这里"><a href="#已有-SSH-密钥看这里" class="headerlink" title="已有 SSH 密钥看这里"></a>已有 SSH 密钥看这里</h4><ol><li>在 Git Bash 里显示你的 SSH 公钥</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cat</span> ~/.ssh/id_*.pub</span><br></pre></td></tr></table></figure><ol start="2"><li><p>鼠标复制返回的内容</p></li><li><p>接着:</p></li></ol><ul><li>登陆 GitHub,进入你的 Settings</li><li>点击左栏的 SSH and GPG Keys 选项<ul><li>选择 New SSH Key,在 Key 文本框里直接粘贴刚才复制的内容</li><li>Title 文本框可以不填,点击 Add SSH Key 就好了</li></ul></li></ul><h2 id="测试-GitHub-的身份验证"><a href="#测试-GitHub-的身份验证" class="headerlink" title="测试 GitHub 的身份验证"></a>测试 GitHub 的身份验证</h2><ol><li>在提交到 GitHub 之前,你首先需要声明提交者的身份信息,打开 Git Bash,输入下列命令:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">git config --global user.name <span class="string">"your_username"</span></span><br><span class="line">git config --global user.email <span class="string">"your_email"</span></span><br></pre></td></tr></table></figure><ul><li>上面命令中的 <code>your_username</code> 和 <code>your_email</code> 改为你 GitHub <strong>用户名</strong>和<strong>邮箱地址</strong>即可。</li></ul><ol start="2"><li>输入下面的命令,看看设置是否成功,<code>[email protected]</code> 的部分不要修改:</li></ol><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ssh -T [email protected]</span><br></pre></td></tr></table></figure><ol start="3"><li>如果大致是下面的反馈:</li></ol><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">The authenticity of host 'github.com (20.205.243.166)' can't be established.</span><br><span class="line">ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.</span><br><span class="line">This key is not known by any other names</span><br><span class="line">Are you sure you want to continue connecting (yes/no/[fingerprint])?</span><br></pre></td></tr></table></figure><p>输入 <code>yes</code> 即可</p><p>然后反馈如下,那么就验证成功了</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">Hi ericclose! You've successfully authenticated, but GitHub does not provide shell access.</span><br></pre></td></tr></table></figure><h2 id="修改-blog-的配置文件"><a href="#修改-blog-的配置文件" class="headerlink" title="修改 blog 的配置文件"></a>修改 blog 的配置文件</h2><blockquote><p>打开你一开始创建的 blog 文件夹,用文本编辑器(推荐 <a href="https://code.visualstudio.com/">vscode</a> 或者是 <a href="https://notepad-plus-plus.org/">Notepad++</a> 这类带语法高亮的编辑器)打开刚文件夹下的 <code>_config.yml</code> 文件,然后修改最后一块代码:</p></blockquote><figure class="highlight yaml"><figcaption><span>_config.yml</span></figcaption><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deploy:</span></span><br><span class="line"> <span class="attr">type:</span> <span class="string">git</span></span><br><span class="line"> <span class="attr">repository:</span> <span class="string">[email protected]:your_username/your_username.github.io.git</span></span><br><span class="line"> <span class="attr">branch:</span> <span class="string">master</span></span><br></pre></td></tr></table></figure><p>把上面的 <strong>your_username</strong> 改成你 GitHub 的用户名就完成了所有配置。</p><h2 id="生成-public-文件夹并部署到你的-GitHub-Pages"><a href="#生成-public-文件夹并部署到你的-GitHub-Pages" class="headerlink" title="生成 public 文件夹并部署到你的 GitHub Pages"></a>生成 public 文件夹并部署到你的 GitHub Pages</h2><p>在你 <strong>blog 根目录</strong>下鼠标右键,点击 <strong>Git Bash Here</strong>,输入</p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">hexo g</span><br><span class="line">hexo d</span><br></pre></td></tr></table></figure><ul><li>上面的 g 代表的是 generate(生成),d 代表的是 deploy(部署)<br>命令可以简写成一行 <code>hexo g -d</code></li></ul><h2 id="完成"><a href="#完成" class="headerlink" title="完成"></a>完成</h2><p>进入你的 GitHub Pages 看看效果了,链接是 <code>https://your_username.github.io</code> (<strong>your_username</strong> 用你的用户名替代即可)</p><p>默认的 Hexo 主题是 <strong>landscape</strong>,最初只有一篇文章,效果图如下:</p><div galleryFlag itemscope itemtype="http://schema.org/ImageGallery" class="gallery " data-group='default'><div class='fancybox'><a class='fancybox' pjax-fancybox itemscope itemtype="http://schema.org/ImageObject" itemprop="url" href='https://cdn.jsdelivr.net/gh/ericclose/images/github-pages-with-hexo/landscape_theme_demo.png' data-fancybox='default' data-caption='部署完成效果图'><img fancybox itemprop="contentUrl" src="https://cdn.jsdelivr.net/gh/ericclose/images/github-pages-with-hexo/landscape_theme_demo.png" alt="部署完成效果图"></a><span class='image-caption'>部署完成效果图</span></div></div>]]></content>
<categories>
<category> Blog </category>
</categories>
<tags>
<tag> GitHub Pages </tag>
<tag> hexo </tag>
</tags>
</entry>
</search>