Skip to content

CentOS 7配置yum源

rm -f /etc/yum.repos.d/*
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
yum clean all && yum makecache

关于-bash: yum-config-manager: 未找到命令

-bash: yum-config-manager: 未找到命令

一般是初始化系统
没有安装yum-utils

解决方式:
# yum install yum-utils


安装完成之后可以通过
# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

罕见命令

// yum -y install nfs-utils rpcbind执行一半的时候取消再次执行后异常
# yum -y install nfs-utils rpcbind
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
--> Running transaction check
---> Package nfs-utils.x86_64 1:1.3.0-0.65.el7 will be updated
---> Package nfs-utils.x86_64 1:1.3.0-0.68.el7.2 will be an update
---> Package rpcbind.x86_64 0:0.2.0-47.el7 will be updated
---> Package rpcbind.x86_64 0:0.2.0-49.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================
 Package                                     Arch                                     Version                                                Repository                                 Size
=============================================================================================================================================================================================
Updating:
 nfs-utils                                   x86_64                                   1:1.3.0-0.68.el7.2                                     updates                                   413 k
 rpcbind                                     x86_64                                   0.2.0-49.el7                                           base                                       60 k

Transaction Summary
=============================================================================================================================================================================================
Upgrade  2 Packages

Total size: 473 k
Downloading packages:
Running transaction check
Running transaction test


Transaction check error:
  package rpcbind-0.2.0-49.el7.x86_64 is already installed

Error Summary
-------------

# yum-complete-transaction --cleanup-only
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Cleaning up unfinished transaction journals
Cleaning up 2023-10-26.14:27.22
# yum history redo last
Loaded plugins: fastestmirror, langpacks
Repeating transaction 50, from Thu Oct 26 14:27:22 2023
 ** Updated nfs-utils-1:1.3.0-0.65.el7.x86_64   @base
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
 ** Update            1:1.3.0-0.68.el7.2.x86_64 @?updates
 ** Updated rpcbind-0.2.0-47.el7.x86_64         @anaconda
 ** Update          0.2.0-49.el7.x86_64         installed
Failed to upgrade: rpcbind-0.2.0-49.el7.x86_64
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils.x86_64 1:1.3.0-0.65.el7 will be updated
---> Package nfs-utils.x86_64 1:1.3.0-0.68.el7.2 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================
 Package                                     Arch                                     Version                                                Repository                                 Size
=============================================================================================================================================================================================
Updating:
 nfs-utils                                   x86_64                                   1:1.3.0-0.68.el7.2                                     updates                                   413 k

Transaction Summary
=============================================================================================================================================================================================
Upgrade  1 Package

Total size: 413 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 1 pre-existing rpmdb problem(s), 'yum check' output follows:
rpcbind-0.2.0-49.el7.x86_64 is a duplicate with rpcbind-0.2.0-47.el7.x86_64
  Updating   : 1:nfs-utils-1.3.0-0.68.el7.2.x86_64                                                                                                                                       1/2 
  Cleanup    : 1:nfs-utils-1.3.0-0.65.el7.x86_64                                                                                                                                         2/2 
  Verifying  : 1:nfs-utils-1.3.0-0.68.el7.2.x86_64                                                                                                                                       1/2 
  Verifying  : 1:nfs-utils-1.3.0-0.65.el7.x86_64                                                                                                                                         2/2 

Updated:
  nfs-utils.x86_64 1:1.3.0-0.68.el7.2                                                                                                                                                        

Complete!