gcc任意版本安装流程(linux)

本文介绍了如何在基于Debian的Linux发行版(如Ubuntu)上更换阿里云镜像源,并详细指导了如何安装更新的GCC版本8,以及手动配置GCC和g++的过程。

一.更换镜像源

仅仅针对有需要换镜像需求的用户
sudo gedit /etc/apt/sources.list 用于在基于Debian的Linux发行版(如Ubuntu)上用来编辑软件源列表的命令。
我们更换阿里源:

deb 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-proposed main restricted universe multiverse
deb-src 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-backports main restricted universe multiverse

sudo apt update
sudo apt upgrade以此来更新镜像源

二.安装更新gcc版本

搭建了镜像源后,用该sudo apt install gcc-8 g+±8命令下载gcc需要的版本,我这里下载的gcc-8
在这里插入图片描述
下载gcc相应版本后,需要添加到备选项
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 --slave /usr/bin/g++ g++ /usr/bin/g+±8

三.手动配置gcc和g++版本

sudo update-alternatives --config gcc
sudo update-alternatives --config g++
用于手动配置gcc和g++版本
在这里插入图片描述
gcc --versiong++ --version查看刚才应用的gcc版本,说明安装gcc成功
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值