Install it by:
sudo yum install centos-release-scl
sudo yum install devtoolset-4
The first command installs and enables Software Collections Repository on your CentOS machine. That repository provides the devtoolset package.
g++ - How can I install devtoolset on the workstation edition of RHEL7 - Stack Overflow
linux - Can not find required gcc version after devtoolset installation - Stack Overflow
linux - How to install gcc8 using devtoolset-8-gcc - Stack Overflow
Install Obsolete Devtoolset Collection for CentOS - Stack Overflow
Install it by:
sudo yum install centos-release-scl
sudo yum install devtoolset-4
The first command installs and enables Software Collections Repository on your CentOS machine. That repository provides the devtoolset package.
This does not work on CentOS 6.10 anymore.
Those are the ones available without jumping through hoops:
[misp@misp-centos6 ~]$ yum search devtoolset |grep devtoolset|awk {'print $1'} |cut -f 1,2 -d\-|sort|uniq
===========================
devtoolset-6
devtoolset-6.x86_64
devtoolset-7
devtoolset-7.x86_64
I am using CentOS 7.9 and I encountered the same problem after following instructions here to install and run gcc 11. I tried launching different versions of gcc and found only devtoolset-9 works, which corresponds to the file devtoolset-9 in /etc/scl/conf/ folder. So I copied devtoolset-9 to devtoolset-11 in the same folder, and gcc 11 gets working.
I ran into the same issue that you are facing and this is how I got it fixed:
- Just want to be careful, you need to exist the Terminal and open a fresh one to start. This way, you are not under any devtoolset's bash.
- Go to /opt/rh folder, run command ls -la to see if you have any devtoolset-* folder there. Let's say you have devtoolset-8, proceed step 2.
- Go to /etc/scl/prefixes folder, if you don't see devtoolset-8 file, you can create a new one as devtoolset-8, and type 1 line: /opt/rh, then save and quit that file.
- Once you are done, you can call: scl enable devtoolset-8 -- bash w/o any error. Good luck
To install the full tools-set including gfortran on centos 7:
yum install centos-release-scl
yum install devtoolset-8
scl enable devtoolset-8 -- bash
enable the tools:
source /opt/rh/devtoolset-8/enable
you may wish to put the command above in .bash_profile
ref: https://unix.stackexchange.com/questions/477360/centos-7-gcc-8-installation
devtoolset-8 was only released a short while ago. The linked installation instructions may be of use. However, your question pertains to CentOS, and this does not yet appear to have been made available yet. You can see some evidence of it being build for CentOS here, but it's not been updated for the final release yet.
You could ask on the SCL mailing list for an ETA, or wait until it appears in its final form. In the meantime, you could download the RPMs from koji directly.
While Devtoolset-3 and 4 are located on the Centos mirror site, yum will not be able to find them as they were not included in the repodata on the site. These were probably excluded because they are EOL (end-of-life), and have dependency bugs (Bug 1410152). Try using the older Devtoolset-3 packages here, which do not have the dependency issues:
https://copr.fedorainfracloud.org/coprs/rhscl/devtoolset-3/
If you really want the packages from the centos.org site, I went with wget to download all the RPMs, then recreated a local yum repo. However, you'll see the dependency issues and yum install devtoolset-3 will fail.
$ wget -r -p -e robots=off --directory-prefix="/mnt/local-devtoolset3-repo" --recursive --no-clobber --no-parent http://mirror.centos.org/centos/6/sclo/x86_64/rh/devtoolset-3/
$ sudo yum install createrepo
$ cd /mnt/local-devtoolset3-repo
$ createrepo --database .
There was no DTS 5 release. It was skipped to align the DTS version with the GCC major release, once GCC switched to a yearly increasing version number.
DTS versions 3 and 4 are available from the centos-release-scl repository.
In your console output it says: Maybe run: yum groups mark install (see man yum)—did you do this?
Try running the following commands:
yum groups mark install "Development Tools"
yum groups mark convert "Development Tools"
yum groupinstall "Development Tools"
Reference: RedHat Customer Portal discussion
Try:
yum group list
To see if yum can find the Development Tools under Available Groups.
If it fails, try:
yum clean all
yum group list
And see if it can find it. If it still fails, you might not have the correct mirrors enabled to resolve it.
try the clean command again and then:
yum --disablerepo=\* --enablerepo=base,updates group list
If you can find it. Great! Install with:
yum --disablerepo=\* --enablerepo=base,updates groupinstall "Development Tools"
If not so, can you give us the output of:
yum repolist all
EDIT:
Thank you for the output.
I found an article which state the following: "To install the CentOS Development tools, you will need to be able to connect to your Virtual Server using SSH, and work as the root user."
Try switching to user "root" (if you don't know the root login credentials, you can try sudo su. sudo also might work but I see you already have tried that...) and running the above commands.
Lastly, you can try and enable these "sources" repos:
- CentOS-7 - Base Sources
- CentOS-7 - Extras Sources
- CentOS-7 - Updates Sources
And than running yum update followed by groupinstall.
Let me know if that doesn't work. Good luck!