首页 > 代码库 > Rethat安装CentOs的yum步骤

Rethat安装CentOs的yum步骤

  首先因为Rethat的yum源要去订阅(当然是需要钱的),所以许多朋友都是以Centos的yum源来代替(Centos是开源的)

安转:

    1:卸载原有Rethat的yum源,

        #rpm -aq|grep yum|xargs rpm -e --nodeps


    2:下载需要的rpm包(Centos的yum安装包)

         #Wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm

           #Wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

           #Wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

          # Wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

(如果Linux上没有wget命令,可以在宿主机上下载好安装包,在传送到Linux中)


     3.安装Centos的yum

       #rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm

         #rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

(前面两个包安装一般是没有问题的,后两个包一起安装)

    

       # rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

         warning: yum-3.2.29-73.el6.centos.noarch.rpm:Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY

         error: Failed dependencies:

               python-urlgrabber >= 3.9.1-10 is needed byyum-3.2.29-73.el6.centos.noarch

         You have new mail in /var/spool/mail/root

赖一个包,于是解决依赖问题)


解决依赖:

     下载依赖包:http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm  

http://mirrors.163.com/centos/6/os/x86_64/Packages/python-2.6.6-64.el6.x86_64.rpm

      安装依赖包:# rpm -ivh python-libs-2.6.6-64.el6.x86_64.rpm python-2.6.6-64.el6.x86_64.rpm --nodeps --force

  warning:python-libs-2.6.6-64.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key IDc105b9de: NOKEY

  Preparing...               ########################################### [100%]

  1:python                ########################################### [ 50%]

  2:python-libs           ########################################### [100%]

(Python与python的库文件安装成功)

        

                               # rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm --nodeps --force

warning:python-urlgrabber-3.9.1-11.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key IDc105b9de: NOKEY

   Preparing...               ########################################### [100%]

  1:python-urlgrabber     ########################################### [100%]

 (python-urlgrabber安装成功,依赖问题解决)


    重新安装后两个包:

              # rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

warning:yum-3.2.29-73.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key IDc105b9de: NOKEY

Preparing...               ########################################### [100%]

  1:yum-plugin-fastestmirro########################################### [50%]

  2:yum                   ########################################### [100%]

(Centos的yum安装成功)


  为创建新的yum源做些准备  

     清空缓存:

              # yum clean all

     创建缓存:

              # yum makecache fast

Loaded plugins: fastestmirror, product-id,subscription-manager

This system is not registered to Red HatSubscription Management. You can use subscription-manager to register.

Metadata Cache Created

 
   下载repo文件:

 (主要看自己想安装哪家公司的yum源,就去哪家公司下载repo文件)

http://mirrors.163.com/.help/CentOS7-Base-163.repo  (网易163的yum源)

http://mirrors.aliyun.com/repo/Centos-6.repo   (阿里的yum源)

(还有许多公司的自己去官方下载Centos版本的)


  进入/etc/yum.repos.d/文件下,把原来的repo文件备份:

   # cd /etc/yum.repos.d/

   # mv rhel-source.repo rhel-source.repo.bak


 把下载来的repo文件移动到/etc/yum/repos.d/文件下:

   # mv Centos-6.repo /etc/yum/repos.d/

 编辑Centos-6.repo文件,把$releasever替换为6(以自己下载的Centos版本定,我这里下载的是Centos-yum6,所以改为6)

    #vi Centos-6.repo

 在vi的末行模式下输入(%s/$releasever/6/g)完成替换

 

     执行# yum makecache

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

base                                                                                                              |3.6 kB     00:00    

extras                                                                                                           | 3.4 kB     00:00    

updates                                                                                                           |3.4 kB     00:00    

updates/filelists_db                                                                                             | 4.4 MB     00:01     

updates/prestodelta                                                                                              | 700 kB     00:00    

updates/primary_db                                                                                               | 7.1 MB     00:01    

updates/other_db                                   (30%) 17%[=======                                 ] 2.9 MB/s |  11 MB     00:17 ETA


安装完成。



测试:

 # yum install vim

Installed:
 vim-enhanced.x86_642:7.4.629-5.el6                                                                                                           
Dependency Installed:
  gpm-libs.x86_64 0:1.20.6-12.el6               perl.x86_64 4:5.10.1-141.el6_7.1                               perl-Module-Pluggable.x86_64 1:3.90-141.el6_7.1   
  perl-Pod-Escapes.x86_64 1:1.04-141.el6_7.1    perl-Pod-Simple.x86_64 1:3.13-141.el6_7.1    perl-libs.x86_64 4:5.10.1-141.el6_7.1             
  perl-version.x86_64 3:0.77-141.el6_7.1        vim-common.x86_64 2:7.4.629-5.el6            vim-filesystem.x86_64 2:7.4.629-5.el6             

Complete!


测试成功。




yum源可以正常使用。



本文出自 “12291546” 博客,谢绝转载!

Rethat安装CentOs的yum步骤