zoukankan      html  css  js  c++  java
  • Install Packages Via yum Command Using DVD / CD as Repo

    CentOS Linux comes with CentOS-Media.repo which is used to mount the default locations for a CDROM / DVD on CentOS-5. You can use this repo and yum to install items directly off the DVD ISO that we release. Open /etc/yum.repos.d/CentOS-Media.repo file, enter:
    Title# vi /etc/yum.repos.d/CentOS-Media.repo

    Make sure enabled is set to 1:
    enabled=1
    Save and close the file. To use repo put your DVD and along with the other repos, enter:
    # yum --enablerepo=c5-media install pacakge-name
    To only use the DVDmedia repo, do this:
    # yum --disablerepo=\* --enablerepo=c5-media install pacakge-name
    OR use groupinstall command
    # yum --disablerepo=\* --enablerepo=c5-media groupinstall 'Virtualization'

    See Also:

    Creation of yum repositories is handled by a separate tool called createrepo, which generates the necessary XML metadata. If you have a slow internet connection or collection of all downloaded ISO images, use this hack to install rpms from iso images.

    Step # 1: Mount an ISO file

    Type the following command (replace iso file name with the actual iso file):
    # yum install createrepo
    # mkdir -p /mnt/iso/{1,2,3}
    # mount -o loop /path/to/centos1.iso /mnt/iso/1

    Step # 2: Create a repository

    Use createrepo to generate the necessary XML metadata. Type the following commands:
    # cd /mnt/iso
    # createrepo .

    Clean repo, enter:
    # yum clean all

    Step # 3: Create config file

    You need to create a repo config file in /etc/yum.repos.d/ directory.
    # vi /etc/yum.repos.d/iso.repo
    Append following text:
    [My ISO Repository]
    baseurl=file:///mnt/iso
    enabled=1

    Save and close the changes.

    Now use yum command to install packages from ISO images:
    # yum install package-name

  • 相关阅读:
    [PHP]AES加密----PHP服务端和Android客户端
    [PHP]memcache安装
    [Android]apk反编译方法
    [PHP]生成随机数(建立字典)
    [PHP]Mysql的运用
    [PHP]对象数组和普通数组总结
    ThinkPHP5+Redis单例型购物车
    移动硬盘新建选项消失、不能新建文件夹和文件的解决方案
    PHP substr() 函数截取中文字符串乱码
    php开发中遇到问题的找错误的方法
  • 原文地址:https://www.cnblogs.com/smartvessel/p/2680083.html
Copyright © 2011-2022 走看看