redhat沒法註冊RHN的解決辦法

1.問題

初學Linux,採用邊實戰nginx邊學Linux命令的方式,這樣學習的還快還真實一些.固然,問題來的很快.我使用的是redhat,安裝pcre就出現了問題,以下:php

 1 [root@localhost ~]# yum install pcre
 2 Loading "security" plugin
 3 Loading "installonlyn" plugin
 4 Loading "rhnplugin" plugin
 5 This system is not registered with RHN.
 6 RHN support will be disabled.
 7 Setting up Install Process
 8 Setting up repositories
 9 No Repositories Available to Set Up
10 Reading repository metadata in from local files
11 Parsing package install arguments
12 Setting up repositories
13 No Repositories Available to Set Up
14 Reading repository metadata in from local files
15 No Match for argument: pcre
16 Nothing to do

 從5-6行的描述來看,系統尚未註冊RHN.網上查了一下整理到這裏,固然你通過本人測試過的.大體過程是從新安裝CentOS的yum,卸載Redhat的.好吧,繼續node

2.解決問題過程

1)查看redhat版本.python

不一樣的redhat版本安裝的yum不一樣,因此在這裏須要先知道linux的版本.使用命令linux

1 cat /etc/issue

個人Linux版本爲:nginx

1 Red Hat Enterprise Linux Server release 5.1 (Tikanga)
2 Kernel \r on an \m

2)卸載yum.centos

1 rpm -qa|grep yum|xargs rpm -e --nodeps

執行後等待,後不會有任何提示,不過能夠使用命令緩存

1 rpm -qa|grep yum

在卸載先後查看一下yum就能夠對比得出,卸載是否有效.app

3)安裝yum.ide

http://mirrors.ustc.edu.cn/centos/(網址可能會發生變化,請網上找最新的版本)找到對應版本的RPM包,進入http://mirrors.ustc.edu.cn/centos/5.1/readme,內容是:學習

1 This directory (and version of CentOS) is depreciated.  For normal users,
2 you should use /5/ and not /5.1/ in your path. Please see this FAQ
3 concerning the CentOS release scheme:
4 
5 http://www.centos.org/modules/smartfaq/faq.php?faqid=34
6 
7 If you know what you are doing, and absolutely want to remain at the 5.1
8 level, go to http://vault.centos.org/ for packages.

大體的意思是使用centos5的版本便可.根據32位仍是64位執行不一樣的命令下載便可.

CentOS5
32位版的:
wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/python-iniparse-0.2.3-6.el5.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-4.el5.i386.rpm
wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
64位版的:
wget http://mirrors.ustc.edu.cn/centos/5/os/x86_64/CentOS/python-iniparse-0.2.3-6.el5.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm

下載完成,執行結果以下:

 1 [root@localhost ~]# wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/python-iniparse-0.2.3-6.el5.noarch.rpm
 2 wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
 3 wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-4.el5.i386.rpm
 4 wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm--23:31:13--  http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/python-iniparse-0.2.3-6.el5.noarch.rpm
 5 Resolving mirrors.ustc.edu.cn... 202.141.160.110, 2001:da8:d800:95::110
 6 Connecting to mirrors.ustc.edu.cn|202.141.160.110|:80... connected.
 7 HTTP request sent, awaiting response... 200 OK
 8 Length: 34330 (34K) [application/x-redhat-package-manager]
 9 Saving to: `python-iniparse-0.2.3-6.el5.noarch.rpm'
10 
11 100%[==========================================================================>] 34,330       222K/s   in 0.2s   
12 
13 23:31:13 (222 KB/s) - `python-iniparse-0.2.3-6.el5.noarch.rpm' saved [34330/34330]
14 
15 [root@localhost ~]# wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
16 --23:31:13--  http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
17 Resolving mirrors.ustc.edu.cn... 202.141.160.110, 2001:da8:d800:95::110
18 Connecting to mirrors.ustc.edu.cn|202.141.160.110|:80... connected.
19 HTTP request sent, awaiting response... 200 OK
20 Length: 1034960 (1011K) [application/x-redhat-package-manager]
21 Saving to: `yum-3.2.22-40.el5.centos.noarch.rpm'
22 
23 100%[==========================================================================>] 1,034,960    410K/s   in 2.5s   
24 
25 23:31:16 (410 KB/s) - `yum-3.2.22-40.el5.centos.noarch.rpm' saved [1034960/1034960]
26 
27 [root@localhost ~]# wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-4.el5.i386.rpm
28 --23:31:16--  http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-4.el5.i386.rpm
29 Resolving mirrors.ustc.edu.cn... 202.141.160.110, 2001:da8:d800:95::110
30 Connecting to mirrors.ustc.edu.cn|202.141.160.110|:80... connected.
31 HTTP request sent, awaiting response... 200 OK
32 Length: 26164 (26K) [application/x-redhat-package-manager]
33 Saving to: `yum-metadata-parser-1.1.2-4.el5.i386.rpm'
34 
35 100%[==========================================================================>] 26,164       125K/s   in 0.2s   
36 
37 23:31:16 (125 KB/s) - `yum-metadata-parser-1.1.2-4.el5.i386.rpm' saved [26164/26164]
38 
39 [root@localhost ~]# wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm--23:31:25--  http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
40 Resolving mirrors.ustc.edu.cn... 202.141.160.110, 2001:da8:d800:95::110
41 Connecting to mirrors.ustc.edu.cn|202.141.160.110|:80... connected.
42 HTTP request sent, awaiting response... 200 OK
43 Length: 21033 (21K) [application/x-redhat-package-manager]
44 Saving to: `yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm'
45 
46 100%[===========================================================================================>] 21,033      --.-K/s   in 0.1s   
47 
48 23:31:26 (183 KB/s) - `yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm' saved [21033/21033]
View Code

安裝順序以下:

1 rpm -ivh python-iniparse-0.2.3-6.el5.noarch.rpm 
2 rpm -ivh yum-metadata-parser-1.1.2-4.el5.i386.rpm 
3 rpm -ivh yum-3.2.22-40.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm

 執行結果以下:

 1 [root@localhost ~]# rpm -ivh python-iniparse-0.2.3-6.el5.noarch.rpm 
 2 warning: python-iniparse-0.2.3-6.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
 3 Preparing...                ########################################### [100%]
 4    1:python-iniparse        ########################################### [100%]
 5 [root@localhost ~]# rpm -ivh yum-metadata-parser-1.1.2-4.el5.i386.rpm 
 6 warning: yum-metadata-parser-1.1.2-4.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
 7 Preparing...                ########################################### [100%]
 8    1:yum-metadata-parser    ########################################### [100%]
 9 [root@localhost ~]# rpm -ivh yum-3.2.22-40.el5.centos.noarch.rpm yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
10 warning: yum-3.2.22-40.el5.centos.noarch.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
11 Preparing...                ########################################### [100%]
12    1:yum-fastestmirror      ########################################### [ 50%]
13    2:yum                    ########################################### [100%]
View Code

4)下載yum配置源.

1 mv rhel-debuginfo.repo rhel-debuginfo.repo.bak
2 cd /etc/yum.repos.d
3 wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo

5)生成緩存.

執行命令:

1 yum makecache

執行結果:

 1 Loaded plugins: fastestmirror
 2 Loading mirror speeds from cached hostfile
 3 addons                    100% |=========================| 1.9 kB    00:00     
 4 addons/filelists_db       100% |=========================|  574 B    00:00     
 5 addons/other_db           100% |=========================|  550 B    00:00     
 6 addons/primary_db         100% |=========================| 1.1 kB    00:00     
 7 base                      100% |=========================| 1.1 kB    00:00     
 8 base/filelists            100% |=========================| 3.1 MB    00:06     
 9 base/other                100% |=========================|  11 MB    00:32     
10 base/group                100% |=========================| 1.1 MB    00:07     
11 base/primary              100% |=========================| 995 kB    00:02     
12 extras                    100% |=========================| 2.1 kB    00:00     
13 extras/filelists_db       100% |=========================| 211 kB    00:01     
14 extras/other_db           100% |=========================| 431 kB    00:01     
15 extras/group              100% |=========================| 9.7 kB    00:00     
16 extras/primary_db         100% |=========================| 164 kB    00:00     
17 update                    100% |=========================| 1.9 kB    00:00     
18 update/filelists_db       100% |=========================| 858 kB    00:02     
19 update/other_db           100% |=========================| 4.7 MB    00:26     
20 update/primary_db         100% |=========================| 173 kB    00:02     
21 base                                                                  2789/2789
22 base                                                                  2789/2789
23 base                                                                  2789/2789
24 Metadata Cache Created
View Code

完成.

相關文章
相關標籤/搜索