redhat7.2配置yum源

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>
redhat 7.2 可用的yum源, 亲自测试可以使用 ,使用过程: 1.卸载已经存在的yum: rpm -qa | grep yum | xargs rpm -e --nodeps 2.将yum 文件放到server中 3.执行rpm -ivh yum-* 4.创建repo文件: #CentOS-Base.repo # # The mirror system uses the connecting IP address of the client and the # update status of each mirror to pick mirrors that are updated to and # geographically close to the client. You should use this for CentOS updates # unless you are manually picking other mirrors. # # If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead. # # [base] name=CentOS-$7 - Base - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=os baseurl=http://mirrors.163.com/centos/7/os/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates] name=CentOS-$7 - Updates - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=updates baseurl=http://mirrors.163.com/centos/7/updates/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras] name=CentOS-$7 - Extras - 163.com #mirrorlist=http://mirrorlist.centos.org/?release=$7&arch;=$basearch&repo=extras baseurl=http://mirrors.163.com/centos/7/extras/$basearch/ gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-$7 - Plus - 163.com baseurl=http://mirrors.163.com/centos/7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7 5.测试是否安装成功 yum -y install tree
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值