zoukankan      html  css  js  c++  java
  • YUM简单入门

    1.制作YUM源
    先关闭相关安全设置,安装vsftpd

    [root@rhel7 ~]# firewall-cmd --set-default-zone=trusted  设置防火墙受信
    [root@rhel7 ~]# setenforce 0
    [root@rhel7 ~]# systemctl start vsftpd  启动已经安装的vsftpd
    [root@rhel7 ~]# systemctl enable vsftpd
    [root@rhel7 ~]# ls /var/ftp/  共享目录
    pub

    挂载到共享目录

    [root@rhel7 ~]# mkdir /var/ftp/dvd
    [root@rhel7 ~]# umount /mnt
    [root@rhel7 ~]# mount /dev/cdrom /var/ftp/dvd/
    mount: /dev/sr0 is write-protected, mounting read-only
    [root@rhel7 ~]# ls /var/ftp/dvd/
    addons  GPL       LiveOS      release-notes            RPM-GPG-KEY-redhat-release
    EFI     images    media.repo  repodata                 TRANS.TBL
    EULA    isolinux  Packages    RPM-GPG-KEY-redhat-beta
    [root@rhel7 ~]# rm -rf /var/ftp/pub/

    对新增的安装包目录生成包的元数据(把包中依赖关系统计)

    createrepo -v 目录 (会在目录下生成一个repodata的原数据信息)

    配置yum路径特性

    [root@rhel7 ~]# cat /etc/yum.repos.d/file.repo
    [dvd]
    name=dvd
    baseurl=ftp://192.168.56.133/dvd
    enabled=1
    gpgcheck=0

    生成yum

    [root@rhel7 ~]# yum clean all
    [root@rhel7 ~]# yum makecache

    2.YUM命令简单使用
    查询安装包

    [root@rhel7 ~]# yum search vsftpd
    vsftpd.x86_64 : Very Secure Ftp Daemon
    [root@rhel7 ~]# yum list vsftpd   可以知道包的安装情况
    vsftpd.x86_64                                  3.0.2-9.el7                                  installe

    清除提示信息

    [root@rhel7 ~]# yum list subscript*
    Loaded plugins: product-id, subscription-manager  #redhat系统是免费使用的,但是服务是收费的
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    [root@rhel7 ~]# yum remove subscript* -y

    查找命令对应的安装包----常用

    [root@rhel7 ~]# yum whatprovides */ifconfig   #*/是因为包安装完后,会放在各个不同目录下,这里是可能在那个目录下
    net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools
    Repo        : dvd
    Matched from:
    Filename    : /sbin/ifconfig

    要实现某个功能,这个功能是由很多个包组成

    [root@rhel7 ~]# yum grouplist 
    There is no installed groups file.
    Maybe run: yum groups mark convert (see man yum)
    Available environment groups:
       Minimal Install
       Infrastructure Server
       File and Print Server
       Basic Web Server
       Virtualization Host
       Server with GUI
    Available Groups:
       Compatibility Libraries
       Console Internet Tools
       Development Tools
       Graphical Administration Tools
       Legacy UNIX Compatibility
       Scientific Support
       Security Tools
       Smart Card Support
       System Administration Tools
       System Management
    Done
    [root@rhel7 ~]# yum grouplist virtual*
    There is no installed groups file.
    Maybe run: yum groups mark convert (see man yum)
    Available environment groups:
       Virtualization Host
    Done
    [root@rhel7 ~]# yum groupinstall virtual* -y

    禁用yum源

    [root@rhel7 ~]# yum list ceph --disablerepo=ceph
    [root@rhel7 ~]# yum list ceph --disablerepo=* --enablerepo=ceph 禁用所有源,只使用ceph

    安装时设置下载包存放的路径(需要搭建本地源时,可以下载所有包)

    [root@rhel7 ~]# yum install ceph -y --downloaddir=/opt --downonly #下载到/opt,只是下载
    

    yum报错:Bad id for repo

    “[centos - updates]”的格式不对,“centos”,“-”,“updates”之间是不允许存在空格的,删除即可。
    

      

  • 相关阅读:
    lintcode-135-数字组合
    如何下载网页上的视频?
    tree
    lintcode-512-解码方法
    前端 启动项目内存溢出
    导入txt和导出txt文件
    webStorm 2018.3.2永久破解方法
    前端导出功能
    定时器刷新机制 setInterval react
    getFieldsValue,getFieldValue,validateFields,resetFields,getFieldDecorator的用法;
  • 原文地址:https://www.cnblogs.com/reid21/p/9752470.html
Copyright © 2011-2022 走看看