This issue in this case is RedHat subscription channels. Though the subscription and software are free (provided you have an active subscription already), for some reason you have to make a 'special request' to RedHat as per:
https://access.redhat.com/solutions/472793
You can automate this by visiting:
https://www.redhat.com/wapps/try/RHSCL
(when logged into the support portal). This should automatically be approved after which you can attach a new subscription. Identify the pool id using:
subscription-manager list --available --all
To find the pool id:
Subscription Name: Software Collections and Developer Toolset
Provides: Red Hat Developer Tools (for RHEL Server)
Red Hat Developer Tools Beta (for RHEL Workstation)
Red Hat Software Collections Beta (for RHEL Server)
Red Hat Software Collections Beta (for RHEL Workstation)
Red Hat Software Collections (for RHEL Server)
Red Hat Developer Tools Beta (for RHEL Server)
Red Hat Developer Toolset (for RHEL Workstation)
Red Hat Software Collections Beta (for RHEL Client)
Red Hat Software Collections (for RHEL Workstation)
Red Hat Developer Toolset (for RHEL Server)
Red Hat Developer Tools (for RHEL Workstation)
Red Hat Software Collections (for RHEL Client)
SKU: foobar
Contract: 1234 Pool ID: XXXXXXXXXX
Then attach this and enable the newly available repos:
>subscription-manager attach --pool=XXXXXXXXXXXXXXXXXXXX
Successfully attached a subscription for: Software Collections and Developer Toolset
>subscription-manager repos --enable rhel-workstation-rhscl-7-rpms
Repository 'rhel-workstation-rhscl-7-rpms' is enabled for this system.
>subscription-manager repos --enable rhel-7-workstation-devtools-rpms
Repository 'rhel-7-workstation-devtools-rpms' is enabled for this system.
You can now install freely:
>yum update -y
>yum install -y devtoolset-7-gcc-c++
Quite why they make you jump through so many hoops is explained by RedHat as follows:
Answer from Bruce Adams on Stack Overflow-If you have a 2013 RHEL SKU with Standard or Premium service level, there should be no action on your part, and your subscription should have full access to RHSCL.
-If you have a 2010 or older RHEL SKU with Standard or Premium service level, you should contact Red Hat Customer Service to request the RHSCL SKU (and all related content) added to your account.
NOTE: Developer Toolset is now included as part of Red Hat Software Collections. This change was made on May 29, 2014.
As you had Red Hat Enterprise Linux Workstation, Standard subscription which is older RHEL SKU with Standard service level, you had to initiate a special request for it
mayeut/devtoolset-11 - Fedora Discussion
g++ - How can I install devtoolset on the workstation edition of RHEL7 - Stack Overflow
Where do I get "Development Tools" for CentOS 7 when trying to install via yum? - Unix & Linux Stack Exchange
How to install devtoolset-11 on Centos 8 Stream - Stack Overflow
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!
On CentOS I can do yum install devtoolset-8 followed by scl enable devtoolset-8 bash so that my paths are setup to use GCC et al packaged with that development toolset.
Is there an equivalent in AlmaLinux?
From this answer to "Install gcc 4.7 on CentOS [6.x]", the easiest way to get g++ 4.7, and the required tools and libraries, for CentOS 5.x is via the devtools package:
cd /etc/yum.repos.d
wget http://people.centos.org/tru/devtools/devtools.repo
yum --enablerepo=testing-devtools-6 install devtoolset-1.0
Since you're running g++ manually (as opposed to through make), you'll need to update your $PATH variable so your shell will use the new gcc, g++, etc. binaries:
export PATH=/opt/centos/devtoolset-1.0/root/usr/bin/:$PATH
At this point, your g++ should be version 4.7.0
$ g++ --version
g++ (GCC) 4.7.0 20120507 (Red Hat 4.7.0-5)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Be aware that installing gcc and associated tools and libraries in this manner relies on the repository maintainer to keep their packages up to date.
If you're interested in keeping your gcc up to date, you may want to consider building gcc from source.
Also, compiling programs with a different version of g++ and libstdc++ than are installed on your system can cause all kinds of Fun, coping with which is beyond the scope of this answer. It may be worth moving to a Linux distribution that has support for what you're doing.
Package managers are great, but (understandably) won't generally include the latest version of software. CentOS being a distribution particularly focusing on servers, favors stability (and extensive testing) over having the latest and shiniest. Here are your solutions:
Change distro
Other distributions like Arch Linux, Sabayon Linux or Debian "Sid" include newest versions a lot faster. You may consider changing distros.
Build it yourself
If you're stuck with CentOS, your best bet is to build gcc from source. It means getting the source code, making sure the dependencies are already present on your system (if not, I'm sure you can get them from the CentOS package manager), compiling the source into a binary executable, and installing the executable on your system.
It's not the easiest way to do it for sure, but you'll learn a lot about Unix in the process. Make sure to read the document a few times to make sure you get everything, and ask questions if something specific is unclear.
Be patient
At some point, this version (or newer) of gcc/g++ is going to enter the package manager. If you wait (up to several months, I'm not very familiar with the CentOS release cycle), you'll ultimately get what you want.