linux centos&Ubuntu&RedHat更換軟件源

linux三大版本更換軟件源

前排提示,有的源可能已經失效,若是發現請留言或自行尋找其餘源。

1.centos

mv /etc/yum.repos.d/CentOS-Base.repo [--path]
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecachenode

2.Ubuntu

備份原有軟件源sudo cp /etc/apt/sources.list <路徑>
sudo vi /etc/apt/sources.list
修改成如下:python

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverselinux

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverseubuntu

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiversecentos

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverseionic

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverseurl

deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiversespa

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverserest

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverseget

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

執行更新源sudo apt update

若是有其餘錯誤,能夠執行 

sudo rm -rf /var/lib/dpkg/info
sudo mkdir /var/lib/dpkg/info

3.RedHat(紅帽)更換yum源。

鑑於紅帽的軟件源須要註冊,能夠更換爲centos的yum。

刪除自帶的yum

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

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm 

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-updateonboot-1.1.30-41.el6.noarch.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-utils-1.1.30-41.el6.noarch.rpm

rpm -Uvh python-urlgrabber-3.9.1-11.el6.noarch.rpm

rpm -ivh yum-*

cd /etc/yum.repos.d/ 

wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo

vi CentOS6-Base-163.repo

:%s/$releasever/6/g

保存退出後

yum clean all

yum makecache

驗證

yum install telnet

相關文章
相關標籤/搜索