在red hat中安装yum

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lu1171901273/article/details/83417971

1、首先查看redhat 7.0系统本身所安装的那些yum 软件包: 
[root@localhost ~]# rpm -qa | grep yum 

2、卸载原始的yum  在查看
[root@localhost ~]# rpm -qa|grep yum|xargs rpm -e --nodeps
[root@localhost ~]# rpm -qa | grep yum 

3、保证本机电脑能上网; 
[root@localhost ~]# ping www.baidu.com 

4、下载安装包
链接:http://rpm.pbone.net/
不报错版本安装包:
yum-3.4.3-132.el7.centos.0.1.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
yum-updateonboot-1.1.31-34.el7.noarch.rpm
yum-utils-1.1.31-34.el7.noarch.rpm

5、讲下载的安装包上传到linux中

6、执行安装命令
[root@localhost ~]# rpm -ivh yum-*    

7、新建repo 配置文件;
[root@linuxidc ~]# vim /etc/yum.repos.d/CentOS-Base.repo
内容如下

#entOS-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

8、清除缓存:
[root@linuxidc ~]# yum clean all

9、测试安装是否正常;
[root@linuxidc ~]# yum -y install lftp

猜你喜欢

转载自blog.csdn.net/lu1171901273/article/details/83417971