ค้นหาเว็บไซต์

วิธีตรวจสอบและติดตั้งการอัปเดตบน CentOS และ RHEL


การติดตั้งการอัพเดตสำหรับแพ็คเกจซอฟต์แวร์หรือเคอร์เนลนั้นเป็นงานที่แนะนำเป็นอย่างยิ่งและเป็นประโยชน์สำหรับผู้ดูแลระบบ โดยเฉพาะอย่างยิ่งเมื่อพูดถึงการอัปเดตหรือแพทช์ด้านความปลอดภัย ในขณะที่ค้นพบช่องโหว่ด้านความปลอดภัย ซอฟต์แวร์ที่ได้รับผลกระทบจะต้องได้รับการอัปเดตเพื่อลดความเสี่ยงด้านความปลอดภัยที่อาจเกิดขึ้นกับทั้งระบบ

หากคุณไม่ได้กำหนดค่าระบบของคุณให้ติดตั้งแพตช์รักษาความปลอดภัยหรืออัปเดตโดยอัตโนมัติ คุณจะต้องดำเนินการด้วยตนเอง ในบทความนี้ เราจะแสดงวิธีตรวจสอบและติดตั้งการอัปเดตซอฟต์แวร์บนการกระจาย CentOS และ RHEL

หากต้องการตรวจสอบการอัปเดตใด ๆ ที่มีสำหรับแพ็คเกจที่คุณติดตั้ง ให้ใช้ตัวจัดการแพ็คเกจ YUM พร้อมคำสั่งย่อย check-update สิ่งนี้จะช่วยให้คุณเห็นการอัปเดตแพ็คเกจทั้งหมดจากที่เก็บข้อมูลทั้งหมด หากมี

yum check-update
Loaded plugins: changelog, fastestmirror
base                                                                                                                                                 | 3.6 kB  00:00:00     
epel/x86_64/metalink                                                                                                                                 |  22 kB  00:00:00     
epel                                                                                                                                                 | 4.3 kB  00:00:00     
extras                                                                                                                                               | 3.4 kB  00:00:00     
mariadb                                                                                                                                              | 2.9 kB  00:00:00     
updates                                                                                                                                              | 3.4 kB  00:00:00     
(1/2): epel/x86_64/updateinfo                                                                                                                        | 842 kB  00:00:15     
(2/2): epel/x86_64/primary_db                                                                                                                        | 6.1 MB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirror.vorboss.net
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com

MariaDB-client.x86_64                                                              10.1.28-1.el7.centos                                                             mariadb 
MariaDB-common.x86_64                                                              10.1.28-1.el7.centos                                                             mariadb 
MariaDB-server.x86_64                                                              10.1.28-1.el7.centos                                                             mariadb 
MariaDB-shared.x86_64                                                              10.1.28-1.el7.centos                                                             mariadb 
NetworkManager.x86_64                                                              1:1.8.0-11.el7_4                                                                 updates 
NetworkManager-adsl.x86_64                                                         1:1.8.0-11.el7_4                                                                 updates 
....

หากต้องการอัปเดตแพ็คเกจเดียวเป็นเวอร์ชันล่าสุด ให้รันคำสั่งด้านล่าง ในตัวอย่างนี้ yum จะพยายามอัปเดตแพ็คเกจ httpd

yum update httpd
Loaded plugins: changelog, fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirror.vorboss.net
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-45.el7.centos.4 will be updated
--> Processing Dependency: httpd = 2.4.6-45.el7.centos.4 for package: 1:mod_ssl-2.4.6-45.el7.centos.4.x86_64
---> Package httpd.x86_64 0:2.4.6-67.el7.centos.6 will be an update
--> Processing Dependency: httpd-tools = 2.4.6-67.el7.centos.6 for package: httpd-2.4.6-67.el7.centos.6.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-45.el7.centos.4 will be updated
---> Package httpd-tools.x86_64 0:2.4.6-67.el7.centos.6 will be an update
---> Package mod_ssl.x86_64 1:2.4.6-45.el7.centos.4 will be updated
---> Package mod_ssl.x86_64 1:2.4.6-67.el7.centos.6 will be an update
....

หากต้องการอัพเดตกลุ่มแพ็คเกจ คำสั่งต่อไปนี้จะอัพเดตเครื่องมือการพัฒนาของคุณ (คอมไพเลอร์ C และ C++ พร้อมยูทิลิตี้ที่เกี่ยวข้อง)

yum update "Development Tools"
Loaded plugins: changelog, fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirror.vorboss.net
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
...

หากต้องการอัพเกรดซอฟต์แวร์ระบบทั้งหมดของคุณตลอดจนการขึ้นต่อกันเป็นเวอร์ชันล่าสุด ให้ใช้คำสั่งนี้:

yum update
Loaded plugins: changelog, fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirror.vorboss.net
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
Resolving Dependencies
--> Running transaction check
---> Package MariaDB-client.x86_64 0:10.1.23-1.el7.centos will be updated
---> Package MariaDB-client.x86_64 0:10.1.28-1.el7.centos will be an update
---> Package MariaDB-common.x86_64 0:10.1.23-1.el7.centos will be updated
---> Package MariaDB-common.x86_64 0:10.1.28-1.el7.centos will be an update
---> Package MariaDB-server.x86_64 0:10.1.23-1.el7.centos will be updated
---> Package MariaDB-server.x86_64 0:10.1.28-1.el7.centos will be an update
---> Package MariaDB-shared.x86_64 0:10.1.23-1.el7.centos will be updated
---> Package MariaDB-shared.x86_64 0:10.1.28-1.el7.centos will be an update
---> Package NetworkManager.x86_64 1:1.4.0-19.el7_3 will be obsoleted
---> Package NetworkManager.x86_64 1:1.8.0-11.el7_4 will be obsoleting
....

แค่นั้นแหละ! คุณอาจต้องการอ่านบทความที่เกี่ยวข้องต่อไปนี้

  1. วิธีติดตั้งหรืออัปเกรดเป็นเคอร์เนลเวอร์ชันล่าสุดใน CentOS 7
  2. วิธีลบเคอร์เนลเก่าที่ไม่ได้ใช้ใน CentOS, RHEL และ Fedora
  3. วิธีติดตั้งการอัปเดตความปลอดภัยโดยอัตโนมัติบน Debian และ Ubuntu

คอยอัปเดตระบบ Linux ของคุณให้ทันสมัยอยู่เสมอด้วยการรักษาความปลอดภัยล่าสุดและการอัปเดตแพ็คเกจทั่วไป คุณมีคำถามใด ๆ ที่จะถาม ใช้แบบฟอร์มความคิดเห็นด้านล่างเพื่อสิ่งนั้น