Last active
June 30, 2024 11:38
-
-
Save zuyu/7d5682a5c75282c596449758d21db5ed to your computer and use it in GitHub Desktop.
Install gcc 6 on Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt update && \ | |
sudo apt install build-essential software-properties-common -y && \ | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \ | |
sudo apt update && \ | |
sudo apt install gcc-6 g++-6 -y && \ | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \ | |
gcc -v |
I'm on 20.04 and get
E: Package 'gcc-6' has no installation candidate
E: Package 'g++-6' has no installation candidate
- sudo vim /etc/apt/sources.list
- add
deb http://dk.archive.ubuntu.com/ubuntu/ bionic main universe
to file- sudo apt update
4.sudo apt-get install gcc-6 g++-6 -y
It worked!. Thank you so much.
I'm on 20.04 and get
E: Package 'gcc-6' has no installation candidate
E: Package 'g++-6' has no installation candidate
- sudo vim /etc/apt/sources.list
- add
deb http://dk.archive.ubuntu.com/ubuntu/ bionic main universe
to file- sudo apt update
4.sudo apt-get install gcc-6 g++-6 -y
for those who encounter the error:
E: The repository 'http://dk.archive.ubuntu.com/ubuntu bionic InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
consider adding [trusted=yes]
:
deb [trusted=yes] http://dk.archive.ubuntu.com/ubuntu/ bionic main universe
After that, I can install them successfully~
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you! It's helpful😺