First: mount a local image file (mount: means to place a file in a directory on the system)
Mkdir/media/cdrom #新建镜像文件挂载目录
CD/USR/LOCAL/SRC #进入系统镜像文件存放目录
LS #列出目录文件, you can see the system image file just uploaded
Mount-t iso9660-o loop/usr/local/src/rhel-server-7.0-x86_64-dvd.iso/media/cdrom# Mount system image
Cd/media/cdrom #进入挂载目录, use the LS command to see that a file already exists.
Remark: Umount/media/cdrom #卸载系统镜像
Second: Set boot automatically mount local image file (image file to be mounted to use, write this line in the file for permanent entry)
Vim/etc/fstab #添加以下红字代码 for automatic mount mirroring of boot
#/etc/fstab
# Created by Anaconda on Sun Sep 21 13:24:28 2014
#
# Accessible filesystems, by reference, is maintained under '/dev/disk '
# See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for more info
#
/DEV/MAPPER/RHEL-ROOT/XFS Defaults 1 1
Uuid=876fb356-4406-4844-b46d-9dd41f19ea11/boot XFS Defaults 1 2
/dev/mapper/rhel-swap swap swap defaults 0 0
/usr/local/src/rhel-server-7.0-x86_64-dvd.iso/media/cdrom iso9660 Loop 0 0
: wq! #保存退出
Note: iso9660 use df-h to view devices
Third: Configuring the local Yum source
Cd/etc/yum.repos.d/#进入yum配置目录
Touch Rhel-media.repo #建立yum配置文件
Vim Rhel-media.repo #编辑配置文件, add the following:
[Rhel-media]
name=red Hat Enterprise Linux 7.0 #自定义名称
Baseurl=file:///media/cdrom #本地光盘挂载路径
Enabled=1 #启用yum源, 0 is not enabled, 1 is enabled
Gpgcheck=0 #检查GPG-key,0 for no check, 1 for inspection
: wq! #保存退出
Fourth: Using the Yum command to install the software for testing
Yum List #显示yum包
Yum Clean all #清除yum缓存
Yum Makecache #缓存本地yum源中的软件包信息
Yum Install httpd #安装apache
RPM-QL httpd #查询所有安装httpd的目录和文件
How to configure the Yum source under Linux