搜尋
首頁運維CentOS詳解CentOS7更新YUM來源步驟

詳解CentOS7更新YUM來源步驟

Apr 27, 2021 pm 04:55 PM
linuxmysqlpython

下面由centos教學專欄為大家介紹CentOS 7更新YUM來源步驟,希望對需要的朋友有幫助!

國內小夥伴推薦使用阿里雲的來源

Step1 找到需要的來源

阿里巴巴開源鏡像站各種來源應有盡有,舊網域是https://mirrors.aliyun.com/

Step2 編輯CentOS7.repo檔

#/etc/yum.repos.d

,發現我的來源還是

7.4.1708

[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.4.1708/updates/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.4.1708/extras/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.4.1708/centosplus/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/7.4.1708/contrib/x86_64/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
這個版本的來源已經遷移到

7.5.1804

了,→地址,使用VIM將其替換
    :%s/7.4.1708/7.7.1908/g
  • Step3 修復衝突報錯然後更新系統試試
  • yum -y update
  • <pre class="brush:php;toolbar:false">[root@liaogx ~]# yum -y update Plugin &quot;product-id&quot; can't be imported Plugin &quot;search-disabled-repos&quot; can't be imported Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile  * base: mirrors.aliyun.com  * epel: mirrors.tuna.tsinghua.edu.cn  * extras: mirrors.aliyun.com  * updates: mirrors.aliyun.com Resolving Dependencies --&gt; Running transaction check ---&gt; Package ModemManager.x86_64 0:1.6.0-2.el7 will be updated ......此处略...... ---&gt; Package yum-rhn-plugin.noarch 0:2.0.1-10.el7 will be installed --&gt; Running transaction check ---&gt; Package libbytesize.x86_64 0:1.2-1.el7 will be installed ---&gt; Package python2-pytoml.noarch 0:0.1.18-1.el7 will be installed ---&gt; Package volume_key-libs.x86_64 0:0.3.9-8.el7 will be installed --&gt; Processing Conflict: initscripts-9.49.41-1.el7_5.1.x86_64 conflicts redhat-release  Finished Dependency Resolution Error: initscripts conflicts with redhat-release-server-7.4-18.el7.x86_64  You could try using --skip-broken to work around the problem ** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows: PackageKit-1.1.5-1.el7.centos.x86_64 has missing requires of PackageKit-backend rhn-check-2.0.2-17.el7.noarch has missing requires of yum-rhn-plugin &gt;= ('0', '1.6.4', '1') [root@liaogx ~]#</pre>如果報如下錯誤
  • Error: initscripts conflicts with redhat-release-server-7.4-18.el7.x86_64

    這是更新軟體包是與原始版本衝突造成的,有兩種解決辦法

    透過關鍵字initscritps排除衝突:yum update --exclude=kernel* --exclude=centos-release* --exclude=initscripts*

    #刪除衝突套件:

    rpm -e redhat-release-server-7.4-18.el7.x86_64 --nodeps
    #########這裡使用第二種方法,把衝突的套件幹掉###
    [root@liaogx ~]# rpm -e redhat-release-server-7.4-18.el7.x86_64 --nodeps
    warning: file /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release: remove failed: No such file or directory
    warning: file /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-legacy-rhx: remove failed: No such file or directory
    warning: file /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-legacy-release: remove failed: No such file or directory
    warning: file /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-legacy-former: remove failed: No such file or directory
    warning: file /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta: remove failed: No such file or directory
    [root@liaogx ~]#
    ###Step4 更新系統######小白從入門到跑路必會,###sudo yum -y update###,老鳥都懂。 ###
    [root@liaogx ~]# yum -y update
    ......此处省略10分钟......
    Complete!
    [root@liaogx ~]#
    ###更新成功 ^_^######

    以上是詳解CentOS7更新YUM來源步驟的詳細內容。更多資訊請關注PHP中文網其他相關文章!

    陳述
    本文轉載於:segmentfault。如有侵權,請聯絡admin@php.cn刪除
    Centos的中斷:討論Centos的中斷:討論Apr 11, 2025 am 12:09 AM

    CentOS已停止維護,轉向CentOSStream,不再提供適合生產環境的版本。影響包括系統遷移和企業重新評估Linux策略。替代方案有:1.遷移到RHEL,2.轉向Ubuntu或Debian,3.考慮CentOSStream作為測試平台,4.使用AlmaLinux或RockyLinux。建議儘早制定遷移計劃,評估現有系統和團隊需求。

    Ansible:基礎架構作為代碼的CentOS自動化Ansible:基礎架構作為代碼的CentOS自動化Apr 10, 2025 am 09:40 AM

    使用Ansible可以實現CentOS的自動化管理。具體步驟包括:1)編寫playbook來定義任務,如安裝和配置Apache;2)通過SSH協議執行playbook,確保系統配置的一致性;3)使用條件判斷和循環功能來處理複雜場景;4)優化性能和遵循最佳實踐,如使用異步任務和優化inventory文件。

    CENTOS面試問題:ACE您的Linux系統管理員面試CENTOS面試問題:ACE您的Linux系統管理員面試Apr 09, 2025 am 12:17 AM

    CentOS面試常見問題及解答包括:1.使用yum或dnf命令安裝軟件包,如sudoyuminstallnginx。 2.通過useradd和groupadd命令管理用戶和組,如sudouseradd-m-s/bin/bashnewuser。 3.使用firewalld配置防火牆,如sudofirewall-cmd--permanent--add-service=http。 4.設置自動更新使用yum-cron,如sudoyuminstallyum-cron並配置apply_updates=yes。

    CENTOS故障排除:診斷和解決常見問題CENTOS故障排除:診斷和解決常見問題Apr 08, 2025 am 12:09 AM

    在CentOS系統中,如何診斷和解決常見問題?首先,檢查啟動日誌解決系統啟動失敗;其次,檢查網絡配置文件解決網絡問題;最後,使用Yum命令解決軟件包管理問題。通過這些步驟,你可以有效地診斷和解決CentOS系統中的常見問題。

    CENTOS安全硬化:保護服務器免受入侵者的侵害CENTOS安全硬化:保護服務器免受入侵者的侵害Apr 07, 2025 am 12:05 AM

    CentOS服務器安全加固可以通過以下步驟實現:1.保持系統軟件更新,使用“sudoyumupdate-y”命令;2.禁用不必要的服務,如“sudosystemctldisablecups&&sudosystemctlstopcups”;3.配置SELinux為強制模式,使用“sudosetenforce1&&sudosed-i's/SELINUX=permissive/SELINUX=enforcing/g'/etc/selinux/config”命令;4.定期

    高級CentOS系統管理:掌握命令行高級CentOS系統管理:掌握命令行Apr 06, 2025 am 12:10 AM

    CentOS的高級命令行管理技巧包括:1.使用systemctl管理系統服務,2.使用top監控系統資源,3.使用yum管理軟件包,4.使用find和xargs批量處理文件,5.使用rsync優化文件複製。這些技巧能提高工作效率,解決常見問題,並優化系統性能。

    CentOS服務器管理:用戶帳戶,權限和服務CentOS服務器管理:用戶帳戶,權限和服務Apr 05, 2025 am 12:01 AM

    在CentOS中,如何管理用戶賬戶、權限和服務? 1.使用useradd命令創建用戶,2.通過usermod和groupmod命令管理用戶權限,3.使用systemd管理服務,如systemctlstart/stop/status命令。通過這些步驟,可以高效管理CentOS服務器,確保其安全和高效運行。

    CentOS備份和恢復:確保數據完整性和可用性CentOS備份和恢復:確保數據完整性和可用性Apr 04, 2025 am 12:02 AM

    在CentOS中進行備份和恢復的步驟包括:1.使用tar命令進行基本備份和恢復,如tar-czvf/backup/home_backup.tar.gz/home備份/home目錄;2.使用rsync進行增量備份和恢復,如rsync-avz/home//backup/home_backup/進行首次備份。這些方法確保數據的完整性和可用性,適用於不同場景的需求。

    See all articles

    熱AI工具

    Undresser.AI Undress

    Undresser.AI Undress

    人工智慧驅動的應用程序,用於創建逼真的裸體照片

    AI Clothes Remover

    AI Clothes Remover

    用於從照片中去除衣服的線上人工智慧工具。

    Undress AI Tool

    Undress AI Tool

    免費脫衣圖片

    Clothoff.io

    Clothoff.io

    AI脫衣器

    AI Hentai Generator

    AI Hentai Generator

    免費產生 AI 無盡。

    熱門文章

    R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
    3 週前By尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O.最佳圖形設置
    3 週前By尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O.如果您聽不到任何人,如何修復音頻
    3 週前By尊渡假赌尊渡假赌尊渡假赌
    WWE 2K25:如何解鎖Myrise中的所有內容
    3 週前By尊渡假赌尊渡假赌尊渡假赌

    熱工具

    Dreamweaver Mac版

    Dreamweaver Mac版

    視覺化網頁開發工具

    EditPlus 中文破解版

    EditPlus 中文破解版

    體積小,語法高亮,不支援程式碼提示功能

    WebStorm Mac版

    WebStorm Mac版

    好用的JavaScript開發工具

    SAP NetWeaver Server Adapter for Eclipse

    SAP NetWeaver Server Adapter for Eclipse

    將Eclipse與SAP NetWeaver應用伺服器整合。

    SublimeText3 Mac版

    SublimeText3 Mac版

    神級程式碼編輯軟體(SublimeText3)