配置本地yum源(redhat5.5)

注意:在配置yum源前,要保证虚拟机右下角光盘这个图标的连接
配置本地yum源(redhat5.5)_第1张图片

1.查看挂载源

[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VG_ROOT-Vol01
                      9.7G  2.9G  6.4G  31% /
/dev/mapper/VG_ROOT-Vol03
                      3.0G  291M  2.5G  11% /tmp
/dev/mapper/VG_ROOT-Vol04
                      992M   34M  908M   4% /home
/dev/sda1             190M   13M  168M   7% /boot
tmpfs                1004M     0 1004M   0% /dev/shm
/dev/mapper/vg_orasoft-lv_orasoft_u01
                       15G  166M   14G   2% /u01
/dev/mapper/vg_orasoft-lv_orasoft
                      9.9G  3.4G  6.0G  37% /soft
/dev/scd0             3.5G  3.5G     0 100% /media/RHEL_5.5 x86_64 DVD      
 ##使用/dev/scd0来作为挂载源

2.挂载

[root@localhost ~]# mount /dev/scd0 /mnt/
mount: block device /dev/scd0 is write-protected, mounting read-only

3.编辑yum源的配置文件

[root@localhost ~]# vim /etc/yum.repos.d/base.repo 
[base]
name=base
baseurl=file:///mnt/Server        ##在5的版本中要在挂载目录后加/Server
enable=1
gpgcheck=0

4.测试yum源

[root@localhost ~]# yum -y install yum 
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Package yum-3.2.22-26.el5.noarch already installed and latest version
Nothing to do

5.实现开机自动挂载系统镜像文件

查看文件系统类型
[root@localhost ~]# blkid | grep /dev/scd0
/dev/scd0: LABEL="RHEL/5.5 x86_64 DVD" TYPE="iso9660" 
写入开机挂载文件中
[root@localhost ~]# vim /etc/fstab 
/dev/scd0 /mnt iso9660 defaults 0 0
[root@localhost ~]# mount -a

6.配置完成后的文件系统

[root@localhost ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VG_ROOT-Vol01
                      9.7G  2.9G  6.4G  31% /
/dev/mapper/VG_ROOT-Vol03
                      3.0G  291M  2.5G  11% /tmp
/dev/mapper/VG_ROOT-Vol04
                      992M   34M  908M   4% /home
/dev/sda1             190M   13M  168M   7% /boot
tmpfs                1004M     0 1004M   0% /dev/shm
/dev/mapper/vg_orasoft-lv_orasoft_u01
                       15G  166M   14G   2% /u01
/dev/mapper/vg_orasoft-lv_orasoft
                      9.9G  3.4G  6.0G  37% /soft
/dev/scd0             3.5G  3.5G     0 100% /media/RHEL_5.5 x86_64 DVD
/dev/scd0             3.5G  3.5G     0 100% /mnt

你可能感兴趣的:(Linux操作系统基础命令)