1)切换镜像源
本身的镜像都是国外的,下载依赖包太慢, 需要替换成国内镜像地址
国内镜像源推荐
阿里 OPSX 源: https://opsx.alibaba.com/mirror
网易 163 源: http://mirrors.163.com/
中科大 USTC 源: https://mirrors.ustc.edu.cn/
清华 TUNA 源: https://mirrors.tuna.tsinghua.edu.cn/
ubuntu 中国官方源(搜狐): http://mirrors.sohu.com/help/ubuntu.html
1. 需要修改/etc/apt/sources.list文件内容来修改apt源 首先备份文件 cd /etc/apt/ cp sources.list sources.list.bak 2.修改sources.list文件内容 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse 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 3.更新apt本地索引 apt-get update
常见问题:
1.使用apt-get update 更新的时候发生错误
Ubuntu 20.04 GPG error: The following signatures couldn't be verified
原因:这是因为尝试包含第三方包失败,需要进行导入操作
解决:
1.W: GPG error: http://pkg.jenkins-ci.org/debian binary/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY FCEF32E745F2C3D5 E: The repository 'http://pkg.jenkins-ci.org/debian binary/ Release' is not signed. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. 找到PUBKEY : FCEF32E745F2C3D5 2.导入密钥 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FCEF32E745F2C3D5 3.apt-key list 查看当前导入的key