CentOS配置yum源
阿新 • • 發佈:2018-12-15
1.CentOS預設的yum檔案目錄如下:
-rw-r--r-- 1 root root 1926 Dec 21 2017 CentOS-Base.repo
-rw-r--r--. 1 root root 638 Feb 25 2013 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 630 Feb 25 2013 CentOS-Media.repo
-rw-r--r--. 1 root root 3664 Feb 25 2013 CentOS-Vault.repo
2.將預設的yum檔案進行備份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak
3.下載阿里雲yum源repo檔案
地址:http://mirrors.aliyun.com/repo/Centos-6.repo
4.將下載的檔案拷貝到yum源目錄下並重命名
mv Centos-6.repo /etc/yum.repos.d/CentOS-Base.repo
5.執行yum源更新命令
yum clean all
yum makecache
提示:
如果是配置內網的環境,確保可以訪問外網,如無法訪問外網,可以通過設定http、https代理,在/etc/profile如下設定:
export http_proxy=192.168.2.110:1080 export https_proxy=192.168.2.110:1080
通過以下命令來判斷是否可以訪問阿里雲:
[[email protected] sbin]# curl mirrors.aliyun.com <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html> <head><title>301 Moved Permanently</title></head> <body bgcolor="white"> <h1>301 Moved Permanently</h1> <p>The requested resource has been assigned a new permanent URI.</p> <hr/>Powered by Tengine</body> </html>