解决Redhat Linux5 yum出现This system is not registered with RHN的方案
1 check what yum package installed
查看RHEL是否安装了yum,若是安装了,那么又有哪些yum包:
[root@localhost ~]# rpm -qa |grep yum
yum-metadata-parser-1.0-8.fc6
yum-3.0.1-5.el5
yum-rhn-plugin-0.4.3-1.el5
yum-updatesd-3.0.1-5.el5
2 remove all installed yum packages
卸载上面显示的所有yum包:
[root@localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps(不检查依赖,直接删除rpm包)
再用
[root@localhost ~]# rpm -qa |grep yum查看,无信息显示表示已经卸载完成。
3 download the centos packages from website
下载 CentOS YUM包,首先我们需要找到CentOS YUM的更新源,推荐的有(前三个适用于Redhat Linux5版本,最后一个适用于RHEL6的64位版本,当然不管是RHEL5还是RHEL6等等都可以从下面四个镜像网站中下载):
1.国外镜像源http://ftp.heanet.ie/pub/centos/5/os/i386/CentOS/
2.中国科技大学http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/
3.网易开源镜像http://mirrors.163.com/centos/5/os/i386/CentOS/
4.搜狐开源镜像http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/
接着我们就需要在终端里面输入以下命令进行下载(以博主的RHEL5.3为例,从中国科大下载镜像,下载的目录如果没设置的话就会默认是[root@localhost ~]# pwd显示的路径)
[root@localhost ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-
fastestmirror-1.1.16-21.el5.centos.noarch.rpm
[root@localhost ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-
metadata-parser-1.1.2-4.el5.i386.rpm
[root@localhost ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-
3.2.22-40.el5.centos.noarch.rpm
[root@localhost ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/
python-iniparse-0.2.3-6.el5.noarch.rpm
4 安装这所下载的四个包
注意:单个的安装包可能会依赖其它包(例如yum和yum-fastestmirror会相互依赖),所以我们可以把所有这些包放在一起,用一行命令将它们同时安装即可:
[root@localhost ~]# rpm -ivh yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
yum-metadata-parser-1.1.2-4.el5.i386.rpm
yum-3.2.22-40.el5.centos.noarch.rpm
yum-3.2.22-40.el5.centos.noarch.rpm
//或者
[root@localhost ~]# rpm –ivh yum-*
5 download configure file
下载CentOS-Base.repo到/etc/yum.repos.d/文件夹里:
[root@localhost ~]# wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
-O /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# wget http://huangkeye-blog.googlecode.com/files/CentOS-Base.repo
-O /etc/yum.repos.d/CentOS-Base.repo(以上这两个适用于RHEL版本5)
[root@localhost ~]# wget http://my-project-huangkeye.googlecode.com/files/CentOS-Base.repo
-O /etc/yum.repos.d/CentOS-Base.repo(这个适用于RHEL版本6)
也可以直接进入vim修改该文件为以下内容:
[base]
name=CentOS-5 - Base
baseurl=http://centos.ustc.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#released updates
[update]
name=CentOS-5 - Updates
baseurl=http://centos.ustc.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-5 - Addons
baseurl=http://centos.ustc.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-5 - Extras
baseurl=http://centos.ustc.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
baseurl=http://centos.ustc.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
baseurl=http://centos.ustc.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#packages in testing
[testing]
name=CentOS-5 - Testing
baseurl=http://centos.ustc.edu.cn/centos/5/testing/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
6 [选做]clear cache and rebuild
需要清除和重建cache:
[root@localhost ~]# yum clean metadata
[root@localhost ~]# yum clean dbcache
[root@localhost ~]# yum makecache
7 installation has been completed, testing
//安装成功,开始测试:
[root@localhost ~]# yum update
8 Yum百科 :
RHEL安装软件包管理器Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE、CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。
///
起步 - 安装 Git
安装 Git
是时候动手尝试下 Git 了,不过得先安装好它。有许多种安装方式,主要分为两种,一种是通过编译源代码来安装;另一种是使用为特定平台预编译好的安装包。
从源代码安装
若是条件允许,从源代码安装有很多好处,至少可以安装最新的版本。Git 的每个版本都在不断尝试改进用户体验,所以能通过源代码自己编译安装最新版本就再好不过了。有些 Linux 版本自带的安装包更新起来并不及时,所以除非你在用最新的 distro 或者 backports,那么从源代码安装其实该算是最佳选择。
Git 的工作需要调用 curl,zlib,openssl,expat,libiconv 等库的代码,所以需要先安装这些依赖工具。在有 yum 的系统上(比如 Fedora)或者有 apt-get 的系统上(比如 Debian 体系),可以用下面的命令安装:
$ yum install curl-devel expat-devel gettext-devel \
openssl-devel zlib-devel
$ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext \
libz-dev libssl-dev
之后,从下面的 Git 官方站点下载最新版本源代码:
http://git-scm.com/download
然后编译并安装:
$ tar -zxf git-1.7.2.2.tar.gz
$ cd git-1.7.2.2
$ make prefix=/usr/local all
$ sudo make prefix=/usr/local install
现在已经可以用 git 命令了,用 git 把 Git 项目仓库克隆到本地,以便日后随时更新:
$ git clone git://git.kernel.org/pub/scm/git/git.git
1 check what yum package installed
查看RHEL是否安装了yum,若是安装了,那么又有哪些yum包:
[root@localhost ~]# rpm -qa |grep yum
yum-metadata-parser-1.0-8.fc6
yum-3.0.1-5.el5
yum-rhn-plugin-0.4.3-1.el5
yum-updatesd-3.0.1-5.el5
2 remove all installed yum packages
卸载上面显示的所有yum包:
[root@localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps(不检查依赖,直接删除rpm包)
再用
[root@localhost ~]# rpm -qa |grep yum查看,无信息显示表示已经卸载完成。
3 download the centos packages from website
下载 CentOS YUM包,首先我们需要找到CentOS YUM的更新源,推荐的有(前三个适用于Redhat Linux5版本,最后一个适用于RHEL6的64位版本,当然不管是RHEL5还是RHEL6等等都可以从下面四个镜像网站中下载):
1.国外镜像源http://ftp.heanet.ie/pub/centos/5/os/i386/CentOS/
2.中国科技大学http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/
3.网易开源镜像http://mirrors.163.com/centos/5/os/i386/CentOS/
4.搜狐开源镜像http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/
接着我们就需要在终端里面输入以下命令进行下载(以博主的RHEL5.3为例,从中国科大下载镜像,下载的目录如果没设置的话就会默认是[root@localhost ~]# pwd显示的路径)
[root@localhost ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-
fastestmirror-1.1.16-21.el5.centos.noarch.rpm
[root@localhost ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-
metadata-parser-1.1.2-4.el5.i386.rpm
[root@localhost ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/yum-
3.2.22-40.el5.centos.noarch.rpm
[root@localhost ~]# wget http://centos.ustc.edu.cn/centos/5/os/i386/CentOS/
python-iniparse-0.2.3-6.el5.noarch.rpm
4 安装这所下载的四个包
注意:单个的安装包可能会依赖其它包(例如yum和yum-fastestmirror会相互依赖),所以我们可以把所有这些包放在一起,用一行命令将它们同时安装即可:
[root@localhost ~]# rpm -ivh yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
yum-metadata-parser-1.1.2-4.el5.i386.rpm
yum-3.2.22-40.el5.centos.noarch.rpm
yum-3.2.22-40.el5.centos.noarch.rpm
//或者
[root@localhost ~]# rpm –ivh yum-*
5 download configure file
下载CentOS-Base.repo到/etc/yum.repos.d/文件夹里:
[root@localhost ~]# wget http://docs.linuxtone.org/soft/lemp/CentOS-Base.repo
-O /etc/yum.repos.d/CentOS-Base.repo
[root@localhost ~]# wget http://huangkeye-blog.googlecode.com/files/CentOS-Base.repo
-O /etc/yum.repos.d/CentOS-Base.repo(以上这两个适用于RHEL版本5)
[root@localhost ~]# wget http://my-project-huangkeye.googlecode.com/files/CentOS-Base.repo
-O /etc/yum.repos.d/CentOS-Base.repo(这个适用于RHEL版本6)
也可以直接进入vim修改该文件为以下内容:
[base]
name=CentOS-5 - Base
baseurl=http://centos.ustc.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#released updates
[update]
name=CentOS-5 - Updates
baseurl=http://centos.ustc.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-5 - Addons
baseurl=http://centos.ustc.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-5 - Extras
baseurl=http://centos.ustc.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
baseurl=http://centos.ustc.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
baseurl=http://centos.ustc.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#packages in testing
[testing]
name=CentOS-5 - Testing
baseurl=http://centos.ustc.edu.cn/centos/5/testing/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
6 [选做]clear cache and rebuild
需要清除和重建cache:
[root@localhost ~]# yum clean metadata
[root@localhost ~]# yum clean dbcache
[root@localhost ~]# yum makecache
7 installation has been completed, testing
//安装成功,开始测试:
[root@localhost ~]# yum update
8 Yum百科 :
RHEL安装软件包管理器Yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE、CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。
///
起步 - 安装 Git
安装 Git
是时候动手尝试下 Git 了,不过得先安装好它。有许多种安装方式,主要分为两种,一种是通过编译源代码来安装;另一种是使用为特定平台预编译好的安装包。
从源代码安装
若是条件允许,从源代码安装有很多好处,至少可以安装最新的版本。Git 的每个版本都在不断尝试改进用户体验,所以能通过源代码自己编译安装最新版本就再好不过了。有些 Linux 版本自带的安装包更新起来并不及时,所以除非你在用最新的 distro 或者 backports,那么从源代码安装其实该算是最佳选择。
Git 的工作需要调用 curl,zlib,openssl,expat,libiconv 等库的代码,所以需要先安装这些依赖工具。在有 yum 的系统上(比如 Fedora)或者有 apt-get 的系统上(比如 Debian 体系),可以用下面的命令安装:
$ yum install curl-devel expat-devel gettext-devel \
openssl-devel zlib-devel
$ apt-get install libcurl4-gnutls-dev libexpat1-dev gettext \
libz-dev libssl-dev
之后,从下面的 Git 官方站点下载最新版本源代码:
http://git-scm.com/download
然后编译并安装:
$ tar -zxf git-1.7.2.2.tar.gz
$ cd git-1.7.2.2
$ make prefix=/usr/local all
$ sudo make prefix=/usr/local install
现在已经可以用 git 命令了,用 git 把 Git 项目仓库克隆到本地,以便日后随时更新:
$ git clone git://git.kernel.org/pub/scm/git/git.git