Download or install C, C++ compiler on Red Hat Enterprise Linux 5 (RHEL)

by Vivek Gite · 20 comments

Q. I have Red hat enterprise Linux 5 installed on one of the production server. However there is no c compiler installed. I need to compile few applications on this box. How do I install C or C++ compiler on Red Hat Enterprise Linux 5? Where can I get / download compile package?

A.In order to compile and use c/c++ under Linux you need 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:
[a] Use GUI tool
[b] Install rpm from CDROM/DVD
[c] Download and install compiler from RHN over internet

Option # 1: Use GUI tool

Use 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 CD/DVD and install following packages using rpm command.
# rpm -ivh gcc*

Option # 3: Download and install compiler from RHN over internet

You can download and install packages using RHN and yum command:
# yum install gcc gcc-c++ autoconf automake

Featured Articles:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 20 comments… read them below or add one }

1 ali110 08.05.07 at 3:18 am

i wont compiler c linux redhat as4

2 Rajic 08.17.07 at 2:12 pm

Its Great to use needed this kind of blogs

3 anas 09.02.07 at 5:42 am

Very use full thanks lot

4 Rod Evans 11.22.07 at 4:47 pm

This really is one of the clearest and most helpful answers to a tech question that I’ve ever seen. I’ve just taken on a RHEL v5 server and needed gcc installed – ten minutes after finding this site, I have gcc 4.1.2 installed. This must have saved me a few hours of searching and reading install instructions . . .

I found your site through Google but have now bookmarked it and I’ll be back!

5 ttty 12.20.07 at 7:46 am

thanks for the info!

6 xfgs 03.31.08 at 11:27 am

why registration is Required???? if it is free
u will get hit more if u remove this step

7 zoya 08.13.08 at 12:37 pm

how would i install c language

8 karuppu 08.23.08 at 3:46 pm

hello
thank u

9 Justin 01.16.09 at 1:48 am

thanks for the info! It is very useful!

10 Nitin 02.23.09 at 7:18 am

I have problem in installing *.tar.gz file on my machine…

11 Nitin 02.23.09 at 7:23 am

replay must is very argent for me…

12 rafael ortega 03.15.09 at 2:27 am

in reading your blog i’m as confused and lost as ethernet is to phone transmission; i installed mandriva free and that is the os i’m using at present; i then foolishly bought their powerpack, thinking it would solve the problems that mandriva one was presenting to me; having downloaded it and installed it due to my ignorance in handling this os i made it unusable; i then repeatedly tried to reinstall it only to find that the operating system will not load giving me an error message: fatal error message which i cannot overcome, yet.
can you help?

13 rafael ortega 03.15.09 at 2:29 am

is there anyone there who knows what i can do?

14 yadav shakti 07.08.09 at 7:40 pm

where i downloard and installation process

15 yadav shakti 07.08.09 at 7:41 pm

from i install the g++ software or c/c++

16 Raihan Naufal 08.20.09 at 6:27 am

thanks a lot bro. this the good article.

17 vipin 08.24.09 at 6:43 pm

thanks for the info!

18 omar 08.26.09 at 3:10 pm

After typing the following command “$ which gcc” to verify that gcc is installed, the Output was “/usr/bin/which: no gcc in (/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/omar/bin)
” , instead of being “/usr/bin/gcc”. what i have to do now?

19 kagrrahang 11.06.09 at 8:20 am

where download the gcc rpm program package?

20 noname 12.14.09 at 5:23 pm

Keep in mind that developer packages (ie compiler tools) are not available for RHEL Desktop Basic, you need at least option Workstation.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All