欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

RedHat6.5用镜像文件配置yum源 博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso

程序员文章站 2024-03-02 09:36:28
...
RedHat 6.5 x64

[root@gyum ~]# mkdir -p /mnt/cdrom
[root@gyum ~]# df –h
[root@gyum ~]# yum repolist
RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso
[root@gyum ~]# yum clean all
[root@gyum ~]# cd /opt
[root@gyum opt]# ls
rh  rhel-server-6.5-x86_64-dvd.iso

[root@gyum ~]# cd /etc/yum.repos.d/
[root@gyum yum.repos.d]# ls
dvd.repo

[root@gyum opt]# mount -t iso9660 -o loop rhel-server-6.5-x86_64-dvd.iso /mnt/cdrom/
或者
[root@gyum opt]# mount -t iso9660 -o loop /opt/rhel-server-6.5-x86_64-dvd.iso /mnt/cdrom/

[root@gyum opt]# df –h
RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso
[root@gyum opt]# yum repolist
RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso
[root@gyum opt]# yum list|grep vsftpd
RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso
[root@gyum opt]# yum -y install gcc
RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso
RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso

dvd.repo文件内容如下:
[rhel-dvd]
name=Red Hat Enterprise Linux $releasever - $dvd
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[HighAvailability]
name=HighAvailability
baseurl=file:///mnt/cdrom/HighAvailability
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[LoadBalancer]
name=LoadBalancer
baseurl=file:///mnt/cdrom/LoadBalancer
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[ResilientStorage]
name=ResilientStorage
baseurl=file:///mnt/cdrom/ResilientStorage
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[ScalableFileSystem]
name=ScalableFileSystem
baseurl=file:///mnt/cdrom/ScalableFileSystem
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[Server]
name=Server
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release


[root@gyum opt]# yum makecache
[root@gyum opt]# yum list | wc -l
6425

---------------------------------------------------------------------------
RedHat 7.2 x64

[root@gyum opt]# mount -o ro /dev/cdrom /mnt/cdrom

dvd7.repo文件内容如下
[rhel-dvd7]
name=Red Hat Enterprise Linux $releasever - $dvd7
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

----------------------------------------------------------------------------
RedHat 5.9 x64
[root@gyum opt]# mount -o loop /dev/cdrom /mnt/cdrom

dvd5.repo文件内容如下
[Server]
name=Server
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[VT]
name=VT
baseurl=file:///mnt/cdrom/VT
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[Cluster]
name=Cluster
baseurl=file:///mnt/cdrom/Cluster
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[ClusterStorage]
name=ClusterStorage
baseurl=file:///mnt/cdrom/ClusterStorage
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release


----------------------------------------------------------------------------
CentOS 6.5 x64
[root@gyum opt]# mount -o loop /dev/cdrom /mnt/cdrom

centos6.repo文件内容如下
[cent-centos6]
name=CentOS $releasever - $centos6
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6


----------------------------------------------------------------------------
CentOS 7.3 x64
[root@gyum opt]# mount -o loop /dev/cdrom /mnt/cdrom

centos7.repo文件内容如下
[cent-centos7]
name=CentOS-$releasever - $centos7
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7



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

有时候在执行mount -o loop /dev/cdrom /mnt/cdrom后仍然不能正确执行如下命令:
yum list|grep vsftpd
报如下错误:
Loaded plugins: fastestmirror, langpacks
Existing lock /var/run/yum.pid: another copy is running as pid 8827.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  27 M RSS (916 MB VSZ)
    Started: Tue Oct  1 19:21:47 2019 - 03:17 ago
    State  : Sleeping, pid: 8827
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  27 M RSS (916 MB VSZ)
    Started: Tue Oct  1 19:21:47 2019 - 03:19 ago
    State  : Sleeping, pid: 8827
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  27 M RSS (916 MB VSZ)
    Started: Tue Oct  1 19:21:47 2019 - 03:21 ago
    State  : Sleeping, pid: 8827
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
    Memory :  27 M RSS (916 MB VSZ)
    Started: Tue Oct  1 19:21:47 2019 - 03:23 ago
    State  : Sleeping, pid: 8827
......

【注】: 关注上面的/var/run/yum.pid文件, yum.pid文件中的内容为8827, 这个错误的含义是有yum进程在运行, 一台Linux主机只能有一个yum进程, 所以必须把当前的yum进程干掉才能再次使用mount命令挂接, 这里要注意的是kill -9命令不能干掉yum进程, RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso
正确干掉yum进程的命令如下:
rm -f /var/run/yum.pid
执行完成后再次执行mount -o loop /dev/cdrom /mnt/cdrom就可以了, 然后用如下命令验证:
yum list|grep vsftpd
此时已经正常了, RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso
  • RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso
  • 大小: 15.6 KB
  • RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso
  • 大小: 10.7 KB
  • RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso
  • 大小: 26.1 KB
  • RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso
  • 大小: 4.4 KB
  • RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso
  • 大小: 46.9 KB
  • RedHat6.5用镜像文件配置yum源
            
    
    博客分类: redhatRedHat6.5yumLinuxiso redhatredhat6.5yumlinuxiso
  • 大小: 53.2 KB