若是服務器是本身的,而且機器就在身邊,那什麼都不用說了,缺乏gcc頂多就是從新放入安裝盤,把開發工具包安裝上。可是若是是租的服務器,託管服務 方那幫人又搞不懂你說的啥子gcc,要安裝gcc實在是太麻煩了。你得去找gcc相關的包,版本號還得必須對應上,不然不兼容。最近給一個朋友裝gcc, 着實頭疼了一把。後來發現yum這個好東西,只須要執行一個命令,全部的煩惱都解除了。
朋友的系統是CentOS 5 的,託管商沒給安裝gcc,因而使用以下兩個命令就可把gcc,gcc-c++通通安裝上: c++
yum -y install gcc
yum -y install gcc-c++
yum會自動查找軟件的相關依賴包,自動下載安裝,全過程輕鬆愉快。特此記錄一下。 centos
[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 0:4.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 0:2.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 0:2.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 kernel-headers.i386 0:2.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 00:06
(2/4): kernel-headers-2.6.18-274.3.1.el5.i386.rpm | 1.2 MB 00:14
(3/4): glibc-devel-2.5-65.i386.rpm | 2.0 MB 00:11
(4/4): gcc-4.1.2-51.el5.i386.rpm | 5.2 MB 00:27
--------------------------------------------------------------------------------
Total 149 kB/s | 9.1 MB 01:02
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 0:4.1.2-51.el5
Dependency Installed:
glibc-devel.i386 0:2.5-65 glibc-headers.i386 0:2.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 0:4.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 0:4.1.2-51.el5 set to be updated ---> Package glibc-devel.i386 0:2.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 0:4.1.2-51.el5 set to be updated ---> Package libgomp.i386 0:4.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 0:2.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 0:2.5-65 set to be updated ---> Package kernel-headers.i386 0:2.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: