Install build essentials.

1
sudo dnf groupinstall "Development Tools"  # gcc-11 is installed by default

Enable devel repository and install gcc toolset 13:

1
2
3
sudo dnf config-manager --set-enabled devel
sudo dnf update
sudo dnf install gcc-toolset-13

To enable gcc-13:

1
scl enable gcc-toolset-13 bash

To disable gcc-13, just exit the shell:

1
exit