linux无法安装服务,Linux RedHat无法安装软件问题(No package gcc available. Nothing to do)...

在一个新的RedHat Linux服务器上安装nginx的时候,命令都不能解析,缺少gcc编辑器,安装gcc的命令也出错。

[root@localhost ~]# yum -y install gcc

Loaded plugins: katello, product-id, security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

Setting up Install Process

No package gcc available.

Nothing todo

没有gcc的软件包的,

最终找到一个解决办法

检查版本:

[root@localhost ~]# cat /etc/issue

Red Hat Enterprise Linux Server release5.7(Tikanga)

Kernel \r on an \m

解决过程:

1.下载163安装源

[root@localhost~]# wget http://mirrors.163.com/.help/CentOS5-Base-163.repo

--2015-10-09 14:33:10-- http://mirrors.163.com/.help/CentOS5-Base-163.repo

Resolving mirrors.163.com... 123.58.173.186,123.58.173.185Connecting to mirrors.163.com|123.58.173.186|:80...connected.

HTTP request sent, awaiting response...200OK

Length:2341 (2.3K) [application/octet-stream]

Saving to: `CentOS5-Base-163.repo'

100%2,341 --.-K/s in0s2015-10-09 14:33:22 (108 MB/s) -`CentOS5-Base-163.repo'saved [2341/2341]

2.修改repo文件(根据红帽版本)

[root@localhost~]# mv CentOS5-Base-163.repo /etc/yum.repos.d/

***把$releasever替换成5 (红帽6版本以上的改为6)

[root@localhost yum.repos.d]# sed-i 's#$releasever#5#g' ./CentOS5-Base-163.repo

3.清除原有缓存

[root@localhost yum.repos.d]# yum clean all

Loaded plugins: katello, product-id, security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

Cleaning up Everything

4.获取yum列表

[root@localhost yum.repos.d]# yum makecache

Loaded plugins: katello, product-id, security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

addons| 1.9 kB 00:00addons/filelists_db | 570 B 00:00addons/other_db | 554 B 00:00addons/primary_db | 1.1 kB 00:00

base | 1.1 kB 00:00

base/filelists | 3.7 MB 00:11

base/other | 14 MB 01:04

base/group | 1.1 MB 00:03

base/primary | 1.3 MB 00:06epel| 3.6 kB 00:00epel/filelists_db | 4.1 MB 00:16epel/updateinfo | 510 kB 00:02epel/other_db | 1.6 MB 00:05epel/primary_db | 2.9 MB 00:14extras| 2.1 kB 00:00extras/filelists_db | 224 kB 00:00extras/other_db | 442 kB 00:01extras/group | 9.7 kB 00:00extras/primary_db | 173 kB 00:00updates| 1.9 kB 00:00updates/filelists_db | 2.1 MB 00:09updates/other_db | 11 MB 00:29updates/primary_db | 531 kB 00:00

base 3667/3667

base 3667/3667

base 3667/3667Metadata Cache Created

5.搜索安装

[root@localhost ~]# yum search gcc |grep --color '^gcc'gcc.x86_64 : Various compilers (C, C++, Objective-C, Java, ...)

gcc-c++.x86_64 : C++ support forGCC

gcc-gfortran.x86_64 : Fortran 95support

gcc-gnat.x86_64 : Ada 95 support forGCC

gcc-java.x86_64 : Java support forGCC

gcc-objc++.x86_64 : Objective-C++ support forGCC

gcc-objc.x86_64 : Objective-C support forGCC

gcc44.x86_64 : GNU Compiler Collection version4.4gcc44-c++.x86_64 : C++ support for GCC version 4.4gcc44-gfortran.x86_64 : Fortran support for GCC 4.4

6.安装gcc

[root@localhost yum.repos.d]# yum -y install gcc

至此gcc安装完成。

但是当我安装pcre-8.39 执行./configure的时候出现错误

configure: error: You need a C++ compiler for C++ support

解决办法:

yum install -y gcc gcc-c++

0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值