这篇内容是在有道云旧笔记基础上重新整理的 运维与环境配置 笔记。原始记录偏碎片化,这里补充了使用场景、阅读顺序和落地时需要注意的边界,方便以后在项目里快速复用。

适用场景 ​

  • 本地开发环境、服务器环境或容器环境出现类似问题时,用来快速回忆处理路径。
  • 需要把零散命令整理成可复查步骤,避免每次重新搜索同一类配置。
  • 发布、部署或系统调整前,用作操作前检查和回滚思路的参考。

核心要点 ​

  • 正文已经按 「Note, this file is written by cloud-init on first boot of an instance」、「modifications made here will not survive a re-bundle.」、「if you wish to make changes you can:」、「a.) add 'aptpreservesourceslist: true' to /etc/cloud/cloud.cfg」 等小节组织,阅读时可以先定位到当前问题对应的小节。
  • 保留了 1 段可直接参考的代码或命令,主要涉及 javascript,复制前需要按当前项目路径、版本和变量名做调整。
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
## Note, this file is written by cloud-init on first boot of an instance
## modifications made here will not survive a re-bundle.
## if you wish to make changes you can:
## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
## or do the same in user-data
## b.) add sources in /etc/apt/sources.list.d
## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu-ports focal main restricted
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirrors.aliyun.com/ubuntu-ports focal-updates main restricted
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu-ports focal universe
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal universe
deb http://mirrors.aliyun.com/ubuntu-ports focal-updates universe
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirrors.aliyun.com/ubuntu-ports focal multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal multiverse
deb http://mirrors.aliyun.com/ubuntu-ports focal-updates multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirrors.aliyun.com/ubuntu-ports focal-backports main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu focal partner
# deb-src http://archive.canonical.com/ubuntu focal partner

deb http://mirrors.aliyun.com/ubuntu-ports focal-security main restricted
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-security main restricted
deb http://mirrors.aliyun.com/ubuntu-ports focal-security universe
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-security universe
deb http://mirrors.aliyun.com/ubuntu-ports focal-security multiverse
# deb-src http://mirrors.aliyun.com/ubuntu-ports focal-security multiverse

实践检查清单 ​

  • 执行命令前确认当前用户、工作目录、端口、容器名和目标路径,避免把示例值直接用于生产环境。
  • 改配置前先备份原文件;涉及服务 reload/restart 时,先用检查命令验证配置可用。
  • 涉及 UI 或浏览器行为时,至少在桌面端和移动端各验证一次关键路径。

复盘小结 ​

这篇笔记更适合作为问题排查或方案落地前的速查材料。后续如果在真实项目中再次遇到同类问题,可以继续把具体版本、报错信息、最终取舍和验证结果补到对应小节里,让它从代码片段逐步沉淀成完整方案。