自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何使用yum-cron自動更新RHEL/CentOS Linux

系統(tǒng) Linux
yum 命令是 RHEL / CentOS Linux 系統(tǒng)中用來安裝和更新軟件包的一個工具。我知道如何使用 yum 命令行 更新系統(tǒng),但是我想用 cron 任務(wù)自動更新軟件包。

[[222952]]

yum 命令是 RHEL / CentOS Linux 系統(tǒng)中用來安裝和更新軟件包的一個工具。我知道如何使用 yum 命令行 更新系統(tǒng),但是我想用 cron 任務(wù)自動更新軟件包。該如何配置才能使得 yum 使用 cron 自動更新系統(tǒng)補丁或更新呢?

首先需要安裝 yum-cron 軟件包。該軟件包提供以 cron 命令運行 yum 更新所需的文件。如果你想要每晚通過 cron 自動更新可以安裝這個軟件包。

 

CentOS/RHEL 6.x/7.x 上安裝 yum cron

輸入以下 [yum 命令][3]:

  1. $ sudo yum install yum-cron

使用 CentOS/RHEL 7.x 上的 systemctl 啟動服務(wù):

  1. $ sudo systemctl enable yum-cron.service
  2. $ sudo systemctl start yum-cron.service
  3. $ sudo systemctl status yum-cron.service

在 CentOS/RHEL 6.x 系統(tǒng)中,運行:

  1. $ sudo chkconfig yum-cron on
  2. $ sudo service yum-cron start

yum-cronyum 的一個替代方式。使得 cron 調(diào)用 yum 變得非常方便。該軟件提供了元數(shù)據(jù)更新、更新檢查、下載和安裝等功能。yum-cron 的各種功能可以使用配置文件配置,而不是輸入一堆復(fù)雜的命令行參數(shù)。

 

配置 yum-cron 自動更新 RHEL/CentOS Linux

使用 vi 等編輯器編輯文件 /etc/yum/yum-cron.conf/etc/yum/yum-cron-hourly.conf

  1. $ sudo vi /etc/yum/yum-cron.conf

確保更新可用時自動更新:

  1. apply_updates = yes

可以設(shè)置通知 email 的發(fā)件地址。注意: localhost將會被system_name` 的值代替。

  1. email_from = root@localhost

列出發(fā)送到的 email 地址。

  1. email_to = your-it-support@some-domain-name

發(fā)送 email 信息的主機名。

  1. email_host = localhost

[CentOS/RHEL 7.x][4] 上不想更新內(nèi)核的話,添加以下內(nèi)容:

  1. exclude=kernel*

RHEL/CentOS 6.x 下添加以下內(nèi)容來禁用內(nèi)核更新

  1. YUM_PARAMETER=kernel*

保存并關(guān)閉文件。如果想每小時更新系統(tǒng)的話修改文件 /etc/yum/yum-cron-hourly.conf,否則文件 /etc/yum/yum-cron.conf 將使用以下命令每天運行一次(使用 cat 命令 查看):

  1. $ cat /etc/cron.daily/0yum-daily.cron

示例輸出:

  1. #!/bin/bash
  2.  
  3. # Only run if this flag is set. The flag is created by the yum-cron init
  4. # script when the service is started -- this allows one to use chkconfig and
  5. # the standard "service stop|start" commands to enable or disable yum-cron.
  6. if [[ ! -f /var/lock/subsys/yum-cron ]]; then
  7. exit 0
  8. fi
  9.  
  10. # Action!
  11. exec /usr/sbin/yum-cron /etc/yum/yum-cron-hourly.conf
  12. [root@centos7-box yum]# cat /etc/cron.daily/0yum-daily.cron
  13. #!/bin/bash
  14.  
  15. # Only run if this flag is set. The flag is created by the yum-cron init
  16. # script when the service is started -- this allows one to use chkconfig and
  17. # the standard "service stop|start" commands to enable or disable yum-cron.
  18. if [[ ! -f /var/lock/subsys/yum-cron ]]; then
  19. exit 0
  20. fi
  21.  
  22. # Action!
  23. exec /usr/sbin/yum-cron

完成配置。現(xiàn)在你的系統(tǒng)將每天自動更新一次。更多細節(jié)請參照 yum-cron 的說明手冊。

  1. $ man yum-cron

 

責任編輯:龐桂玉 來源: Linux中國
相關(guān)推薦

2016-12-07 18:12:05

CentOSRHEL安全補丁

2015-03-30 14:15:55

自動更新Android

2010-12-13 13:33:47

Windows 7驅(qū)動

2022-08-14 19:33:24

Watchtower開源Docker

2010-06-02 19:54:48

SVN自動更新

2021-11-08 22:24:04

Windows 10Windows微軟

2017-10-20 12:13:11

數(shù)據(jù)庫PostgreSQL時間戳

2010-05-24 11:27:20

SVN配置自動更新WE

2009-09-03 15:25:46

RHEL5.3CentOS5.3更新源

2024-11-19 15:43:22

2015-09-10 14:42:37

自動更新UpdateWindows 10

2010-01-08 13:20:52

ibmdwWeb

2025-02-10 00:14:00

2010-04-07 11:07:41

OEL 5.5RHEL 5.5

2019-11-14 10:00:18

Linuxcron任務(wù)自動化任務(wù)

2018-01-18 09:34:27

LinuxCentOSYUM

2018-01-09 09:20:39

CentOSRHELyum

2010-03-30 17:28:10

CentOS操作系統(tǒng)

2015-09-15 15:25:36

更新配置Windows 10

2012-04-16 14:55:29

MacChrome
點贊
收藏

51CTO技術(shù)棧公眾號