zoukankan      html  css  js  c++  java
  • 配置本地yum源

    配置本地yum源

    1、挂载系统安装光盘

    # mount /dev/cdrom /mnt/cdrom/

    2、配置本地yum源

    # cd /etc/yum.repos.d/

    # ls

    会看到四个repo 文件

     

    CentOS-Base.repo 是yum 网络源的配置文件

    CentOS-Media.repo 是yum 本地源的配置文件

    修改CentOS-Media.repo

    # cat CentOS-Media.repo

    # CentOS-Media.repo

    # This repo is used to mount the default locations for a CDROM / DVD on

    # CentOS-5You can use this repo and yum to install items directly off the

    #  DVD ISO that we release.

    # To use this repo, put in your DVD and use it with the other repos too:

    #  yum --enablerepo=c5-media [command]

    # or for ONLY the media repo, do this:

    #  yum --disablerepo=* --enablerepo=c5-media [command]

    [c5-media]

    name=CentOS-$releasever - Media

    baseurl=file:///media/CentOS/

            file:///mnt/cdrom/

            file:///media/cdrecorder/

    gpgcheck=1

    enabled=1

    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

    在baseurl 中修改第2个路径为/mnt/cdrom(即为光盘挂载点)

    将enabled=0改为1

    3、禁用默认的yum 网络源

    将yum 网络源配置文件改名为CentOS-Base.repo.bak,否则会先在网络源中寻找适合的包,改名之后直接从本地源读取。

    4、执行yum 命令

    # yum install postgresql

     

     

     

    Centos7

    创建好mnt/cdrom目录直接执行mount dev/cdrom mnt/cdrom 命令就挂载成功了。

    2、进入/etc/yum.repos.d目录 
    #cd /etc/yum.repos.d 
    该目录下有如下4个文件: 
     
    CentOS-Base.repo.bak文件是被我从命名后的文件,base里面配置的网络yum;会优先被加载,改名以后就不会加载网络yum了。

    3、编辑CentOS-Sources.repo文件

    [base-source]
    name=CentOS-$releasever - Base Sources
    baseurl=file:///mnt/cdrom
    gpgcheck=1
    enabled=1
    gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-7
    #修改baseurl、gpgkey指向挂载目录,设置enabled=1表示启用。
    

    到这里就配置完毕了。

  • 相关阅读:
    SQL compute by 的使用
    C# DES加密/解密字符串
    SET NOCOUNT { ON | OFF }
    SQL Server游标的使用 转
    SQL优化的一些总结
    精确获取时间(QueryPerformanceCounter)测试程序效率
    ajax的使用原理
    jq三级导航菜单可修改为二级、四级等导航菜单
    本地搭建PHP环境
    固定在屏幕底部的层
  • 原文地址:https://www.cnblogs.com/cniteeq/p/3508095.html
Copyright © 2011-2022 走看看