[关闭]
@breakerthb 2016-11-28T02:34:08.000000Z 字数 2365 阅读 1373

Redhat 7使用CentOS 7 yum

Linux


查看系统版本

$ cat /proc/version
	$ cat /etc/redhat-release 

写在RedHat yum文件

redhat 原本的yum 没有注册为redhat用户是用不了的。

$ rpm -aq | grep yum | xargs rpm -e --nodeps 

下载新的rpm文件

下载目录:http://mirrors.163.com/centos/7/os/x86_64/Packages/

下载下面6个文件:

注意找到对应版本。

安装rpm包

rpm -ivh yum-*

repo文件

下载:http://mirrors.163.com/.help/CentOS7-Base-163.repo

保存位置:

/etc/yum.repos.d/CentOS7-Base-163.repo

修改$releasever为centos版本,这里改为7

# 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
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
    #mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-7 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/7/updates/$basearch/
	#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-7 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/7/extras/$basearch/
	#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/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/
	#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-7 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/7/contrib/$basearch/
	#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

清除缓存

$ yum clean all

获取yum列表

$ yum makecache

更新

$ yum update
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注