-
-
Save zuyu/7d5682a5c75282c596449758d21db5ed to your computer and use it in GitHub Desktop.
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
1. sudo vim /etc/apt/sources.list 2. add `deb http://dk.archive.ubuntu.com/ubuntu/ bionic main universe` to file 3. sudo apt update 4.sudo apt-get install gcc-6 g++-6 -y
this is showing me
sudo: vim: command not found
This is showing me
sudo: vim: command not found
vim
is just a text editor. You can whether install it using sudo apt install vim
or use another one, as nano
.
Hi, This has been useful for me, so I'll chip in. With ubuntu 20.04 you can't just add the ubuntu-toolchain repository.
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
won't work. You'll get the error:Package gcc-6 is not available.
When you adddeb http://dk.archive.ubuntu.com/ubuntu/ bionic main universe
tosources.list
you get a GPG error because a public encription key doesn't seem to be reachable.To solve this issue, this is what worked on my fresh ubuntu 22.04 installation:
1. sudo vim /etc/apt/sources.list 2. add `deb http://dk.archive.ubuntu.com/ubuntu/ bionic main universe` to file 3. sudo apt update 4. Find the key ID after the text: ```NO_PUBKEY``` XXXXXXXXXX 5. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys XXXXXXXXXX 6. sudo apt update 7. sudo install gcc-6 g++-6 -y
Hope it helps (@pratt3000, @maitpate)
Thanks for the solution. When I tried, dk.archive.ubuntu
was unreachable, so I used en.archive.ubuntu
instead.
Hi, This has been useful for me, so I'll chip in. With ubuntu 20.04 you can't just add the ubuntu-toolchain repository.
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
won't work. You'll get the error:Package gcc-6 is not available.
When you adddeb http://dk.archive.ubuntu.com/ubuntu/ bionic main universe
tosources.list
you get a GPG error because a public encription key doesn't seem to be reachable.To solve this issue, this is what worked on my fresh ubuntu 22.04 installation:
1. sudo vim /etc/apt/sources.list 2. add `deb http://dk.archive.ubuntu.com/ubuntu/ bionic main universe` to file 3. sudo apt update 4. Find the key ID after the text: ```NO_PUBKEY``` XXXXXXXXXX 5. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys XXXXXXXXXX 6. sudo apt update 7. sudo install gcc-6 g++-6 -y
Hope it helps (@pratt3000, @maitpate)
Thank you! It's helpful😺
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~
Worked like a charm (on Kub20) thanks !