1、首先删除redhat原有的yum ,因为redhat 原本的yum 没有注册为redhat用户是用不了的。
<code class="hljs perl has-numbering">rpm -a<span class="hljs-string">q|grep yum|</span>xargs rpm -e --nodeps rpm -a<span class="hljs-string">q|grep python-iniparse|</span>xargs rpm -e --nodeps </code>
2、下载163的yum 安装包
<code class="hljs ruleslanguage has-numbering"><span class="hljs-array"># wget http</span>:<span class="hljs-comment">//mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm</span> <span class="hljs-array"># wget http</span>:<span class="hljs-comment">//mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm </span> <span class="hljs-array"># wget http</span>:<span class="hljs-comment">//mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm </span> <span class="hljs-array"># wget http</span>:<span class="hljs-comment">//mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm </span></code>
3、安装下载的rpm包
<code class="hljs avrasm has-numbering">rpm -ivh *<span class="hljs-preprocessor">.rpm <span style="background-color: rgb(255, 0, 0);"> rpm --import /home/qiaoliguo/下载/RPM-GPG-KEY-CentOS-7</span> </span></code>
注意有其中有两个包要一起安装否则会出现相互依赖,具体可以先一个一个安装,有两个安装失败的就要一起安装了
4、创建文件/etc/yum.repos.d/rhel-debuginfo.repo并写入
<code class="hljs ruby has-numbering">[base] name=<span class="hljs-constant">CentOS</span>-<span class="hljs-variable">$releasever</span> - <span class="hljs-constant">Base</span> baseurl=<span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/mirrors.163.com/centos</span><span class="hljs-regexp">/7.2.1511/os</span><span class="hljs-regexp">/$basearch/</span> gpgcheck=<span class="hljs-number">1</span> gpgkey=<span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/mirrors.163.com/centos</span><span class="hljs-regexp">/7.2.1511/os</span><span class="hljs-regexp">/x86_64/</span><span class="hljs-constant">RPM</span>-<span class="hljs-constant">GPG</span>-<span class="hljs-constant">KEY</span>-<span class="hljs-constant">CentOS</span>-<span class="hljs-number">7</span> <span class="hljs-comment">#released updates</span> [updates] name=<span class="hljs-constant">CentOS</span>-<span class="hljs-variable">$releasever</span> - <span class="hljs-constant">Updates</span> baseurl=<span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/mirrors.163.com/centos</span><span class="hljs-regexp">/7.2.1511/updates</span><span class="hljs-regexp">/$basearch/</span> gpgcheck=<span class="hljs-number">1</span> gpgkey=<span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/mirrors.163.com/centos</span><span class="hljs-regexp">/7.2.1511/os</span><span class="hljs-regexp">/x86_64/</span><span class="hljs-constant">RPM</span>-<span class="hljs-constant">GPG</span>-<span class="hljs-constant">KEY</span>-<span class="hljs-constant">CentOS</span>-<span class="hljs-number">7</span> [extras] name=<span class="hljs-constant">CentOS</span>-<span class="hljs-variable">$releasever</span> - <span class="hljs-constant">Extras</span> baseurl=<span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/mirrors.163.com/centos</span><span class="hljs-regexp">/7.2.1511/extras</span><span class="hljs-regexp">//</span><span class="hljs-variable">$basearch</span>/ gpgcheck=<span class="hljs-number">1</span> gpgkey=<span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/mirrors.163.com/centos</span><span class="hljs-regexp">/7.2.1511/os</span><span class="hljs-regexp">/x86_64/</span><span class="hljs-constant">RPM</span>-<span class="hljs-constant">GPG</span>-<span class="hljs-constant">KEY</span>-<span class="hljs-constant">CentOS</span>-<span class="hljs-number">7</span> [centosplus] name=<span class="hljs-constant">CentOS</span>-<span class="hljs-variable">$releasever</span> - <span class="hljs-constant">Plus</span> baseurl=<span class="hljs-symbol">http:</span>/<span class="hljs-regexp">/mirrors.163.com/centos</span><span class="hljs-regexp">/7.2.1511/centosplus</span><span class="hljs-regexp">//</span><span class="hljs-variable">$basearch</span>/ gpgcheck=<span class="hljs-number">1</span> enabled=<span class="hljs-number">0</span></code>
6、 yum clean all
7、 yum update 测试。
一定要先8后9,否则ntfs-3g 安装失败
8、 安装 epel 源
<code class="hljs vala has-numbering"><span class="hljs-preprocessor"><span style="color:#FF0000;"># yum install epel-release 9、挂在nfts方法 最后安装yum install ntfs-3g</span> </span></code>