linux-centos-yum源配置

yum的配置文件路径

  1. cd /etc/yum.repos.d/
  2. 填写yum源的唯一ID标识,可以为任意字符串,
    1.   name               是yum源名称,可以为任意字符串,
    2.   baseurl            指定yum源的url地址,
    3.   mirrorlist  -->指定镜像站点目录,默认是官网自身的yum源,这个可以注释掉,使用baseurl指定的源(http://mirrors.aliyun.com/repo/Centos-6.repo),
    4.   enabled  -->指是否激活YUM源0代表禁用,1代表激活
    5.   gpgcheck -->安装软件时是否检查签名0代表禁用1代表激活 
    6.   gpgkey   -->如果检查软件包的签名,则该语句代表检查签名的密钥文件
name=
baseur=
mirrorlist=
enabled=
gpgcheck=
gpgkey=
# CentOS-Base.repo
#
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com # 名字
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/   # URL源地址
        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
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/$releasever/updates/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
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/$releasever/extras/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
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/$releasever/centosplus/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
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/$releasever/contrib/$basearch/
        http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
        http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

注意:单个的安装包可能会依赖其它包(例如yum和yum-fastestmirror会相互依赖),所以我们可以把所有这些包放在一起,用一行命令将它们同时安装即可

rpm -ivh python-urlgrabber-3.10-10.el7.noarch.rpm
rpm -ivh yum-*

清除并生成缓存

yum clean all
yum makecache
yum update

 

posted @ 2022-10-21 22:44  link-零  阅读(80)  评论(0编辑  收藏  举报