Ubuntu 换阿里源
先说问题,今天在配置Ubuntu按照网上找的换源办法换源之后安装gcc之后无法安装G++。
● 查询系统发行版本信息
lsb_release -a
● 进入apt路径,编辑源文件
cd /etc/apt/ sudo mv sources.list sources.list.bak sudo vim sources.list
● 清空内容,并且替换为如下内容 – 这里面的focal需要替换成自己的发行版,我的是jammy
eb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
● 更新apt
sudo apt update sudo apt upgrade
这个时候再下载,则会变成阿里源,飞快。