黑客对互联网服务器的攻击方式有很多,其中之一就是利用服务器的系统漏洞。暴露在互联网上而且没有及时更新系统补丁的服务器到处可见。及时更新系统补丁无论对Windows还是Linux都非常重要。Windows系统的更新非常简单,只需在所有程序里找到 Windows Update 就可以一路下一步完成更新,但对于Linux就略显复杂,需要通过执行几个指令才能完成。下面我以CentOS6.4平台为例说明CentOS的系统更新。
[root@ZWCLR6X-11336 ~]# rpm -qa | grep release//查看系统版本号
centos-release-6-4.el6.centos.10.x86_64
[root@ZWCLR6X-11336 ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
//备份更新源文件
[root@ZWCLR6X-11336 ~]# cd /etc/yum.repos.d//进入更新源目录
[root@ZWCLR6X-11336 yum.repos.d]#wget -O CentOS-Base.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=2
//从中科大更新源站点下载更新源文件
--2018-04-27 09:44:14-- https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=2
[root@ZWCLR6X-11336 ~]# wget -O CentOS-Base.repo --no-check-certificate https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=2
//如果下载源文件报错证书不符,使用选项--no-check-certificate
--2018-04-27 09:46:05-- https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=2
已发出HTTP请求,正在等待回应... 200 OK
长度:未指定[text/plain]
正在保存至: “CentOS-Base.repo”
[ ] 2,095 --.-K/s in 0s
2018-04-27 09:46:11 (250 MB/s) - “CentOS-Base.repo”已保存[2095]
[root@ZWCLR6X-11336 ~]# yum makecache
//makecache建立一个缓存,以后用install时就在缓存中搜索,提高了速度
Loaded plugins: fastestmirror, security
Determining fastest mirrors
base | 3.7 kB 00:00
base/group_gz | 226 kB 00:00
base/filelists_db | 6.4 MB 00:09
base/other_db | 2.8 MB 00:03
extras | 3.4 kB 00:00
extras/filelists_db | 26 kB 00:00
extras/prestodelta | 1.7 kB 00:00
extras/primary_db | 30 kB 00:00
extras/other_db | 32 kB 00:00
updates | 3.4 kB 00:00
updates/filelists_db | 4.3 MB 00:06
updates/prestodelta | 245 kB 00:00
updates/primary_db | 7.0 MB 00:10
updates/other_db | 100 MB 02:35
Metadata Cache Created
[root@ZWCLR6X-11336 ~]# yum update //开始更新
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package ConsoleKit.x86_64 0:0.4.1-3.el6 will be updated
---> Package ConsoleKit.x86_64 0:0.4.1-6.el6 will be an update
---> Package ConsoleKit-libs.x86_64 0:0.4.1-3.el6 will be updated
---> Package ConsoleKit-libs.x86_64 0:0.4.1-6.el6 will be an update
……
……
……
sssd-ldap x86_64 1.13.3-58.el6_9 updates 214 k
sssd-proxy x86_64 1.13.3-58.el6_9 updates 142 k
ttmkfdir x86_64 3.0.9-32.1.el6 base 43 k
vim-filesystem x86_64 2:7.4.629-5.el6_8.1 base 15 k
xorg-x11-fonts-Type1 noarch 7.2-11.el6 base 520 k
Transaction Summary
================================================================================
Install 43 Package(s)
Upgrade 458 Package(s)
Total download size: 468 M
Is this ok [y/N]: y //输入y继续,直到更新完成
……
……
Complete!
[root@ZWCLR6X-11336 ~]# rpm -qa | grep release
centos-release-6-9.el6.12.3.x86_64 //版本已从6.4更新到6.9
领取专属 10元无门槛券
私享最新 技术干货