rhel6.4 yum本地yum源配置 在安装rpm包时,总是会碰到关联的包,在安装过程中带来很多麻烦,配置yum源,自关联包安装,简单省事。配置步骤:1:mount -o loop 挂载镜像盘2:编辑rhel-source.repo文件3:修改yumRepo.py配置文件4:yum install rpm包 测试yum源注意:rhel6 的rpm包都在Packages中,rhel5在Server中
mount -o loop 挂载镜像盘[root@mysql5 ~]# cd /zxx_software/[root@mysql5 zxx_software]# lsiso mysql-5.6.22.tar.gz rhel-server-6.4-x86_64-dvd.iso[root@mysql5 zxx_software]# mount -o loop rhel-server-6.4-x86_64-dvd.iso iso/[root@mysql5 zxx_software]# df -hFilesystem Size Used Avail Use% Mounted on/dev/sda3 47G 6.7G 38G 16% /tmpfs 940M 72K 940M 1% /dev/shm/dev/sda1 194M 32M 153M 18% /boot/zxx_software/rhel-server-6.4-x86_64-dvd.iso 3.5G 3.5G 0 100% /zxx_software/iso[root@mysql5 zxx_software]#
编辑rhel-source.repo文件[root@mysql5 zxx_software]# cd /etc/yum.repos.d/[root@mysql5 yum.repos.d]# lsrhel-source.repo[root@mysql5 yum.repos.d]# cp rhel-source.repo rhel-source.repo.bk[root@mysql5 yum.repos.d]# lsrhel-source.repo rhel-source.repo.bk[root@mysql5 yum.repos.d]# vi rhel-source.repo[root@mysql5 yum.repos.d]# cat rhel-source.repo[Packages]name=Red Hat Enterprise Linux name随便baseurl=file:///zxx_software/iso #本地iso的挂载路径enabled=1 #可以使用yumgpgcheck=0 #设置不检查gpgkey gpgkey=file:///zxx_software/iso/RPM-GPG-KEY-redhat-release # 配置gpgkey的路径
修改yumRepo.py配置文件cd /usr/lib/python2.6/site-packages/yum/ vi yumRepo.py 找到 remote = url + ‘/’ + relative 改为 remote = "/zxx_software/iso" + '/' + relative
yum install rpm包 测试yum源[root@mysql5 yum.repos.d]# cd /zxx_software/iso/Packages/[root@mysql5 Packages]# rpm -qa | grep gcclibgcc-4.4.7-3.el6.x86_64[root@mysql5 Packages]# ll | grep gcc-r--r--r--. 67 root root 3887160 Aug 17 2010 compat-gcc-34-3.4.6-19.el6.x86_64.rpm-r--r--r--. 67 root root 10498252 Aug 17 2010 compat-gcc-34-c++-3.4.6-19.el6.x86_64.rpm-r--r--r--. 67 root root 2180492 Aug 17 2010 compat-gcc-34-g77-3.4.6-19.el6.x86_64.rpm-r--r--r--. 62 root root 10566776 Dec 5 2012 gcc-4.4.7-3.el6.x86_64.rpm-r--r--r--. 50 root root 4958896 Dec 5 2012 gcc-c++-4.4.7-3.el6.x86_64.rpm-r--r--r--. 56 root root 4950008 Dec 5 2012 gcc-gfortran-4.4.7-3.el6.x86_64.rpm-r--r--r--. 50 root root 9154412 Dec 5 2012 gcc-gnat-4.4.7-3.el6.x86_64.rpm-r--r--r--. 50 root root 3929304 Dec 5 2012 gcc-java-4.4.7-3.el6.x86_64.rpm-r--r--r--. 50 root root 3817592 Dec 5 2012 gcc-objc-4.4.7-3.el6.x86_64.rpm-r--r--r--. 50 root root 4164336 Dec 5 2012 gcc-objc++-4.4.7-3.el6.x86_64.rpm-r--r--r--. 98 root root 114316 Dec 5 2012 libgcc-4.4.7-3.el6.i686.rpm-r--r--r--. 62 root root 102788 Dec 5 2012 libgcc-4.4.7-3.el6.x86_64.rpm[root@mysql5 Packages]# rpm -Uvh gcc-4.4.7-3.el6.x86_64.rpmwarning: gcc-4.4.7-3.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEYerror: Failed dependencies: cloog-ppl >= 0.15 is needed by gcc-4.4.7-3.el6.x86_64 cpp = 4.4.7-3.el6 is needed by gcc-4.4.7-3.el6.x86_64 glibc-devel >= 2.2.90-12 is needed by gcc-4.4.7-3.el6.x86_64可以看到gcc-4.4.7-3.el6.x86_64.rpm关联包很多,安装起来比较麻烦[root@mysql5 Packages]# yum -y install gcc-4.4.7-3.el6.x86_64.rpmLoaded plugins: product-id, refresh-packagekit, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Packages | 3.9 kB 00:00 ...Packages/primary_db | 3.1 MB 00:00 ...Setting up Install ProcessExamining gcc-4.4.7-3.el6.x86_64.rpm: gcc-4.4.7-3.el6.x86_64Marking gcc-4.4.7-3.el6.x86_64.rpm to be installedResolving Dependencies--> Running transaction check