基于linux下的yum命令及其共享

1.yum的基本命令

yum    update                                         ##更新软件

           history                                          ##查看软件改变历史

           repolist                                         ##列出yum源信息

           list    all                                         ##列出系统所有软件名字

           list    installed                                ##列出已经安装的软件

           list    available                                ##列出可以用yum安装的软件

          clean  all                                         ##清空缓存

           list                    softwarename             ##查看软件源中是否有此软件

           remove             softwarename            ##卸载软件

            install               softwarename             ##安装软件

           serach                softwarename            ##根据软件信息查看软件

          whatprovides      filename                     ##在yum源中查找包含filename文件的软件

           reinstall               softwarename           ##重新安装

            info                   sofewarename            ##查看软件信息

            groups    list                                         ##查看软件组信息

            groups    info     softwaregroup             ##查看软件组内包含的软件

             groups   install   softwaregroup            ##安装组件

2、设置安装yum功能的实现

第一步:下载与系统相匹配的镜像

              真机镜像:rhel-server-7.2-x86_64-dvd.iso

              虚拟机镜像:rhel-server-7.0-x86_64-dvd.iso

第二步:为了操作方便,把镜像放置在一个/iso根目录下mv /home/kiosk/Desktop/*.iso  /iso

第三步:mkdir /rhel7.0   /rhel7.2

第四步:挂载镜像 

             mount /iso/rhel-server-7.0-x86_64-dvd.iso /rhel7.0     

             mount /iso/rhel-server-7.2-x86_64-dvd.iso /rhel7.2  

第五步: cd  /etc/yum.repos.d/

              mkdir  /repobackup

               mv *  /repoback

第六步: yum配置文件(还是/etc/repos.d/的目录)

             vim yum.repo

      编写:  [rhel7.2]

                  name =rhel7.2

                baseurl=file:///rhel7.2

                 gpgcheck=0 退出保存

第七步:yum clean all   

接下来你就可以在真机上做实验啦,但是虚拟机并不能使用yum命令,所以我们接下来学习yum源的共享功能,让虚拟机也可以使用yum命令



3.yum源的共享

1.在本地yum源配置完成之后安装apache(这里的systemctl 之前有讲过,就不细说了)

yum  install   httpd

systemctl   start  httpd            

systemctl   enable  httpd

systemctl   stop   firewalld

systemctl   disable  firewalld

mkdir /var/www/html/rhel7.0   /var/www/html/rhel7.2



2.挂载镜像

 mount/iso/rhel-server-7.0-x86_64-dvd.iso /var/www/html/rhel7.0  挂载镜像

 mount/iso/rhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7.2

(如果想要开机后自动挂载镜像的话则挂载按照下面操作)

vim /etc/rc.d/rc.local

编辑写入

mount /iso/rhel-server-7.0-x86_64-dvd.iso /rhel7.0

mount /iso/rhel-server-7.2-x86_64-dvd.iso /rhel7.2   (真机上自动挂载)

 mount/iso/rhel-server-7.2-x86_64-dvd.iso /var/www/html/rhel7.2

 mount/iso/rhel-server-7.0-x86_64-dvd.iso /var/www/html/rhel7.0  (虚拟机自动挂载)

然后退出保存,就完成了开机自动挂载镜像的设置

chmod +x /etc/rc.d/rc.local



3.访问测试

在浏览器中输入地址(ip都为真机ip)

http://ip/rhel7.0     

http://ip/rhel7.02



4.配置虚拟机

rm -fr /etc/yum.repos.d/*

vim /etc/yum.repos.d/yum.repo

写入 [rhel7.0]

        name=rhel7.0

        baseurl=http://真机ip/rhel7.0

        gpgcheck=0

虚拟机配置完成,可以使用yum命令

umount  /var/www/html/rh7.0     卸载挂载镜像

安装软件时,yum  自动识别软件依赖性并且安装

                    rpm  不能解决软件依赖性问题

                  

       

     






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值