Linux下常用镜像源及配置方法

长风化羽 2022-10-19

1306 0

1.镜像源配置

一般情况下,修改/etc/apt/sources.list文件,将默认源地址改成新的地址即可。

可以用leafpad打开,在终端中键入:

leafpad /etc/apt/sources.list

刀云网另,比如要将 http://deb.debian.org 改成 https://mirrors.xxx.com

在Linux中可使用以下命令:

sed-i "[email protected]://[email protected]://[email protected]"/etc/apt/sources.list

若要使用https源,则需要执行

apt-get install apt-transport-https

再执行

apt-get update

以更新索引

2.常用镜像站

Debian 9 Stretch镜像源

163镜像站

deb mirrors.163.com/debian/ stretch main non-free contrib
deb mirrors.163.com/debian/ stretch-updates main non-free contrib
deb mirrors.163.com/debian/ stretch-backports main non-free contrib
deb-src mirrors.163.com/debian/ stretch main non-free contrib
deb-src mirrors.163.com/debian/ stretch-updates main non-free contrib
deb-src mirrors.163.com/debian/ stretch-backports main non-free contrib
deb mirrors.163.com/debian- stretch/updates main non-free contrib
deb-src mirrors.163.com/debian- stretch/updates main non-free contrib

中科大镜像站

deb mirrors.ustc.edu.cn/deb stretch main contrib non-free
deb-src mirrors.ustc.edu.cn/deb stretch main contrib non-free
deb mirrors.ustc.edu.cn/deb stretch-updates main contrib non-free
deb-src mirrors.ustc.edu.cn/deb stretch-updates main contrib non-free
deb mirrors.ustc.edu.cn/deb stretch-backports main contrib non-free
deb-src mirrors.ustc.edu.cn/deb stretch-backports main contrib non-free
deb mirrors.ustc.edu.cn/deb stretch/updates main contrib non-free
deb-src mirrors.ustc.edu.cn/deb stretch/updates main contrib non-free

阿里云镜像站

deb mirrors.aliyun.com/debi stretch main non-free contrib
deb-src mirrors.aliyun.com/debi stretch main non-free contrib
deb mirrors.aliyun.com/debi stretch/updates main
deb-src mirrors.aliyun.com/debi stretch/updates main
deb mirrors.aliyun.com/debi stretch-updates main non-free contrib
deb-src mirrors.aliyun.com/debi stretch-updates main non-free contrib
deb mirrors.aliyun.com/debi stretch-backports main non-free contrib
deb-src mirrors.aliyun.com/debi stretch-backports main non-free contrib

华为镜像站

deb https://mirrors.huaweicloud.com/debian/ stretch main contrib non-free 
deb-src https://mirrors.huaweicloud.com/debian/ stretch main contrib non-free 
deb https://mirrors.huaweicloud.com/debian/ stretch-updates main contrib non-free 
deb-src https://mirrors.huaweicloud.com/debian/ stretch-updates main contrib non-free 
deb https://mirrors.huaweicloud.com/debian/ stretch-backports main contrib non-free 
deb-src https://mirrors.huaweicloud.com/debian/ stretch-backports main contrib non-free

清华大学镜像站

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main contrib non-free 
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch main contrib non-free 
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main contrib non-free 
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-updates main contrib non-free 
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main contrib non-free 
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ stretch-backports main contrib non-free 
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ stretch/updates main contrib non-free 
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ stretch/updates main contrib non-free

上海交大镜像站

deb https://mirror.sjtu.edu.cn/debian/ stretch main contrib non-free 
deb-src https://mirror.sjtu.edu.cn/debian/ stretch main contrib non-free 
deb https://mirror.sjtu.edu.cn/debian/ stretch-updates main contrib non-free 
deb-src https://mirror.sjtu.edu.cn/debian/ stretch-updates main contrib non-free 
deb https://mirror.sjtu.edu.cn/debian/ stretch-backports main contrib non-free 
deb-src https://mirror.sjtu.edu.cn/debian/ stretch-backports main contrib non-free 
deb https://mirror.sjtu.edu.cn/debian-security/ stretch/updates main contrib non-free 
deb-src https://mirror.sjtu.edu.cn/debian-security/ stretch/updates main contrib non-free

Debian9 stretch 系统自带官方源

deb http://deb.debian.org/debian stretch main
deb-src http://deb.debian.org/debian stretch main
deb http://deb.debian.org/debian-security stretch/updates main
deb-src http://deb.debian.org/debian-security stretch/updates main

deb http://ftp.debian.org/debian stretch main contrib non-free
deb http://ftp.debian.org/debian stretch-updates main contrib non-free
deb http://security.debian.org stretch/updates main contrib non-free

附:Debian官方全球镜像站列表地址

Debian worldwide mirror sites​www.debian.org

3.软件的安装与更新

一般的一次整体更新软件需要以下几步:

apt-get update #更新源
apt-get upgrade #更新已经安装的软件包
apt-get dist-upgrade #升级系统
apt-get clean #清除

几种常用的操作:

删除下载的软件包

apt-get clean #清除 /var/cache/apt/archives目录

安装本地软件包

dpkg -i package_name.deb #安装本地软件包,不解决依赖关系

移除本地软件包

dpkg -r package #删除软件包
dpkg -P #删除软件包及配置文件

修复安装

apt-get -f install#修复安装

检测是否有已损坏的依赖

apt-get check#检测是否有已损依赖

 

文章出处:CNBoy 四海部落,刀云转载
签名:这个人很懒,什么也没有留下!
最新回复 (0)
返回