I have a Red Hat Enterprise Linux version 5 installed on one of the production server. However, I noticed that there is no GNU c/c++ compiler installed on the RHEL 5/RHEL 6 based system. I need to compile a few applications on this box. How do I install C or C++ compiler on Red Hat Enterprise Linux 5/6? Where can I get / download compiler package?
In order to compile and use c/c++ under RHEL you need the following packages:
=> autoconf : GNU’s Autoconf is a tool for configuring source code and Makefiles.
=> make/automake : A GNU tool for controlling the generation of executables and other non-source files of a program from the program’s source files.
=> GNU GCC C compiler (gcc) : The gcc package contains the GNU Compiler Collection version 4.1+
=> GNU GCC C++ compiler (gcc-c++): This package adds C++ support to the GNU Compiler Collection.
You have total 3 options to download and install GCC compiler under Redhat / CentOS / Fedora Linux:
- Use GUI tool to install compiler set
- Install compiler rpms from CDROM/DVD
- Download and install compiler from RHN over the Internet
Option # 1: Use GUI tool to install c/c++ compiler set
You can use a GUI tool called system-config-packages to install gcc. Just type the following command and select gcc and above packages:
$ system-config-packages &
Option # 2: Install rpm from CDROM/DVD
Mount your RHEL/CentOS Linux CD/DVD and install the following packages using rpm command:
# rpm -ivh gcc*
Option # 3: Download and install compiler from RHN over the Internet
You can download and install packages using RHN and yum command:
# yum install gcc gcc-c++ autoconf automake