linux打开更新管理器,Linux管理系统更新

CentOS 7系统可以通过三种方式更新 -

手动

自动

手动更新主要安全问题并配置自动更新

在生产环境中,建议手动更新生产服务器。或者至少建立更新计划,以便管理员可以确保对业务运营至关重要的服务。

这似乎是合理的,简单的安全更新可能会导致需要由管理员升级和重新配置的常见应用程序的递归问题。因此,在开发服务器和桌面系统首先进行测试之前,应该厌倦安排生产中的自动更新。

手动更新CentOS 7

要更新CentOS 7,我们需要熟悉 yum 命令。 yum 用于处理CentOS 7中的软件包储存库 。yum 是常用的工具 -

更新CentOS 7 Linux系统

搜索包

安装软件包

检测并安装软件包所需的依赖关系

为了使用 yum 进行更新,您的CentOS服务器需要连接到Internet。大多数配置都会安装一个基本系统,然后使用 yum

来查询主要的CentOS存储库以获取软件包中的其他功能并应用系统更新。

我们已经使用 yum 来安装一些软件包。在使用 yum时,

您始终需要以root用户的身份执行此操作。或者拥有root权限的用户。那么让我们搜索并安装一个名为 nano 的简单易用的文本编辑器。

[root@centos rdc]# yum search nano

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

* base: mirror.rackspace.com

* epel: mirror.chpc.utah.edu

* extras: repos.forethought.net

* updates: repos.forethought.net

======================================================================

N/S matched: nano

======================================================================

nano.x86_64 : A small text editor

nodejs-nano.noarch : Minimalistic couchdb driver for Node.js

perl-Time-Clock.noarch : Twenty-four hour clock object with nanosecond precision

Name and summary matches only, use "search all" for everything.

[root@centos rdc]#

现在,我们安装 nano 文本编辑器。

[root@centos rdc]# yum install nano

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

* base: mirror.keystealth.org

* epel: pubmirror1.math.uh.edu

* extras: centos.den.host-engine.com

* updates: repos.forethought.net

Resolving Dependencies

--> Running transaction check

---> Package nano.x86_64 0:2.3.1-10.el7 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

================================================================================

Package Arch

Version Repository Size

================================================================================

Installing:

nano x86_64

2.3.1-10.el7 base 440 k

Transaction Summary

Install 1 Package

Total download size: 440 k

Installed size: 1.6 M

Is this ok [y/d/N]: y

Downloading packages:

nano-2.3.1-10.el7.x86_64.rpm

| 440 kB 00:00:00

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Installing : nano-2.3.1-10.el7.x86_64

1/1

Verifying : nano-2.3.1-10.el7.x86_64

1/1

Installed:

nano.x86_64 0:2.3.1-10.el7

Complete!

[root@centos rdc]#

我们已经安装了nano文本编辑器。这种方法IMO比在网站上搜索实用程序并手动运行安装程序要容易得多。另外,存储库使用数字签名来验证包,以确保它们来自yum的可信来源。信任新存储库时,由管理员验证真实性。这就是为什么疲倦第三方存储库被认为是最佳做法。

百胜也可以用来取出包裹。

[root@centos rdc]# yum remove nano

Loaded plugins: fastestmirror, langpacks

Resolving Dependencies

--> Running transaction check

---> Package nano.x86_64 0:2.3.1-10.el7 will be erased

--> Finished Dependency Resolution

Dependencies Resolved

现在让我们来检查更新。

[root@centos rdc]# yum list updates

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

* base: mirror.keystealth.org

* epel: pubmirror1.math.uh.edu

* extras: centos.den.host-engine.com

* updates: repos.forethought.net

Updated Packages

NetworkManager.x86_64 1:1.4.0-17.el7_3 updates

NetworkManager-adsl.x86_64 1:1.4.0-17.el7_3 updates

NetworkManager-glib.x86_64 1:1.4.0-17.el7_3 updates

NetworkManager-libnm.x86_64 1:1.4.0-17.el7_3 updates

NetworkManager-team.x86_64 1:1.4.0-17.el7_3 updates

NetworkManager-tui.x86_64 1:1.4.0-17.el7_3 updates

NetworkManager-wifi.x86_64 1:1.4.0-17.el7_3 updates

audit.x86_64 2.6.5-3.el7_3.1 updates

audit-libs.x86_64 2.6.5-3.el7_3.1 updates

audit-libs-python.x86_64

如图所示,我们有几十个更新正在等待安装。实际上,由于我们尚未配置自动更新,因此总共有100个更新。因此,让我们安装所有挂起的更新。

[root@centos rdc]# yum update

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

* base: mirrors.usc.edu

* epel: pubmirror1.math.uh.edu

* extras: repos.forethought.net

* updates: repos.forethought.net

Resolving Dependencies

--> Running transaction check

---> Package NetworkManager.x86_64 1:1.4.0-14.el7_3 will be updated

---> Package NetworkManager.x86_64 1:1.4.0-17.el7_3 will be an update

selinux-policy noarch 3.13.1102.el7_3.15 updates 414 k

selinux-policy-targeted noarch 3.13.1102.el7_3.15 updates 6.4 M

systemd x86_64 21930.el7_3.7 updates 5.2 M

systemd-libs x86_64 21930.el7_3.7 updates 369 k

systemd-python x86_64 21930.el7_3.7 updates 109 k

systemd-sysv x86_64 21930.el7_3.7 updates 63 k

tcsh x86_64 6.18.01-13.el7_3.1 updates 338 k

tzdata noarch 2017a1.el7 updates 443 k

tzdata-java noarch 2017a1.el7 updates 182 k

wpa_supplicant x86_64 1:2.021.el7_3 updates 788 k

Transaction Summary

===============================================================================

Install 2 Packages

Upgrade 68 Packages

Total size: 196 M

Total download size: 83 M

Is this ok [y/d/N]:

点击“y”键后,CentOS 7将开始更新。 yum 在更新时经历的一般过程是 -

检查当前包

在存储库中查找更新的软件包

计算更新包所需的依赖关系

下载更新

安装更新

现在,让我们确保我们的系统是最新的 -

[root@centos rdc]# yum list updates

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

* updates: mirror.compevo.com

[root@centos rdc]#

如您所见,没有更新列出。

为YUM配置自动更新

在企业环境中,如前所述,自动更新可能是安装的首选方法,也可能不是。让我们回顾一下用yum配置自动更新的步骤。

首先,我们安装名为 yum-cron 的软件包。

[root@centos rdc]# yum -y install yum-cron

Install 1 Package

Total download size: 61 k

Installed size: 51 k

Downloading packages:

yum-cron-3.4.3-150.el7.centos.noarch.rpm

| 61 kB 00:00:01

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Installing : yum-cron-3.4.3-150.el7.centos.noarch

1/1

Verifying : yum-cron-3.4.3-150.el7.centos.noarch

1/1

Installed:

yum-cron.noarch 0:3.4.3-150.el7.centos

Complete!

[root@centos rdc]#

默认情况下, yum-cron

只会下载更新并不会安装它们。管理员是否自动安装更新。最大的缺陷是:有些更新需要重启系统。另外,在服务再次运行之前,某些更新可能需要更改配置。

在以下情况下更新依赖关系可能会产生递归问题 -

yum为某个图书馆推荐更新

该库只支持Apache Server 2.4,但我们有服务器2.3

我们的商业网站依赖于某个版本的PHP

为库安装的新版本Apache需要升级PHP

我们的生产Web应用程序尚未使用较新的PHP版本进行测试

Yum可能会继续并自动升级Apache和PHP,恕不另行通知。

如果所有5种情况都发挥出来,那么可能会导致任何事情从早上的大难题到暴露用户数据的可能的安全妥协。虽然前面提到的例子是一种完美的风暴,但我们绝不希望这样的情况发生。

由于可能因更新重新启动和重新配置而导致的停机时间,因此需要从恢复服务所需的时间内访问可能的收入损失的可能情景。比如说,这种做法可能不够保守,例如每天数百万美元的电子商务网站拥有数百万客户。

现在让我们配置 yum-cron 自动安装系统更新。

[root@centos rdc]# vim /etc/yum/yum-cron.conf

# Whether updates should be applied when they are available. Note

# that download_updates must also be yes for the update to be applied.

apply_updates = yes

我们希望将 _applyupdates = no 更改为 _applyupdates = yes 。现在让我们配置 yum-cron

的更新时间间隔。

同样,是否使用自动更新和按需安装更新可能是一把双刃剑,管理员需要考虑每种独特情况。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值