Resolving YUM Installation Failures for lrzsz Package
When executing yum install -y lrzsz, you may encounter an error indicating a failure to connect to the repository mirrror. The output typically encludes:
[root@centos ~]# yum install -y lrzsz
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#7 - "Failed to connect to 2600:1f16:c1:5e01:4180:6610:5482:c1c0: Network is unreachable"
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail.
This error occurs because the default YUM repositories are often hosted internationally, leading to connectivity issues. To resolve this, you can switch to a local mirror, such as one provided by Alibaba Cloud in China, wich improves reliability.
Step 1: Backup the existing repository configuraton
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
Step 2: Download the appropriate CentOS-Base.repo file
Select the command based on your CentOS version:
-
For CentOS 5:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repoor
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo -
For CentOS 6:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repoor
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo -
For CentOS 7:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repoor
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
Step 3: Add the EPEL repository
-
For CentOS 6:
wget -O /etc/yum.repos.d/epel-6.repo http://mirrors.aliyun.com/repo/epel-6.repo -
To CentOS 7:
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
Step 4: Clear the YUM cache and regenerate it
yum clean all
yum makecache
After completing these steps, retry the installation command:
yum install -y lrzsz
This should resolve the connectivity issue and allow the package to install successfully.