redhat 的更新包只对注册的用户生效,所以我们自己手动更改成CentOS 的更新包,CentOS几乎和redhat是一样的,所以无需担心软件包是否可安装,安装之后是否有问题。
1、首先删除redhat原有的yum ,因为redhat 原本的yum 没有注册为redhat用户是用不了的。
<code class="hljs perl has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">rpm -a<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">q|grep yum|</span>xargs rpm -e --nodeps rpm -a<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">q|grep python-iniparse|</span>xargs rpm -e --nodeps </code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>
2、下载163的yum 安装包
<code class="hljs ruleslanguage has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-array" style="box-sizing: border-box;"># wget http</span>:<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//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" style="box-sizing: border-box;"># wget http</span>:<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm </span> <span class="hljs-array" style="box-sizing: border-box;"># wget http</span>:<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//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" style="box-sizing: border-box;"># wget http</span>:<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm </span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li></ul>
3、安装下载的rpm包
<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">rpm -ivh *<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.rpm</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>
4、创建文件/etc/yum.repos.d/rhel-debuginfo.repo并写入
<code class="hljs ruby has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">[base] name=<span class="hljs-constant" style="box-sizing: border-box;">CentOS</span>-<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$releasever</span> - <span class="hljs-constant" style="box-sizing: border-box;">Base</span> baseurl=<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">http:</span>/<span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/mirrors.163.com/centos</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/7.2.1511/os</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/$basearch/</span> gpgcheck=<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> gpgkey=<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">http:</span>/<span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/mirrors.163.com/centos</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/7.2.1511/os</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/x86_64/</span><span class="hljs-constant" style="box-sizing: border-box;">RPM</span>-<span class="hljs-constant" style="box-sizing: border-box;">GPG</span>-<span class="hljs-constant" style="box-sizing: border-box;">KEY</span>-<span class="hljs-constant" style="box-sizing: border-box;">CentOS</span>-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7</span> <span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">#released updates</span> [updates] name=<span class="hljs-constant" style="box-sizing: border-box;">CentOS</span>-<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$releasever</span> - <span class="hljs-constant" style="box-sizing: border-box;">Updates</span> baseurl=<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">http:</span>/<span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/mirrors.163.com/centos</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/7.2.1511/updates</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/$basearch/</span> gpgcheck=<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> gpgkey=<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">http:</span>/<span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/mirrors.163.com/centos</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/7.2.1511/os</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/x86_64/</span><span class="hljs-constant" style="box-sizing: border-box;">RPM</span>-<span class="hljs-constant" style="box-sizing: border-box;">GPG</span>-<span class="hljs-constant" style="box-sizing: border-box;">KEY</span>-<span class="hljs-constant" style="box-sizing: border-box;">CentOS</span>-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7</span> [extras] name=<span class="hljs-constant" style="box-sizing: border-box;">CentOS</span>-<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$releasever</span> - <span class="hljs-constant" style="box-sizing: border-box;">Extras</span> baseurl=<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">http:</span>/<span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/mirrors.163.com/centos</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/7.2.1511/extras</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">//</span><span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$basearch</span>/ gpgcheck=<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> gpgkey=<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">http:</span>/<span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/mirrors.163.com/centos</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/7.2.1511/os</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/x86_64/</span><span class="hljs-constant" style="box-sizing: border-box;">RPM</span>-<span class="hljs-constant" style="box-sizing: border-box;">GPG</span>-<span class="hljs-constant" style="box-sizing: border-box;">KEY</span>-<span class="hljs-constant" style="box-sizing: border-box;">CentOS</span>-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">7</span> [centosplus] name=<span class="hljs-constant" style="box-sizing: border-box;">CentOS</span>-<span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$releasever</span> - <span class="hljs-constant" style="box-sizing: border-box;">Plus</span> baseurl=<span class="hljs-symbol" style="color: rgb(0, 102, 102); box-sizing: border-box;">http:</span>/<span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/mirrors.163.com/centos</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">/7.2.1511/centosplus</span><span class="hljs-regexp" style="color: rgb(0, 136, 0); box-sizing: border-box;">//</span><span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$basearch</span>/ gpgcheck=<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> enabled=<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li><li style="box-sizing: border-box; padding: 0px 5px;">21</li><li style="box-sizing: border-box; padding: 0px 5px;">22</li><li style="box-sizing: border-box; padding: 0px 5px;">23</li><li style="box-sizing: border-box; padding: 0px 5px;">24</li><li style="box-sizing: border-box; padding: 0px 5px;">25</li><li style="box-sizing: border-box; padding: 0px 5px;">26</li></ul>
6、 yum clean all
7、 yum update 测试。
8、 安装 epel 源
<code class="hljs vala has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: 'Source Code Pro', monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;"><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;"># yum install epel-release</span></code>