天天看點

本地 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           

繼續閱讀