Centos | Ubuntu更改为腾讯、阿里云的源
技术积累 Linux Yum ubuntu

更换Centos源为腾讯源

1、进入到/etc/yum.repos.d/目录下,备份之前的CentOS-Base.repo地址。

cd /etc/yum.repos.d/
mv CentOS-Base.repo CentOS-Base.repo.bak

2、下载腾讯yum源,对应系统版本

#centos5:
wget  http://mirrors.cloud.tencent.com/repo/centos5_base.repo -O CentOS-Base.repo

#centos6:
wget  http://mirrors.cloud.tencent.com/repo/centos6_base.repo -O CentOS-Base.repo

#centos7:
wget  http://mirrors.cloud.tencent.com/repo/centos7_base.repo -O CentOS-Base.repo

#centot8:
wget  http://mirrors.cloud.tencent.com/repo/centos8_base.repo -O CentOS-Base.repo

添加EPEL源

#centot5:
wget  http://mirrors.cloud.tencent.com/repo/epel-5.repo -O CentOS-epel.repo

#centot5:
wget  http://mirrors.cloud.tencent.com/repo/epel-6.repo -O CentOS-epel.repo

#centot7:
wget  http://mirrors.cloud.tencent.com/repo/epel-7.repo -O CentOS-epel.repo

添加替换后,更新缓存

yum clean all
yum makecache

更换Ubuntu源为阿里云源

1、首先备份本地的源

cp /etc/apt/sources.list /etc/apt/sources.list.bak

#修改文件 删除原有内容,添加下面内容
/etc/apt/sources.list

Ubuntu 14.04.5 LTS版本

deb https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
## Not recommended
# deb https://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse

Ubuntu 16.04 LTS LTS版本

deb https://mirrors.aliyun.com/ubuntu/ xenial main
deb-src https://mirrors.aliyun.com/ubuntu/ xenial main
deb https://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb https://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src https://mirrors.aliyun.com/ubuntu/ xenial universe
deb https://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb https://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security main
deb https://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src https://mirrors.aliyun.com/ubuntu/ xenial-security universe

Ubuntu 18.04 LTS (bionic)版本

deb https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
# deb https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

Ubuntu 20.04 LTS (focal)版本

deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
# deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

2、更新

apt-get update

# 修复依赖关系
apt-get -f install

apt-get upgrade

清理软件包缓存

# 清理旧版本的软件缓存
apt-get autoclean

# 清理所有软件缓存
apt-get clean

# 删除系统不再使用的孤立软件
apt-get autoremove

本文最后记录时间 2023-04-02
文章链接地址:
https://me.jinchuang.org/archives/37.html
本站文章除注明[转载|引用|来源],均为本站原创内容,转载前请注明出处
Zabbix7.0 使用默认模板监控Mysql
Ubuntu ssh登录提示信息修改
关于网站搬家后,评论邮件通知发送失败报错的问题(openssl的问题)
ubuntu 默认的dash 切换为 bash

Windows cmd下面使用ssh命令

LINUX下为LVM磁盘增加根分区空间

留言

顶部