Centos 8配置系统自动更新 - AFF大佬
当前位置: 主页 » 技术干货 » Centos 8配置系统自动更新

Centos 8配置系统自动更新

      2019年12月04日   阅读 589 次     0 评论   Tags: · ·

Centos8发布也有一段时间了,部署了两台,今天又在 OVH 美东小鸡 DD 了 Centos8系统,以前也写过一篇 Centos7如何配置自动更新,本文主要介绍Centos8如何实现自动更新,由于Centos8系统的变动比较大,所以与Centos7配置系统自动更新有所不同。

1、Centos8由yum全面转变为dnf,实现自动更新主要依靠dnf-automatic软件实现。


[root@uscdn2 ~]# yum search dnf-automatic
Last metadata expiration check: 0:21:44 ago on Wed 04 Dec 2019 09:48:48 PM CST.
================================================ Name Exactly Matched: dnf-automatic =================================================
dnf-automatic.noarch : Package manager - automated upgrades
[root@uscdn2 ~]# dnf install dnf-automatic 
Last metadata expiration check: 0:27:24 ago on Wed 04 Dec 2019 09:48:48 PM CST.
Dependencies resolved.
======================================================================================================================================
 Package                            Arch                        Version                             Repository                   Size
======================================================================================================================================
Installing:
 dnf-automatic                      noarch                      4.0.9.2-5.el8                       BaseOS                      133 k

Transaction Summary
======================================================================================================================================
Install  1 Package

Total download size: 133 k
Installed size: 46 k
Is this ok [y/N]: y
Downloading Packages:
dnf-automatic-4.0.9.2-5.el8.noarch.rpm                                                                112 kB/s | 133 kB     00:01    
--------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                  56 kB/s | 133 kB     00:02     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                              1/1 
  Installing       : dnf-automatic-4.0.9.2-5.el8.noarch                                                                           1/1 
  Running scriptlet: dnf-automatic-4.0.9.2-5.el8.noarch                                                                           1/1 
  Verifying        : dnf-automatic-4.0.9.2-5.el8.noarch                                                                           1/1 

Installed:
  dnf-automatic-4.0.9.2-5.el8.noarch                                                                                                  

Complete!

2、配置 /etc/dnf/automatic.conf 文件开启自动更新。



[root@uscdn2 ~]# vi  /etc/dnf/automatic.conf

[commands]
#  What kind of upgrade to perform:
# default                            = all available upgrades
# security                           = only the security upgrades
upgrade_type = default
random_sleep = 0
download_updates = yes
apply_updates = yes

3、启动自动更新并查看自动更新任务列表


[root@uscdn2 ~]# systemctl enable --now dnf-automatic.timer
Created symlink /etc/systemd/system/multi-user.target.wants/dnf-automatic.timer → /usr/lib/systemd/system/dnf-automatic.timer.
[root@uscdn2 ~]# systemctl list-timers *dnf-* --all
NEXT                         LEFT       LAST                         PASSED   UNIT                ACTIVATES
Wed 2019-12-04 23:05:01 CST  44min left n/a                          n/a      dnf-automatic.timer dnf-automatic.service
Wed 2019-12-04 23:11:10 CST  50min left Wed 2019-12-04 22:11:09 CST  9min ago dnf-makecache.timer dnf-makecache.service

2 timers listed.

至此,Centos8配置系统自动更新完成。

  • 版权声明:本文版权归AFF大佬和原作者所有,未经许可不得转载。文章部分来源于网络仅代表作者看法,如有不同观点,欢迎进行交流。除非注明,文章均由 AFF大佬 整理发布,欢迎转载,转载请带版权。

  • 来源:AFF大佬 ( https://www.affdalao.com/ ),提供主机优惠信息深度测评和服务器运维编程技术。
  • 链接:https://www.affdalao.com/1713.html
  • 评论(0

    1. 还没有任何评论,你来说两句吧

    发表评论

    电子邮件地址不会被公开。 必填项已用*标注