How to install GCC using yum in Linux

Source: Internet
Author: User

If the server is your own and the machine is around, nothing should be said. If GCC is missing, re-install the installation disk and install the development kit. However, if it is a rented server and the hosting service provider does not understand what you say about GCC, it is too troublesome to install GCC. You have to find the GCC-related package. The version number must be matched, otherwise it is not compatible. Recently, it was a headache to install GCC for a friend. Later I found that Yum, a good thing, only needs to execute one command, and all the troubles are relieved.

My friend's system is from centos 5. The supervisor did not install GCC, so we can use the following two commands to install GCC and GCC-C ++:

 

Yum-y install gcc

Yum-y install gcc-C ++

Yum automatically finds the dependent packages of the software and automatically downloads and installs the software. The entire process is easy and enjoyable. Record it here.

 

[Root @ localhost ~] # Yum-y install gcc
Loaded plugins: fastestmirror, rhnplugin, security
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
This system is not registered with RHN.
RHN support will be disabled.
Loading mirror speeds from cached hostfile
Setting up install process
Resolving Dependencies
--> Running transaction check
---> Package GCC. i386. 1.2-51. EL5 set to be updated
--> Processing dependency: Glibc-devel> = 2.2.90-12 for package: gcc
--> Running transaction check
---> Package glibc-devel.i386. 5-65 set to be updated
--> Processing dependency: Glibc-headers = 2.5-65 for package: Glibc-devel
--> Processing dependency: Glibc-headers for package: Glibc-devel
--> Running transaction check
---> Package glibc-headers.i386. 5-65 set to be updated
--> Processing dependency: Kernel-headers> = 2.2.1 For package: Glibc-the headers
--> Processing dependency: Kernel-headers for package: Glibc-headers
--> Running transaction check
---> Package kernel-headers.i386. 6.18-274.3.1.el5 set to be updated
--> Finished dependency resolution

Dependencies resolved

=============================================== ==========================================================
Package arch version repository size
========================================================== ==========================================================
Installing:
GCC i386 4.1.2-51. EL5 base 5.2 m
Installing for dependencies:
Glibc-devel i386 2.5-65 base 2.0 m
Glibc-headers i386 2.5-65 base 604 K
Kernel-headers i386 2.6.18-274.3.1.el5 updates 1.2 m

Transaction Summary
========================================================== ==========================================================
Install 4 package (s)
Upgrade 0 package (s)

Total download size: 9.1 m
Downloading packages:
(1/4): glibc-headers-2.5-65.i386.rpm | 604 KB
(2/4): kernel-headers-2.6.18-274.3.1.el5.i386.rpm | 1.2 MB
(3/4): glibc-devel-2.5-65.i386.rpm | 2.0 MB
(4/4): gcc-4.1.2-51.el5.i386.rpm | 5.2 MB
--------------------------------------------------------------------------------
Total 149 kb/s | 9.1 MB
Running rpm_check_debug
Running transaction Test
Finished transaction Test
Transaction test succeeded
Running transaction
Installing: Kernel-headers 1/4
Installing: Glibc-headers 2/4
Installing: Glibc-devel 3/4
Installing: GCC 4/4

Installed:
Gcc. i386. 1.2-51. EL5

Dependency installed:
Glibc-devel.i386. 5-65 glibc-headers.i386. 5-65
Kernel-headers.i386 0. 2. 6.18-274.3.1.el5

Complete!
[Root @ localhost ~] #

 

 

 

 

[Root @ localhost ~] # Yum install gcc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up install process
Resolving Dependencies
--> Running transaction check
---> Package GCC. i386. 1.2-51. EL5 set to be updated
--> Processing dependency: CPP = 4.1.2-51. EL5 for package: gcc
--> Processing dependency: libgomp> = 4.1.2-51. EL5 for package: gcc
--> Processing dependency: Glibc-devel> = 2.2.90-12 for package: gcc
--> Processing dependency: libgcc> = 4.1.2-51. EL5 for package: gcc
--> Running transaction check
---> Package CPP. i386. 1.2-51. EL5 set to be updated
---> Package glibc-devel.i386. 5-65 set to be updated
--> Processing dependency: Glibc-headers = 2.5-65 for package: Glibc-devel
--> Processing dependency: Glibc = 2.5-65 for package: Glibc-devel
--> Processing dependency: Glibc-headers for package: Glibc-devel
---> Package libgcc. i386. 1.2-51. EL5 set to be updated
---> Package libgomp. i386. 4.4-13. EL5 set to be updated
--> Running transaction check
--> Processing dependency: Glibc = 2.5-49 for package: nscd
---> Package glibc. i686 0: 2. 5-65 set to be updated
--> Processing dependency: Glibc-common = 2.5-65 for package: glibc
---> Package glibc-headers.i386. 5-65 set to be updated
--> Processing dependency: Kernel-headers> = 2.2.1 For package: Glibc-headers
--> Processing dependency: Kernel-headers for package: Glibc-headers
--> Running transaction check
---> Package glibc-common.i386. 5-65 set to be updated
---> Package kernel-headers.i386. 6.18-274. EL5 set to be updated
---> Package nscd. i386 0: 2. 5-65 set to be updated
--> Finished dependency resolution

Dependencies resolved

========================================================== ==========================================================
Package arch version repository size
========================================================== ==========================================================
Installing:
GCC i386 4.1.2-51. EL5 base 5.2 m
Installing for dependencies:
Glibc-devel i386 2.5-65 base 2.0 m
Glibc-headers i386 2.5-65 base 604 K
Kernel-headers i386 2.6.18-274. EL5 base 1.2 m
Libgomp i386 4.4.4-13. EL5 base 72 K
Updating for dependencies:
CPP i386 4.1.2-51. EL5 base 2.7 m
Glibc i686 2.5-65 base 5.3 m
Glibc-common i386 2.5-65 base 16 m
Libgcc i386 4.1.2-51. EL5 base 96 k
Nscd i386 2.5-65 base 169 K

Transaction Summary
========================================================== ==========================================================
Install 5 package (s)
Upgrade 5 package (s)

Total download size: 34 m
Is this OK [Y/n]: Y
Downloading packages:

 

 

 

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.