linuxgccg++centos7rhel7

how to install gcc 4.9.2 on RHEL 7.4


I am trying to install gcc and g++ 4.9.2 on Linux. I'm pretty new with Linux and i saw some guides of how to install, but each time I encountered with another problem. I don't have any gcc right now on my machine. my Linux version is: Red Hat Enterprise Linux Server release 7.4 (Maipo) can someone help me and give me instructions from the beginning to the end how to do this properly? thank you very much.


Solution

  • RHEL comes with preconfigured repo, you can search for the desired packages and install them using yum package manager.

    To do so, first run ( to search gcc )

    $ sudo yum search gcc 
    

    which will show you a list of available packages with the matching name

    ============================ Name Exactly Matched: gcc =============================
    gcc.x86_64 : Various compilers (C, C++, Objective-C, ...)
    gcc.x86_64 : Various compilers (C, C++, Objective-C, ...)
    gcc.i686 : Various compilers (C, C++, Objective-C, ...)
    =========================== Name & Summary Matched: gcc ============================
    gcc-c++.x86_64 : C++ support for GCC
    gcc-c++.i686 : C++ support for GCC
    gcc-gdb-plugin.x86_64 : GCC plugin for GDB
    gcc-gdb-plugin.i686 : GCC plugin for GDB
    gcc-gdb-plugin.x86_64 : GCC plugin for GDB
    gcc-objc.x86_64 : Objective-C support for GCC
    ...
    
    

    Install the package you need by running ( to install gcc-c++ )

    $ sudo yum install gcc-c++
    

    It will the packages to be installed and ask for confirmation.

    Dependencies resolved.
    ====================================================================================
     Package           Architecture     Version                 Repository         Size
    ====================================================================================
    Installing:
     gcc-c++           x86_64           8.3.1-2.fc29            updates            12 M
    
    Transaction Summary
    ====================================================================================
    Install  1 Package
    
    Total download size: 12 M
    Installed size: 29 M
    Is this ok [y/N]:
    

    NOTE: Steps mentioned above will install latest available version of the package.


    Install a particular Version of a Package
    Install all development tools