我在登录时看到以下通知:
__| __|_ )
_| ( / Amazon Linux AMI
___|\___|___|
See /usr/share/doc/system-release/ for latest release notes.
There are 30 security update(s) out of 39 total update(s) available
Run Code Online (Sandbox Code Playgroud)
如何在我的机器上安装这些更新?
Ste*_*pel 64
正如部分中列出的安全更新中亚马逊的Linux AMI基础,亚马逊的Linux的AMI被配置为下载并在启动时安装安全更新,即如果你并不需要保存在你运行亚马逊的Linux AMI实例的数据或自定义,你可以简单地重新开张使用最新更新的Amazon Linux AMI的新实例(有关详细信息,请参阅产品生命周期一节).
这当前仅包括关键或重要安全更新,请参阅AWS团队对Amazon Linux映像安全更新的最佳实践的响应:
Amazon Linux AMI上的默认设置是在启动时安装任何重要或重要的安全更新.这是cloud-init的功能,可以在框中的cloud.cfg中修改,也可以通过传入用户数据.这就是您在启动时仍然可以看到一些安全更新的原因.
因此,如果您要安装所有安全更新或者确实需要在运行的Amazon Linux AMI实例上保留数据或自定义,您可以通过Amazon Linux AMI yum存储库维护这些实例,即您需要将常规Yum更新机制作为为yum-security插件概述:
# yum update --security
Run Code Online (Sandbox Code Playgroud)
jor*_*fus 12
主机首次启动时,Amazon Linux会运行更新. 如果您计划长期使用主机,则可能还需要启用自动安全更新.我推荐使用yum-cron:
sudo yum install yum-cron
Run Code Online (Sandbox Code Playgroud)
配置文件在这里:(您可能只想运行安全更新)
/etc/yum/yum-cron.conf
Run Code Online (Sandbox Code Playgroud)
然后您可以像这样启用yum-cron:
sudo service yum-cron start
Run Code Online (Sandbox Code Playgroud)
从下面的有用评论中编辑:"如果您正在创建/销毁具有自动缩放组等的实例,则该命令应该类似于用户数据中的"sudo yum update --security -y".
上面的答案是正确的,以下是您可以复制并粘贴来运行的 4 个命令:
# Install the package yum-cron
sudo yum install yum-cron -y
# Change the config file /etc/yum/yum-cron.conf and modify the line apply_updates from no to yes
sudo sed -i "s/apply_updates = no/apply_updates = yes/" /etc/yum/yum-cron.conf
# Enable the yum-cron service to start automatically upon system boot
sudo systemctl enable yum-cron
# Start the yum-cron service now
sudo systemctl start yum-cron
Run Code Online (Sandbox Code Playgroud)
这些命令也适用于 Red Hat 7、CentOS 7
如果您以 root 用户身份运行,则无需 sudo 即可简单运行命令:
yum install yum-cron -y
sed -i "s/apply_updates = no/apply_updates = yes/" /etc/yum/yum-cron.conf
systemctl enable yum-cron
systemctl start yum-cron
Run Code Online (Sandbox Code Playgroud)
有关更多信息,请参阅https://linuxize.com/post/configure-automatic-updates-with-yum-cron-on-centos-7/ https://www.howtoforge.com/tutorial/how-to-setup- centos-7/ 上的自动安全更新/
归档时间: |
|
查看次数: |
20488 次 |
最近记录: |