其实就是去找个正确的/etc/apt/sources.list 体会一下就行。
参考:https://gist.github.com/h0bbel/4b28ede18d65c3527b11b12fa36aa8d1
这是美国的源。
Shell
x
57
57
1
# backup
2
mv /etc/apt/sources.list /etc/apt/sources.list.bak
3
4
# edit
5
cat > /etc/apt/sources.list <<EOF
6
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
7
# newer versions of the distribution.
8
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
9
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
10
11
## Major bug fix updates produced after the final release of the
12
## distribution.
13
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
14
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
15
16
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
17
## team. Also, please note that software in universe WILL NOT receive any
18
## review or updates from the Ubuntu security team.
19
deb http://us.archive.ubuntu.com/ubuntu/ bionic universe
20
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe
21
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
22
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe
23
24
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
25
## team, and may not be under a free licence. Please satisfy yourself as to
26
## your rights to use the software. Also, please note that software in
27
## multiverse WILL NOT receive any review or updates from the Ubuntu
28
## security team.
29
deb http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
30
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse
31
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
32
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
33
34
## N.B. software from this repository may not have been tested as
35
## extensively as that contained in the main release, although it includes
36
## newer versions of some applications which may provide useful features.
37
## Also, please note that software in backports WILL NOT receive any review
38
## or updates from the Ubuntu security team.
39
# deb http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
40
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
41
42
## Uncomment the following two lines to add software from Canonical's
43
## 'partner' repository.
44
## This software is not part of Ubuntu, but is offered by Canonical and the
45
## respective vendors as a service to Ubuntu users.
46
# deb http://archive.canonical.com/ubuntu bionic partner
47
# deb-src http://archive.canonical.com/ubuntu bionic partner
48
49
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
50
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
51
deb http://security.ubuntu.com/ubuntu bionic-security universe
52
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
53
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
54
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
55
EOF
56
57
apt update -y && apt upgrade -y
国内阿里的源
Shell
xxxxxxxxxx
1
14
14
1
mv /etc/apt/sources.list /etc/apt/sources.list.bak
2
cat > /etc/apt/sources.list <<EOF
3
# 阿里源
4
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
5
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
6
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
7
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
8
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
9
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
10
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
11
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
12
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
13
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
14
EOF
然后就可以正常 了