yum配置练习

要求:

以真机为yum源,使虚拟机可以共享真机的yum服务

需要使用与系统一致的系统镜像

真机使用镜像文件是/home/kiosk/Desktop/rhel-server-7.3-x86_64-dvd.iso

虚拟机使用的是/home/kiosk/Desktop/rhel-server-7.0-x86_64-dvd.iso

真机下载httpd

首先进入真机的超级用户中,并且关闭防火墙

[kiosk@foundation30 ~]$ su - root
Password:
Last login: Fri Jan 18 01:39:37 CST 2019 on pts/0
[root@foundation30 ~]# systemctl stop firewalld

在真机中是没有httpd服务的,首先需要从镜像中下载

将镜像文件加载到/mnt下,

mount /home/kiosk/Desktop/jinxiang/rhel-server-7.3-x86_64-dvd.iso /mnt

在/etc/yum.repos.d/目录下建立rhel73.repo文件编辑yum配置,注意先移除无关的repo文件

vim rhel73.repo

[rhel7.3]

name=rhe7.3

baseurl=file:///mnt  

gpgcheck=0

enabled=1

yum clean all
yum repolist all  #查看yum情况

[root@foundation30 yum.repos.d]# yum install httpd -y   ##下载httpd服务

Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-

              : manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Resolving Dependencies

--> Running transaction check

---> Package httpd.x86_64 0:2.4.6-17.el7 will be installed

--> Processing Dependency: httpd-tools = 2.4.6-17.el7 for package: httpd-2.4.6-17.el7.x86_64

--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64

--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-17.el7.x86_64

--> Running transaction check

---> Package apr.x86_64 0:1.4.8-3.el7 will be installed

---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed

---> Package httpd-tools.x86_64 0:2.4.6-17.el7 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

================================================================================

 Package             Arch           Version               Repository       Size

================================================================================

Installing:

 httpd               x86_64         2.4.6-17.el7          rhel7.3         1.2 M

Installing for dependencies:

 apr                 x86_64         1.4.8-3.el7           rhel7.3         103 k

 apr-util            x86_64         1.5.2-6.el7           rhel7.3          92 k

 httpd-tools         x86_64         2.4.6-17.el7          rhel7.3          77 k

Transaction Summary

================================================================================

Install  1 Package (+3 Dependent packages)

Total download size: 1.4 M

Installed size: 4.3 M

Downloading packages:

--------------------------------------------------------------------------------

Total                                               21 MB/s | 1.4 MB  00:00     

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Installing : apr-1.4.8-3.el7.x86_64                                       1/4

  Installing : apr-util-1.5.2-6.el7.x86_64                                  2/4

  Installing : httpd-tools-2.4.6-17.el7.x86_64                              3/4

  Installing : httpd-2.4.6-17.el7.x86_64                                    4/4

rhel7.3/productid                                        | 1.6 kB     00:00     

  Verifying  : httpd-tools-2.4.6-17.el7.x86_64                              1/4

  Verifying  : apr-1.4.8-3.el7.x86_64                                       2/4

  Verifying  : apr-util-1.5.2-6.el7.x86_64                                  3/4

  Verifying  : httpd-2.4.6-17.el7.x86_64                                    4/4

Installed:

  httpd.x86_64 0:2.4.6-17.el7                                                   

Dependency Installed:

  apr.x86_64 0:1.4.8-3.el7                 apr-util.x86_64 0:1.5.2-6.el7       

  httpd-tools.x86_64 0:2.4.6-17.el7       

Complete!

接下来需要在真机中为虚拟机配置共享yum源

[root@foundation30 yum.repos.d]# cd /var/www/html

[root@foundation30 html]# mkdir rhel7.0      ##建立目录用于存放镜像的文件

[root@foundation30 html]# ls

rhel7.0

[root@foundation30 html]# umount /mnt    

[root@foundation30 html]# mount /home/kiosk/Desktop/jinxiang/rhel-server-7.0-x86_64-dvd.iso rhel7.0    ##将镜像重新加载到http服务下

mount: /dev/loop1 is write-protected, mounting read-only

[root@foundation30 html]# ls

rhel7.0

[root@foundation30 html]# ls rhel7.0   ##成功加载

addons  images      Packages                 RPM-GPG-KEY-redhat-release

EFI     isolinux    release-notes            TRANS.TBL

EULA    LiveOS      repodata

GPL     media.repo  RPM-GPG-KEY-redhat-beta

[root@foundation30 html]# systemctl restart httpd  ##重新启动httpd服务

这时可以在浏览器上打开172.25.254.30/rhel7.0

在虚拟机上进行操作,

首先更改yum配置,然后关闭防火墙,,就可以使用yum下载了,这时候使用的是真机的yum源

[root@server80 yum.repos.d]# vim rhel_dvd.repo
[root@server80 yum.repos.d]# systemctl stop firewalld.service
[root@server80 yum.repos.d]# yum install gcc -y   ##成功安装ggc服务

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值