linux下使用yum 安装gcc

 如果服务器是自己的,并且机器就在身边,那什么都不用说了,缺少gcc顶多就是重新放入安装盘,把开发工具包安装上。但是如果是租的服务器,托管服务方那帮人又搞不懂你说的啥子gcc,要安装gcc实在是太麻烦了。你得去找gcc相关的包,版本号还得必须对应上,否则不兼容。最近给一个朋友装gcc,着实头疼了一把。后来发现yum这个好东西,只需要执行一个命令,所有的烦恼都解除了。

      朋友的系统是CentOS 5 的,托管商没给安装gcc,于是使用如下两个命令就可把gcc,gcc-c++统统安装上:

      yum -y install gcc

      yum -y install gcc-c++

      yum会自动查找软件的相关依赖包,自动下载安装,全过程轻松愉快。特此记录一下。


如果/etc/yum.repos.d下的yum源没有配置,或者默认的比较少,那可以新加一个,如下: CentOS-Base.repo文件


[base]
name=CentOS-5 - Base
baseurl=http://centos.ustc.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#released updates
[update]
name=CentOS-5 - Updates
baseurl=http://centos.ustc.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-5 - Addons
baseurl=http://centos.ustc.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-5 - Extras
baseurl=http://centos.ustc.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
baseurl=http://centos.ustc.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
baseurl=http://centos.ustc.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#packages in testing
[testing]
name=CentOS-5 - Testing
baseurl=http://centos.ustc.edu.cn/centos/5/testing/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5


原文地址: http://blog.csdn.net/paulluo0739/article/details/4593884


你可能感兴趣的:(linux,学习历程)