zoukankan      html  css  js  c++  java
  • liunx配置本地yum源和更新aliyun yum源

    1、挂载DVD光盘到/mnt   因为配置时候路径名里面不能有空格,否则不能识别

     [root@ mnt]# mount   /dev/cdrom   /mnt  

     [root@ mnt]# umount   /mnt

    2、在目录/etc/yum.repos.d/创建文件文件名.repo 

    3、配置本地yum源

    cd /etc/yum.repos.d/   #进入yum配置目录 

    touch  rhel7.repo   #建立yum配置文件 

    vim  rhel7.repo   #编辑配置文件,添加以下内容 

    [rhel-yum]

    name=rhel7   #自定义名称 

    baseurl=file:///mnt#本地光盘挂载路径 

    enabled=1   #启用yum源,0为不启用,1为启用 

    gpgcheck=0  #检查GPG-KEY,0为不检查,1为检查 

    1.找到yum源模版位置,复制一份yum模版,改成自己的名字

    cp rhel-debuginfo.repo rhel-xininfo.repo

    2.yum模版内容:

    3.配置配置自己的yum源:/mnt 光盘挂在位置,/mnt/Server,安装包位置

    4.清理yum缓存:yum clean  all

    5.验证yum是否配置成功:yum makecache

    到此,就可以用本地yum安装软件

    更新阿里yum源:

    先用本地yum源安装wget

    rpm -ivh wget-1.14-15.el7.x86_64.rpm

     cd /etc/yum.repos.d

    [root@localhost yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo

    --2018-09-06 23:24:18--  http://mirrors.aliyun.com/repo/Centos-7.repo
    Resolving mirrors.aliyun.com (mirrors.aliyun.com)... failed: Name or service not known.
    wget: unable to resolve host address ?.irrors.aliyun.com?

    如果报上面的错误,按照下面修改

    [root@localhost Packages]# vi /etc/resolv.conf
    # Generated by NetworkManager
    search localdomain
    #nameserver 192.168.3.2
    nameserver 8.8.8.8

    利用Google的DNS进行解析,就可以顺利更新了

  • 相关阅读:
    Rails生成随机字符串及加解密
    rails generate model/resource/scaffold的区别
    Rails generate的时候不生成assets和test
    rails delegate机制
    React Router V4发布
    react中创建组件的三种方法
    fetch的用法
    Ruby中map, collect,each,select,reject,reduce的区别
    Sublime Theme
    CentOS 升级Python3.X和pip3
  • 原文地址:https://www.cnblogs.com/jinxf/p/9242820.html
Copyright © 2011-2022 走看看