Home Linux Server Fix the error: YumRepo Error All mirror URLs are not using ftp http[s] or file

Fix the error: YumRepo Error All mirror URLs are not using ftp http[s] or file

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

Currently, quite a few servers using CentOS 6 get the error “YumRepo Error All mirror URLs are not using ftp http[s] or file” when using the yum command to update software and install packages.

And in this article, AZDIGI will explain the cause and how to handle this problem for you.

I. Cause

The CentOS 6 operating system was discontinued on November 30, 2020. And most of the default CentOS 6 repositories have been deprecated. Below is a list of PHP versions that have been released and when they are supported.

image 6

And the yum command is still trying to connect to repositories that are no longer in use. And when your CentOS 6 server is still connecting to the defunct server, you will get an error like this:

AZDIGI Tutorial
YumRepo Error All mirror URLs are not using ftp http[s] or file.
    

Practical examples

how to fix error YumRepo Error: All mirror URLs are not using ftp http[s] or file
Error “YumRepo Error All mirror URLs are not using ftp http[s] or file.”

So, we will need to update the URL of the default repository to the vault repository. Please continue reading this guide for further instructions.

II. Fix “YumRepo Error All mirror URLs are not using ftp http[s] or file” error

To fix the “YumRepo Error All mirror URLs are not using ftp http[s] or file” error, we need to follow the two steps below.

Step 1: SSH into your server

To fix the “YumRepo Error All mirror URLs are not using ftp http[s] or file” error, we first need to SSH or login to your VPS/server as root. Or at least log in to the server with a user with sudo privileges. If you don’t know how to SSH into your VPS/Server, you can refer to the following tutorial:

After successfully SSH, we proceed to step 2 to update the mirrorlist‘s.

Step 2: Update mirrorlist’s to the vault repository

First, for safety, we should back up the file containing the current mirrorlist's with the following command:

AZDIGI Tutorial
cp -pr /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.OLD
    

Then we empty the file containing the mirrorlist's with the following command:

AZDIGI Tutorial
echo > /etc/yum.repos.d/CentOS-Base.repo
    

We continue to use the following command to edit the mirrorlist's file:

AZDIGI Tutorial
vi /etc/yum.repos.d/CentOS-Base.repo
    

Here, you should select i to enter the edit mode, then paste the following content and finally save it:

AZDIGI Tutorial
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=http://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=http://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=http://vault.centos.org/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib&infra=$infra
baseurl=http://vault.centos.org/6.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
    

Then we just need to clear the yum cache with the following command:

AZDIGI Tutorial
yum clean all
    

Now you can use the yum command to update your system or install new software.

III. Summary

So with just two simple steps, you can fix the “YumRepo Error All mirror URLs are not using ftp http[s] or file.” error on your server. And because CentOS 6 has been discontinued, you should consider migrating your infrastructure to a higher version of CentOS such as CentOS 7 (supported until 2024), which would be a better solution.

In another article, AZDIGI will guide you on how to upgrade from CentOS6 to CentOS 7 for you to refer to and apply.

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign