Linux操作记录8--为AmazonLinux2做OSPatch

在每次漏洞扫描之后,每一个运维人都会怀着激动而又紧张的心情来看这一份报告,毕竟这决定了他们的工作量
那么,我们会怎么给每一台服务器打补丁呢?这边记录一下工作中用到的两种方法

手动Patch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 除了Amazon Linux2023
sudo yum update
# Amazon Linux2023
dnf upgrade --releasever=2023.7.20250623

# 2. reboot

# 3. execute the 3 command below
uname -r
rpm -q kernel
sudo package-cleanup --oldkernels --count=1 -y
## For Amazon Linux2023
sudo dnf remove --oldinstallonly --setopt installonly_limit=2 kernel -y


# 4. check the running status of each service(fail2ban/xxx)
# 5. test to login to other servers

AWS 自动Patch

https://ap-southeast-1.console.aws.amazon.com/systems-manager/home?region=ap-southeast-1#welcome
参考这个网址上的内容,使用AWS Patch manager