yum安裝gcc

  若是服務器是本身的,而且機器就在身邊,那什麼都不用說了,缺乏gcc頂多就是從新放入安裝盤,把開發工具包安裝上。可是若是是租的服務器,託管服務 方那幫人又搞不懂你說的啥子gcc,要安裝gcc實在是太麻煩了。你得去找gcc相關的包,版本號還得必須對應上,不然不兼容。最近給一個朋友裝gcc, 着實頭疼了一把。後來發現yum這個好東西,只須要執行一個命令,全部的煩惱都解除了。linux

      朋友的系統是CentOS 5 的,託管商沒給安裝gcc,因而使用以下兩個命令就可把gcc,gcc-c++通通安裝上:c++

yum -y install gcc

yum -y install gcc-c++

 

yum會自動查找軟件的相關依賴包,自動下載安裝,全過程輕鬆愉快。特此記錄一下。服務器

 

[root@localhost Jorcen]# yum -y install gcc
Loaded plugins: fastestmirror, langpacks, refresh-packagekit
livna                                                    | 1.3 kB     00:00     
rpmfusion-free-updates                                   | 3.3 kB     00:00     
rpmfusion-nonfree-updates                                | 3.3 kB     00:00     
updates/19/x86_64/metalink                               | 4.0 kB     00:00     
updates                                                  | 4.9 kB     00:00     
updates/19/x86_64/primary_db                               |  11 MB   00:54     
(1/3): rpmfusion-nonfree-updates/19/x86_64/primary_db      | 246 kB   00:01     
(2/3): updates/19/x86_64/updateinfo                        | 1.2 MB   00:04     
(3/3): updates/19/x86_64/pkgtags                           | 1.0 MB   00:19     
Loading mirror speeds from cached hostfile
 * fedora: mirrors.oschina.net
 * livna: ftp-stud.fht-esslingen.de
 * rpmfusion-free: mirror.bjtu.edu.cn
 * rpmfusion-free-updates: mirror.bjtu.edu.cn
 * rpmfusion-nonfree: mirror.bjtu.edu.cn
 * rpmfusion-nonfree-updates: mirror.bjtu.edu.cn
 * updates: mirrors.oschina.net
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.8.2-7.fc19 will be installed
--> Processing Dependency: cpp = 4.8.2-7.fc19 for package: gcc-4.8.2-7.fc19.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.8.2-7.fc19.x86_64
--> Processing Dependency: libmpc.so.3()(64bit) for package: gcc-4.8.2-7.fc19.x86_64
--> Running transaction check
---> Package cpp.x86_64 0:4.8.2-7.fc19 will be installed
---> Package glibc-devel.x86_64 0:2.17-20.fc19 will be installed
--> Processing Dependency: glibc-headers = 2.17-20.fc19 for package: glibc-devel-2.17-20.fc19.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.17-20.fc19.x86_64
---> Package libmpc.x86_64 0:1.0.1-1.fc19 will be installed
--> Running transaction check
---> Package glibc-headers.x86_64 0:2.17-20.fc19 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                                Arch                            Version                                Repository                        Size
======================================================================================================================================================
Installing:
 gcc                                    x86_64                          4.8.2-7.fc19                           updates                           16 M
Installing for dependencies:
 cpp                                    x86_64                          4.8.2-7.fc19                           updates                          5.9 M
 glibc-devel                            x86_64                          2.17-20.fc19                           updates                          1.0 M
 glibc-headers                          x86_64                          2.17-20.fc19                           updates                          645 k
 libmpc                                 x86_64                          1.0.1-1.fc19                           fedora                            49 k

Transaction Summary
======================================================================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 24 M
Installed size: 55 M
Downloading packages:
cpp-4.8.2-7.fc19.x86_64.rpm    FAILED                                                                               ]  43 kB/s | 251 kB  00:09:16 ETA 
http://mirror.nus.edu.sg/fedora/linux/updates/19/x86_64/cpp-4.8.2-7.fc19.x86_64.rpm: [Errno 14] HTTP Error 403 - ForbiddenkB/s | 251 kB  00:09:16 ETA 
Trying other mirror.
glibc-headers-2.17-20.fc19.x86 FAILED                                                                               ]  49 kB/s | 330 kB  00:08:02 ETA 
http://mirror.nus.edu.sg/fedora/linux/updates/19/x86_64/glibc-headers-2.17-20.fc19.x86_64.rpm: [Errno 14] HTTP Error 403 - Forbidden kB  00:08:02 ETA 
Trying other mirror.
(1/5): libmpc-1.0.1-1.fc19.x86_64.rpm                                                                                          |  49 kB  00:00:07     
(2/5): glibc-devel-2.17-20.fc19.x86_64.rpm                                                                                     | 1.0 MB  00:00:13     
(3/5): cpp-4.8.2-7.fc19.x86_64.rpm                                                                                             | 5.9 MB  00:00:30     
(4/5): glibc-headers-2.17-20.fc19.x86_64.rpm                                                                                   | 645 kB  00:00:30     
(5/5): gcc-4.8.2-7.fc19.x86_64.rpm                                                                                             |  16 MB  00:03:45     
------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                 107 kB/s |  24 MB  00:03:45     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libmpc-1.0.1-1.fc19.x86_64                                                                                                         1/5 
  Installing : cpp-4.8.2-7.fc19.x86_64                                                                                                            2/5 
  Installing : glibc-headers-2.17-20.fc19.x86_64                                                                                                  3/5 
  Installing : glibc-devel-2.17-20.fc19.x86_64                                                                                                    4/5 
  Installing : gcc-4.8.2-7.fc19.x86_64                                                                                                            5/5 
  Verifying  : cpp-4.8.2-7.fc19.x86_64                                                                                                            1/5 
  Verifying  : glibc-headers-2.17-20.fc19.x86_64                                                                                                  2/5 
  Verifying  : glibc-devel-2.17-20.fc19.x86_64                                                                                                    3/5 
  Verifying  : gcc-4.8.2-7.fc19.x86_64                                                                                                            4/5 
  Verifying  : libmpc-1.0.1-1.fc19.x86_64                                                                                                         5/5 

Installed:
  gcc.x86_64 0:4.8.2-7.fc19                                                                                                                           

Dependency Installed:
  cpp.x86_64 0:4.8.2-7.fc19       glibc-devel.x86_64 0:2.17-20.fc19       glibc-headers.x86_64 0:2.17-20.fc19       libmpc.x86_64 0:1.0.1-1.fc19      

Complete!

install gcc-c++工具

[root@localhost Jorcen]# yum -y install gcc-c++
Loaded plugins: fastestmirror, langpacks, refresh-packagekit
Loading mirror speeds from cached hostfile
 * fedora: mirrors.yun-idc.com
 * livna: ftp-stud.fht-esslingen.de
 * rpmfusion-free: mirror.bjtu.edu.cn
 * rpmfusion-free-updates: mirror.bjtu.edu.cn
 * rpmfusion-nonfree: mirror.bjtu.edu.cn
 * rpmfusion-nonfree-updates: mirror.bjtu.edu.cn
 * updates: mirrors.yun-idc.com
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.x86_64 0:4.8.2-7.fc19 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.2-7.fc19 for package: gcc-c++-4.8.2-7.fc19.x86_64
--> Running transaction check
---> Package libstdc++-devel.x86_64 0:4.8.2-7.fc19 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================================
 Package                                 Arch                           Version                                 Repository                       Size
======================================================================================================================================================
Installing:
 gcc-c++                                 x86_64                         4.8.2-7.fc19                            updates                         7.1 M
Installing for dependencies:
 libstdc++-devel                         x86_64                         4.8.2-7.fc19                            updates                         1.5 M

Transaction Summary
======================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 8.6 M
Installed size: 24 M
Downloading packages:
(1/2): libstdc++-devel-4.8.2-7.fc19.x86_64.rpm                                                                                 | 1.5 MB  00:00:14     
(2/2): gcc-c++-4.8.2-7.fc19.x86_64.rpm                                                                                         | 7.1 MB  00:01:02     
------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                 140 kB/s | 8.6 MB  00:01:02     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libstdc++-devel-4.8.2-7.fc19.x86_64                                                                                                1/2 
  Installing : gcc-c++-4.8.2-7.fc19.x86_64                                                                                                        2/2 
  Verifying  : libstdc++-devel-4.8.2-7.fc19.x86_64                                                                                                1/2 
  Verifying  : gcc-c++-4.8.2-7.fc19.x86_64                                                                                                        2/2 

Installed:
  gcc-c++.x86_64 0:4.8.2-7.fc19                                                                                                                       

Dependency Installed:
  libstdc++-devel.x86_64 0:4.8.2-7.fc19                                                                                                               

Complete!

 

 

 

 

other 開發工具

yum -y install gcc
yum -y install gcc-c++ 
yum install make

-- 或者
yum groupinstall "Development Tools"

-- 或者
yum install gcc gcc-c++ kernel-devel
相關文章
相關標籤/搜索