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

相关文章
相关标签/搜索