zoukankan      html  css  js  c++  java
  • yum源配置、epel源配置

    关键词:yum源,本地yum源,网络yum源
     

    【1】配置本地yum源

      1、挂载好光盘到/redhat/mnt/mnt下
        mount /dev/cdrom /mnt
      2、操作

        cd /etc/yum.repos.d/

        ll

         

         #新建一个文件,修改内容

        vim base.repo

        

      代码参考:

    echo "/dev/sde /mnt btrfs defaults 0 0" >> /etc/fstab
    
    添加repo文件
    
    cp CentOS7-Base-163.repo local_yum.repo 复制一个原来的repo源
    
    vim local_yum.repo 编辑
    
    添加以下内容到local_yum.repo
    
    [local_yum]
    name=local_yum
    baseurl=file:///mnt
    gpgcheck=0
    enabled=1
    
    yum clean all 清空缓存
     

    【2】配置网络yum源

     
    参考于:
    http://mirrors.aliyun.com/help/centos?spm=5176.bbsr150321.0.0.d6ykiD
     
    1、备份原文件
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak
    2、下载新的repo文件
    CentOS 5
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo 
    CentOS 6
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    CentOS 7
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    网易源centos6
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
    [root@rac1 yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
    --2017-10-14 23:18:31--  http://mirrors.163.com/.help/CentOS6-Base-163.repo
    正在解析主机 mirrors.163.com... 123.58.190.209, 123.58.190.228, 123.58.190.234, ...
    正在连接 mirrors.163.com|123.58.190.209|:80... 已连接。
    已发出 HTTP 请求,正在等待回应... 200 OK
    长度:2006 (2.0K) [application/octet-stream]
    正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”
    
    100%[=========================================================>] 2,006       --.-K/s   in 0.001s  
    
    2017-10-14 23:18:31 (1.90 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2006/2006])
    
    ----------
    下载成功后,加载缓存
    yum
    clean all yum makecache #yum update
    #清除原来的源配置
    
    [root@localhost ~]# yum clean all
    
    #更新yum源到本地 [root@localhost ~]# yum list #安装现在的yum源,这一步也是测试新安装的yum源有没有安装成功 [root@localhost ~]# yum install yum
    ---------- 
     
     
     
     
    3、如果报域名解析失败:
    [root@RAC01 yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 
    --2017-10-14 01:22:16--  http://mirrors.aliyun.com/repo/Centos-6.repo
    正在解析主机 mirrors.aliyun.com... 失败:域名解析暂时失败。
    wget: 无法解析主机地址 “mirrors.aliyun.com”
    4、新增dns域名地址
    新增下面一条内容:
    [root@RAC01 yum.repos.d]# vi /etc/resolv.conf 
    nameserver 8.8.8.8


    5、生成缓存
    [root@RAC01 yum.repos.d]# yum makecache 
    Loaded plugins: fastestmirror, security
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    base                                                     | 3.7 kB     00:00     
    base/group_gz                                            | 226 kB     00:00     
    base/filelists_db                                        | 6.4 MB     00:02     
    base/primary_db                                          | 4.7 MB     00:01     
    base/other_db                                            | 2.8 MB     00:00     
    extras                                                   | 3.4 kB     00:00     
    extras/filelists_db                                      |  25 kB     00:00     
    extras/prestodelta                                       | 1.3 kB     00:00     
    extras/primary_db                                        |  29 kB     00:00     
    extras/other_db                                          |  30 kB     00:00     
    updates                                                  | 3.4 kB     00:00     
    updates/filelists_db                                     | 2.9 MB     00:00     
    updates/prestodelta                                      | 130 kB     00:00     
    updates/primary_db                                       | 4.7 MB     00:01     
    updates/other_db                                                                                             |  66 MB     00:18     
    Metadata Cache Created
    6、ok。
     

    【3】epel源

    EPEL源-是什么?为什么安装?
     
     EPEL (Extra Packages for Enterprise Linux)是基于Fedora的一个项目,为“红帽系”的操作系统提供额外的软件包,适用于RHEL、CentOS和Scientific Linux.
     
    使用很简单:
    1. 首先需要安装一个叫”epel-release”的软件包,这个软件包会自动配置yum的软件仓库。当然你也可以不安装这个包,自己配置软件仓库也是一样的。
     
    #用于RHEL5系列
    wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
    rpm -ivh epel-release-5-4.noarch.rpm
     
    #用于RHEL6系列
    wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm
    rpm -ivh epel-release-6-5.noarch.rpm
     
    2. 安装完成之后你就可以直接使用yum来安装额外的软件包了
    yum clean all
     
    yum makecache
    yum install nginx pure-ftpd
     
     
    3.直接自己手工添加软件仓库配置文件
    vi /etc/yum.repos.d/epel.repo
     
    [epel]
    name=epel
    mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-releasever&arch=releasever&arch=basearch
    enabled=1
    gpgcheck=0
     
    CentOS6.5添加阿里云的EPEL源
    yum localinstall --nogpgcheck http://mirrors.aliyun.com/epel/6/x86_64/epel-release-6-8.noarch.rpm
     
    安装阿里云EPEL源
    1、首先卸载以前装的epel以免影响
    rpm -e epel-release
    2、 下载阿里提供的epel
    wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-6.repo
    3yum clean all
    4yum makecache
     
    阿里云源安装示例:
    1、备份(如有配置其他epel源)
    mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup
    mv /etc/yum.repos.d/epel-testing.repo /etc/yum.repos.d/epel-testing.repo.backup
     
    2、下载新repo 到/etc/yum.repos.d/
    epel(RHEL 7)
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
     
    epel(RHEL 6)
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
     
    epel(RHEL 5)
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-5.repo
     
     
    来源:https://www.cnblogs.com/fps2tao/p/7580188.html
  • 相关阅读:
    Codeforces 590 A:Median Smoothing
    HDU 1024:Max Sum Plus Plus 经典动态规划之最大M子段和
    POJ 1027:The Same Game 较(chao)为(ji)复(ma)杂(fan)的模拟
    【算法学习】 在一天的24小时之中,时钟的时针、分针和秒针完全重合在一起的时候有几次?
    【读书笔记】 spinlock, mutex and rwlock 的性能比较
    【读书笔记】 nginx 负载均衡测试
    【读书笔记】 多线程程序常见bug
    关注一下 hurd OS的开发
    【读书笔记】 分布式文件存储系统 MogileFS
    【读书笔记】 nginx + memcached 高速缓存
  • 原文地址:https://www.cnblogs.com/gered/p/10768795.html
Copyright © 2011-2022 走看看