• 如何使用安装光盘为本机创建yum repository


    在CentOS 6上可以使用系统安装光盘为本机创建yum repository,创建过程如下。

    • 创建光盘mount点

    [root@centos62 ~]# mkdir /media/CentOS

    • mount安装盘

    [root@centos62 ~]# mount /dev/sr0 /media/CentOS
    mount: block device /dev/sr0 is write-protected, mounting read-only
    
    [root@centos62 ~]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/vg_centos62-lv_root
                           18G  752M   16G   5% /
    tmpfs                 495M     0  495M   0% /dev/shm
    /dev/sda1             485M   31M  429M   7% /boot
    /dev/sr0              4.2G  4.2G     0 100% /media/CentOS
    • 修改yum repository配置

    yum repository的配置文件存储在/etc/yum.repos.d目录下,修改repos配置如下所示(红色部分)

    [root@centos62 ~]# cd /etc/yum.repos.d/
    
    [root@centos62 yum.repos.d]# more CentOS-Media.repo
    # CentOS-Media.repo
    #
    # This repo is used to mount the default locations for a CDROM / DVD on
    #  CentOS-6.  You 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=c6-media [command]
    #
    # or for ONLY the media repo, do this:
    #
    #  yum --disablerepo=* --enablerepo=c6-media [command]
    
    [c6-media]
    name=CentOS-$releasever - Media
    baseurl=file:///media/CentOS/
            file:///media/cdrom/
            file:///media/cdrecorder/
    gpgcheck=1
    enabled=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

    • disable base repository

    将base repository配置文件重命名

    [root@centos62 yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.disabled
    • 清除缓存并显示repository

    [root@centos62 yum.repos.d]# yum clean all
    Loaded plugins: fastestmirror
    Cleaning repos: c6-media
    Cleaning up Everything
    Cleaning up list of fastest mirrors
    
    [root@centos62 yum.repos.d]# yum repolist
    Loaded plugins: fastestmirror
    Determining fastest mirrors
     * c6-media:
    c6-media                                                 | 4.0 kB     00:00 ...
    c6-media/primary_db                                      | 4.5 MB     00:00 ...
    repo id                          repo name                                status
    c6-media                         CentOS-6 - Media                         6,294
    repolist: 6,294

  • 相关阅读:
    ReportingService 通过RowNumber函数获取行号和生成隔行变色样式
    C#中Attribute的继承
    在ASP.NET非MVC环境中(WebForm中)构造MVC的URL参数,以及如何根据URL解析出匹配到MVC路由的Controller和Action
    _kbhit() for linux
    pthread_create用法(转)
    XACT Q&A (转)
    libcurl使用心得-包括下载文件不存在处理相关(转)
    2013总结-2014展望
    curl常用设置-涉及超时相关
    一行代码让App运行时iPhone不会进入锁屏待机状态
  • 原文地址:https://www.cnblogs.com/cqubityj/p/3520782.html
Copyright © 2020-2023  润新知