Centos安装gcc
方法1: yum install gcc
方法2:上不了网的情况下,使用本地的iso文件
a. ftp上传iso安装文件到/usr/local/src下
b. 新建 /media/CentOS, 挂载iso文件到/media/CentOS
mount -t iso9660 -o loop /usr/local/src/CentOS-7-x86_64-DVD-1511.iso /media/CentOS
c. 设置开机自动挂载系统镜像文件
vim /etc/fstab添加
/usr/local/src/CentOS-7.0-1406-x86_64-DVD.iso /media/CentOS/ iso9660 defaults,ro,loop 0 0
:x #保存并退出
mount -l
d. 备份/etc/yum.repos.d/CentOS-Base.repo文件,新建CentOS-Base.repo文件
[root@localhost yum.repos.d]# cp CentOS-Base.repo CentOS-Base.repo.bak
[root@localhost yum.repos.d]# vi CentOS-Base.repo
[centos7]
name=CentOS-$releasever - centos7
baseurl=file:///media/CentOS
gpgcheck=0
enabled=1
e. 安装gcc
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum install gcc