天天看点

本地 YUM 源管理一、本地 YUM 源管理

一、本地 YUM 源管理

使用 VMWare 软件启动提供的 xserver1 虚拟机(配置虚拟机 xserver1 的 IP 为 `192.168.100.11`,主机名为 xserver1)
在虚拟机的/root 目录下,存在一个`CentOS-7-x86_64-DVD-1511.iso` 的镜像文件,使用这个镜像文件配置本地 yum 源,
要求将这个镜像文件挂载在`/opt/centos` 目录,请问如何配置自己的 local.repo 文件,使得可以使用该镜像中的软件包,安装软件。
请将 local.repo 文件的内容和执行 yum repolist 的返回结果(简要)写到下方。           
echo "TYPE=Ethernet
BOOTPROTO=static
DEVICE=eno16777736
ONBOOT=yes
IPADDR=192.168.100.11
GATEWAY=192.168.100.1
PREFIX=24" > /etc/sysconfig/network-scripts/ifcfg-eno16777736

[root@xserver1 ~]# hostnamectl set-hostname xserver1
[root@xserver1 ~]# bash

[root@xserver1 ~]#cd
[root@xserver1 ~]# mkdir /opt/centos
[root@xserver1 ~]# mount -o loop CentOS-7-x86_64-DVD-1511.iso /opt/centos/

[root@xserver1 ~]# mkdir /etc/yum.repos.d/bak
[root@xserver1 ~]# mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak/


echo "[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1" > /etc/yum.repos.d/local.repo 

[root@xserver1 ~]# yum clean all
[root@xserver1 ~]# yum repolist
Loaded plugins: fastestmirror
centos                                                                 | 3.6 kB  00:00:00     
(1/2): centos/group_gz                                                 | 155 kB  00:00:00     
(2/2): centos/primary_db                                               | 2.8 MB  00:00:00     
Determining fastest mirrors
repo id                                     repo name                                   status
centos                                      centos                                      3,723
repolist: 3,723           

继续阅读