Ubuntu20.04更换国内源
2022-09-05 本文已影响0人
再梦梦就醒了
1、备份原来的源
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak20220906
2、编辑sources.list配置文件更换源
sudo vim/etc/apt/sources.list
添加如下内容
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
3、更新源
sudo apt-get update
4、更新软件
sudo apt-get upgrade
最后装个MySQL测试一下
# apt install mysql-server
可以看到已经成功安装上了MySQL80
root@jiahao:/# mysql --version
mysql Ver 8.0.30-0ubuntu0.20.04.2 for Linux on x86_64 ((Ubuntu))
root@jiahao:/# dpkg -l | grep mysql
ii mysql-client-8.0 8.0.30-0ubuntu0.20.04.2 amd64 MySQL database client binaries
ii mysql-client-core-8.0 8.0.30-0ubuntu0.20.04.2 amd64 MySQL database core client binaries
ii mysql-common 5.8+1.0.5ubuntu2 all MySQL database common files, e.g. /etc/mysql/my.cnf
ii mysql-server 8.0.30-0ubuntu0.20.04.2 all MySQL database server (metapackage depending on the latest version)
ii mysql-server-8.0 8.0.30-0ubuntu0.20.04.2 amd64 MySQL database server binaries and system database setup
ii mysql-server-core-8.0 8.0.30-0ubuntu0.20.04.2 amd64 MySQL database server binaries