在Ubuntu中实现Apache2自动更新,可通过安装配置unattended-upgrades工具实现,步骤如下:
sudo apt update
sudo apt install unattended-upgrades
sudo dpkg-reconfigure -plow unattended-upgrades
选择“是”以自动下载安装更新。sudo nano /etc/apt/apt.conf.d/10periodic
设置APT::Periodic::Update-Package-Lists "1";(1表示每天检查更新)。sudo systemctl restart apache2
注:生产环境中建议谨慎使用自动更新,重要更新可手动测试后再部署。