Skip to content

Instantly share code, notes, and snippets.

@zuyu
Last active June 30, 2024 11:38
Show Gist options
  • Save zuyu/7d5682a5c75282c596449758d21db5ed to your computer and use it in GitHub Desktop.
Save zuyu/7d5682a5c75282c596449758d21db5ed to your computer and use it in GitHub Desktop.
Install gcc 6 on Ubuntu
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
@Zetacat
Copy link

Zetacat commented May 23, 2024

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

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