Red Hat Enterprise Linux Server release 7.1 (Maipo) 安装gcc 的几种方式
来源:互联网 发布:阿里云 更改ssh端口 编辑:程序博客网 时间:2024/05/18 20:47
[root@localhost local]# gccbash: gcc: command not found...
查看系统版本:
[root@localhost ~]# cat /proc/versionLinux version 3.10.0-229.el7.x86_64 (mockbuild@x86-035.build.eng.bos.redhat.com) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-7) (GCC) ) #1 SMP Thu Jan 29 18:37:38 EST 2015
[root@localhost ~]# cat /etc/redhat-releaseRed Hat Enterprise Linux Server release 7.1 (Maipo)red hat中yum需要付费
[root@localhost local]# yum install gccLoaded plugins: langpacks, product-id, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
主要有两种方式解决此问题:
一、通过yum安装,第一种通过替换成CentOS的yum,然后直接 yum install gcc 安装;
第二种通过本地镜像文件来装,用iso做一个yum库(无法联网时的办法)。
二、直接安装gcc,第一种通过rpm安装(依赖包挺多的,很繁琐);第二种通过gcc压缩包安装。
此处只叙述了本人成功的一种方式,其他方式可以搜一下,有很多文章进行了叙述。
1、安装yum,替换成CentOS中的yum,通过yum install gcc安装,通过此方式要确定服务器能上网
a. 备份原 yum
mv /etc/yum.repos.d/redhat.repo /etc/yum.repos.d/redhat.repo.backup
b. 删除red hat yum源
rpm -qa | grep yum | xargs rpm -e --nodeps
c. 下载新的yum包,因为是red hat 7 安装CentOS 7 版本的yum源,版本一定要对应,可避免不少麻烦
去http://mirrors.163.com/centos/7/os/x86_64/Packages/下载如下文件
下载:yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-3.4.3-154.el7.centos.noarch.rpm
yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm
python-iniparse-0.4-9.el7.noarch.rpm
或者命令下载直接:
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpmwget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpmwget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpmwget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpmd. 安装新的yum包
rpm -ivh python-iniparse-0.4-9.el7.noarch.rpmrpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpmrpm -ivh yum-3.4.3-154.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm安装后可通过命令查看:
[root@localhost ~]# rpm -qa |grep yum yum-plugin-fastestmirror-1.1.31-42.el7.noarchyum-3.4.3-154.el7.centos.noarchyum-metadata-parser-1.1.4-10.el7.x86_64
如果报错缺少包,可以将包名复制到http://mirrors.163.com/centos/7/os/x86_64/Packages/ 下去找对应的包,并下载安装。
如:可能会缺少python-urlgrabber这个包,就先下载安装这个包。
e. 将CentOS的yum源更新到red hat中
下载地址:http://mirrors.163.com/.help/CentOS6-Base-163.repo
将repo文件移动到 /etc/yum.repos.d/下,并编辑 (把版本号换成7就行)
[root@localhost ~]# mv CentOS6-Base-163.repo /etc/yum.repos.d/[root@localhost ~]# vi CentOS6-Base-163.repo
# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client. You should use this for CentOS updates# unless you are manually picking other mirrors.## If the mirrorlist= does not work for you, as a fall back you can try the# remarked out baseurl= line instead.##[base]name=CentOS-7-Base#mirrorlist=http://mirrorlist.centos.org/?release=$releasever6&arch=$basearch&repo=os#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/baseurl=http://ftp.sjtu.edu.cn/centos/7/os/$basearch/gpgcheck=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#released updates[update]name=CentOS-7-Updates#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updatesbaseurl=http://ftp.sjtu.edu.cn/centos/7/updates/$basearch/gpgcheck=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#packages used/produced in the build but not released[extras]name=CentOS-7-Extras#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extrasbaseurl=http://ftp.sjtu.edu.cn/centos/7/extras/$basearch/gpgcheck=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages[centosplus]name=CentOS-7-Plus#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplusbaseurl=http://ftp.sjtu.edu.cn/centos/7/centosplus/$basearch/gpgcheck=0enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-7-Contrib#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contribbaseurl=http://ftp.sjtu.edu.cn/centos/7/contrib/$basearch/gpgcheck=0enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
如果后面有报找不到key的问题,可以下载对应的key,然后将gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
指定成本地文件gpgkey=file:///usr/local/yum/RPM-GPG-KEY-CentOS-6
f. 清理yum缓存
[root@localhost ~]# yum clean all[root@localhost ~]# yum makecache
g. 就可以安装测试啦!
yum install gcc
- Red Hat Enterprise Linux Server release 7.1 (Maipo) 安装gcc 的几种方式
- Git在Red Hat Enterprise Linux Server release 5.1上的安装(android源码下载必备工具)
- Red Hat Enterprise Linux Server release 5.6 安装 MongoDB 2.6.4
- Red Hat Enterprise Linux Server release 6.4 x64 安装 yum 源
- Red Hat Enterprise Linux AS release 4 安装YUM
- Red Hat Enterprise Linux 7 的安装
- [Red Hat Enterprise Linux5] RHL5安装gcc的一种方法
- Red Hat enterprise 5 gcc安装
- 【转】Red Hat Enterprise Linux Server release 6.5 安装yum 失败,依赖包,deltarpm = 3.5-0.5.20090913git.el6
- Red Hat Enterprise Linux Server 5.0 安装 非常适合新手
- 在 Red Hat Enterprise Linux Server安装桌面
- Red Hat Enterprise Linux Server 7.4 安装方法
- red hat linux Server Release 6.3 安装perl 5.10.1
- CUDA3.0-linux-32+Red Hat Enterprise Linux Server release 5.3环境配置
- Red Hat Enterprise Linux Server 7.1 x86_64 下载
- SQL Server on Red Hat Enterprise Linux
- Red Hat Enterprise Linux Server release 5.5 (Tikanga) 逻辑卷 在线扩展
- Red Hat Enterprise Linux Server release 6.0 --YUM 创库配置
- 笨方法习题43中的游戏场景切换方法记录
- MAC使用brew搭建nginx、php、mysql环境
- Rocketmq分布式事物消息
- Hello Solr
- 喂饱40亿城市人口,孙正义带火了垂直农场 | 特写
- Red Hat Enterprise Linux Server release 7.1 (Maipo) 安装gcc 的几种方式
- (推荐)Swift入门级免费视频
- oracle数据库密码有效期设置为无限制
- AMD-SDK的学习[3]--BasicDebug
- Lucene笔记总结(代码篇)
- iOS 图片加载框架SDWebImage详解
- Java反射机制(学习笔记)
- 修改本机域名localhost为任意你想要的名称
- 下面是20个非常有用的Java程序片段,希望能对你有用。