centos系統(tǒng)yum源相關(guān)知識(shí)

公網(wǎng)源

國(guó)防科技大學(xué) https://mirrors.ustc.edu.cn/

清華大學(xué) https://mirrors.tuna.tsinghua.edu.cn/

網(wǎng)易163 http://mirrors.163.com/

阿里云 http://mirrors.aliyun.com/

中科院 http://www.opencas.org/mirrors/

需要更多請(qǐng)參考:http://blog.csdn.net/thanklife/article/details/55049337

yum配置文件

配置文件路徑:/etc/yum.repos.d
配置文件必須以.repo結(jié)尾
比如使用本地光盤鏡像做源(光盤掛載目錄/mnt/centos6.8)
文件名CentOS-Media.repo

[c6-media]
name=CentOS-$releasever - Media
baseurl=[file:///mnt/centos6.8/](http://file:///mnt/centos6.8/)
gpgcheck=1
enabled=1
gpgkey=file:///mnt/centos6.8/RPM-GPG-KEY-CenOS-6
  • [] 倉(cāng)庫(kù)標(biāo)識(shí)
  • name 倉(cāng)庫(kù)名
  • baseurl 倉(cāng)庫(kù)地址,如果是本地文件使用file://+路徑, http://, ftp://
  • gpgcheck 檢查倉(cāng)庫(kù)包的簽名
  • enabled 啟用此倉(cāng)庫(kù)
  • gpgkey 指定倉(cāng)庫(kù)key存放位置

變量:
$releasever 表示系統(tǒng)主版本號(hào)

$basearch 表示系統(tǒng)x86_64或者x86

yum相關(guān)常用命令

rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY 導(dǎo)入key*
yum install 安裝程序
yum installgroup 安裝程序組
yum update 更新程序
yum remove 刪除程序
yum deplist 列出程序依賴關(guān)系
yum search 從倉(cāng)庫(kù)搜索程序
yum list 輸出程序列表
yum info 輸出程序信息
yum repolist 輸出倉(cāng)庫(kù)列表
yum clean all 清理所有yum本地緩存
yum makecache 重做yum緩存

私有源建設(shè)

掛載光盤
mount /dev/cdrom /mnt/cdrom
掛載本地iso文件
mount -o loop -t iso9660 /mnt/red.iso /mnt/red
比如epel源:
nginx配置

    location /epel/ {
        alias /mnt/epel/;
        index index.html index.htm;
        autoindex on;
        autoindex_exact_size off;
        autoindex_localtime on;
    }

rsync同步源

5 1 * * * root  rsync -avzL rsync://rsync.mirrors.ustc.edu.cn/epel/ /mnt/epel/ >> /root/yunwei/monitor/rsync.epel.log

共有源

CenOS base源

備份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

centos6

阿里云
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
網(wǎng)易
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo

centos7

阿里云
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
網(wǎng)易
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

epel源

centos6

阿里云
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

centos7

阿里云
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容