sudo lsb_release -a 显示系统版本
根据系统版本信息在
http://packages.ubuntu.com/precise/amd64/g++/filelist
找到对应的系统安装内容
https://packages.ubuntu.com/focal/devel/
http://archive.ubuntu.com/ubuntu/pool/main/ 这个是文件下载内容地址
在页面
https://packages.ubuntu.com/focal/devel/
找到gcc-10 ,点击到
https://packages.ubuntu.com/focal/devel/gcc-10 里面有标注相关依赖包。
http://archive.ubuntu.com/ubuntu/pool/main/g/gcc-10/
在 https://packages.ubuntu.com/focal/devel/gcc-10 子页面在点进去子下载页面会告诉文件的下载位置
对应版本在内容页面标注了文件名
gcc-10-base pool/main/g/gcc-10/ gcc-10-base_10-20200411-0ubuntu1_amd64.deb
linux-libc-dev pool/main/l/linux/ linux-libc-dev_5.4.0-26.30_amd64.deb
libbinutils pool/main/l/linux/ libbinutils_2.34-6ubuntu1_amd64.deb
binutils-common pool/main/b/binutils/ binutils-common_2.34-6ubuntu1_amd64.deb
libctf0 pool/main/b/binutils/ libctf0_2.34-6ubuntu1.5_amd64.deb
binutils-x86-64 pool/main/b/binutils/ binutils-x86-64-linux-gnu_2.34-6ubuntu1_amd64.deb
binutils pool/main/b/binutils/ binutils_2.34-6ubuntu1_amd64.deb
libasan6 pool/main/g/gcc-10/ libasan6_10-20200411-0ubuntu1_amd64.deb
libatomic1 pool/main/g/gcc-10/ libatomic1_10-20200411-0ubuntu1_amd64.deb
libitm1 pool/main/g/gcc-10/ libitm1_10-20200411-0ubuntu1_amd64.deb
liblsan0 pool/main/g/gcc-10/ liblsan0_10-20200411-0ubuntu1_amd64.deb
libquadmath0 pool/main/g/gcc-10/ libquadmath0_10.3.0-1ubuntu1~20.04_amd64.deb
libtsan0 pool/main/g/gcc-10/ libtsan0_10-20200411-0ubuntu1_amd64.deb
libubsan1 pool/main/g/gcc-10/ libubsan1_10-20200411-0ubuntu1_amd64.deb
libcrypt-dev pool/main/libx/libxcrypt/ libcrypt-dev_4.4.10-10ubuntu4_amd64.deb
libcrypt1 pool/main/libx/libxcrypt/ libcrypt1_4.4.10-10ubuntu4_amd64.deb
libcc1-0 pool/main/g/gcc-10/ libcc1-0_10-20200411-0ubuntu1_amd64.deb
libgcc-10-dev pool/main/g/gcc-10/ libgcc-10-dev_10-20200411-0ubuntu1_amd64.deb
libgcc-s1 pool/main/g/gcc-10/ libgcc-s1_10-20200411-0ubuntu1_amd64.deb
libc6 pool/main/g/glibc/ libc6_2.31-0ubuntu9_amd64.deb
libgmp10 pool/main/g/gmp/ libgmp10_6.2.0+dfsg-4_amd64.deb
libisl22 pool/main/i/isl/ libisl22_0.22.1-1_amd64.deb
libmpc3 pool/main/m/mpclib3/ libmpc3_1.1.0-1_amd64.deb
libmpfr6 pool/main/m/mpfr4/ libmpfr6_4.0.2-1_amd64.deb
libstdc++6 pool/main/g/gcc-10/ libstdc++6_10-20200411-0ubuntu1_amd64.deb
libzstd1 pool/main/libz/libzstd/ libzstd1_1.4.4+dfsg-3_amd64.deb
zlib1g pool/main/z/zlib/ zlib1g_1.2.11.dfsg-2ubuntu1_amd64.deb
libc-dev-bin pool/main/g/glibc/ libc-dev-bin_2.31-0ubuntu9.7_amd64.deb
libc6-dev pool/main/g/glibc/ libc6-dev_2.31-0ubuntu9_amd64.deb
cpp-10 pool/universe/g/gcc-10/ cpp-10_10-20200411-0ubuntu1_amd64.deb
gcc-10 pool/universe/g/gcc-10/ gcc-10_10-20200411-0ubuntu1_amd64.deb
make make_4.3-4ubuntu1_amd64.deb 到 ftp://ftp.gnu.org/gnu/make/ 下载
安装完之后 sudo ln -s /usr/bin/gcc-10 /usr/bin/gcc
下面是安装脚本
dpkg -i gcc-10-base_10-20200411-0ubuntu1_amd64.deb
dpkg -i libasan6_10-20200411-0ubuntu1_amd64.deb
dpkg -i libubsan1_10-20200411-0ubuntu1_amd64.deb
dpkg -i libtsan0_10-20200411-0ubuntu1_amd64.deb
dpkg -i libitm1_10-20200411-0ubuntu1_amd64.deb
dpkg -i liblsan0_10-20200411-0ubuntu1_amd64.deb
dpkg -i libatomic1_10-20200411-0ubuntu1_amd64.deb
dpkg -i libquadmath0_10-20200411-0ubuntu1_amd64.deb
dpkg -i linux-libc-dev_5.4.0-26.30_amd64.deb
dpkg -i binutils-common_2.34-6ubuntu1.5_amd64.deb
dpkg -i libbinutils_2.34-6ubuntu1.5_amd64.deb
dpkg -i libctf-nobfd0_2.34-6ubuntu1.5_amd64.deb
dpkg -i libctf0_2.34-6ubuntu1.5_amd64.deb
dpkg -i binutils-x86-64-linux-gnu_2.34-6ubuntu1.5_amd64.deb
dpkg -i binutils_2.34-6ubuntu1.5_amd64.deb
dpkg -i libcrypt1_4.4.10-10ubuntu4_amd64.deb
dpkg -i libcrypt-dev_4.4.10-10ubuntu4_amd64.deb
dpkg -i libcc1-0_10-20200411-0ubuntu1_amd64.deb
dpkg -i libgomp1_10-20200411-0ubuntu1_amd64.deb
dpkg -i libgcc-10-dev_10-20200411-0ubuntu1_amd64.deb
dpkg -i libgcc-s1_10-20200411-0ubuntu1_amd64.deb
dpkg -i libc6-dev_2.31-0ubuntu9.7_amd64.deb
dpkg -i libc6_2.31-0ubuntu9.7_amd64.deb
dpkg -i libgmp10_6.2.0+dfsg-4_amd64.deb
dpkg -i libisl22_0.22.1-1_amd64.deb
dpkg -i libmpc3_1.1.0-1_amd64.deb
dpkg -i libmpfr6_4.0.2-1_amd64.deb
dpkg -i libstdc++6_10-20200411-0ubuntu1_amd64.deb
dpkg -i libzstd1_1.4.4+dfsg-3_amd64.deb
dpkg -i zlib1g_1.2.11.dfsg-2ubuntu1_amd64.deb
dpkg -i libc-dev-bin_2.31-0ubuntu9.7_amd64.deb
dpkg -i manpages-dev_5.05-1_all.deb
dpkg -i cpp-10_10-20200411-0ubuntu1_amd64.deb
dpkg -i gcc-10_10-20200411-0ubuntu1_amd64.deb
dpkg -i make_4.3-4ubuntu1_amd64.deb
# 让gcc 指向gcc-10 不然找不到
sudo ln -s /usr/bin/gcc-10 /usr/bin/gcc