CentOS/RHEL 6
一、开始升级所有软件的安全补丁:
yum -y --security upgrade
二、自动更新安全补丁
yum -y install yum-cron
vim /etc/sysconfig/yum-cron
CHECK_ONLY=yes 不要安装,只做检查(有效值: yes|no)
CHECK_FIRST=yes 不要安装,只做检查和下载(有效值: yes|no)
DOWNLOAD_ONLY=yes 先要检查补丁需要后下载
开机自动启动, 每晚自动更新
service yum-cron start
chkconfig yum-cron on
uname -a 查看内核版本
more /etc/issue 查看系统信息
安装显示如下:
[root@localhost ~]# yum -y --security upgrade
Loaded plugins: fastestmirror, security
Setting up Upgrade Process
base
| 3.7 kB 00:00
base/primary_db
| 4.7 MB
00:01
extras
| 3.4
kB 00:00
extras/primary_db
| 30 kB
00:00
updates
| 3.4
kB 00:00
updates/primary_db
| 7.0 MB 00:00
Resolving Dependencies
Limiting packages to security relevant ones
No packages needed for security; 159 packages available
[root@localhost ~]# yum -y install yum-cron
Loaded plugins: fastestmirror, security
Setting up Install Process
Determining fastest mirrors
* base: mirror.sunnyvision.com
* extras: mirror.sunnyvision.com
* updates: mirror.sunnyvision.com
Resolving Dependencies
--> Running transaction check
---> Package yum-cron.noarch 0:3.2.29-81.el6.centos will be installed
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch
Version
Repository
Size
================================================================================
Installing:
yum-cron noarch
3.2.29-81.el6.centos
base 46 k
Transaction Summary
================================================================================
Install 1 Package(s)
Total download size: 46 k
Installed size: 28 k
Downloading Packages:
yum-cron-3.2.29-81.el6.centos.noarch.rpm
| 46 kB
00:00
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de:
NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
Package: centos-release-6-8.el6.centos.12.3.x86_64
(@anaconda-CentOS-201605220104.x86_64/6.8)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : yum-cron-3.2.29-81.el6.centos.noarch
1/1
Verifying : yum-cron-3.2.29-81.el6.centos.noarch
1/1
Installed:
yum-cron.noarch 0:3.2.29-81.el6.centos
Complete!
[root@localhost ~]# vim
/etc/sysconfig/yum-cron
CHECK_ONLY=yes 不要安装,只做检查(有效值: yes|no)
CHECK_FIRST=yes 不要安装,只做检查和下载(有效值: yes|no)
DOWNLOAD_ONLY=yes 先要检查补丁需要后下载
[root@localhost ~]# service yum-cron start
Enabling nightly yum update:
[ OK ]
[root@localhost ~]# chkconfig yum-cron on
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-642.el6.x86_64 #1 SMP Tue May 10 17:27:01
UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# more /etc/issue
CentOS release 6.8 (Final)
Kernel
on an m