Centos yum国内源及配置含义

Centos yum源的位置:

/etc/yum.repos.d,可以通过配置文件/etc/yum.conf指定其他位置

主要的yum源种类:前两个是必须的,不然yum安装很多软件时会失败。yum本来是智能解决软件之间的依赖,但是如果源太少,就导致查不到所需依赖。
  • epel
  • CentOS-Base
  • nginx:http://nginx.org/en/linux_packages.html#RHEL-CentOS
  • Remi源:centos7、centos6

    rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-7.rpm rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/remi-release-6.rpm 
  • 有些软件使用yum安装,需要先找到并指定这个软件的yum源
epel源安装:

安装完成之后会在目录/etc/yum.repos.d生成epel.repo

yum -y install epel-release
yum clean all  # 清除系统所有的yum缓存
yum makecache  # 生成yum缓存

导入相应的key,不然安全某些软件时会校验失败:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

安装时不校验:

yum install xx --nogpgcheck

gpgcheck=0

rpm -i --nosignature

 
 

 

切换到国内源:以阿里源举例

wget http://mirrors.aliyun.com/repo/Centos-7.repo

wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo # 下载阿里开源镜像的epel源文件

 

国内源:

网易镜像源:http://mirrors.163.com/.help/centos.html

阿里镜像源:https://opsx.alibaba.com/mirror?lang=zh-cn

 

repo文件含义:
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch  # 源地址
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch # 源地址
failovermethod=priority
enabled=1  #  是否开启这个源
gpgcheck=1   # 是否校验这个源
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 # 校验文件的位置

 

 

 

参考:

https://blog.csdn.net/inslow/article/details/54177191

https://www.jianshu.com/p/d2ecad045c54

https://blog.51cto.com/xiaocao13140/2105528

 

转载于:https://www.cnblogs.com/shengulong/p/10561735.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值