C编译器在安装passenger和nginx时没有发现gcc

时间:2022-07-28 06:59:26

I'm trying to install Passenger and Nginx on my VPS.

我试着在我的VPS上安装乘客和Nginx。

I followed these instructions and replaced all links of all sources to the current version.

我按照这些说明,替换了所有源到当前版本的所有链接。

But when i ran the Phusion Passenger installer for Nginx, something with gcc compiler went wrong:

但是当我为Nginx运行Phusion Passenger安装程序时,gcc编译器出了问题:

Compiling and installing Nginx...
# sh ./configure --prefix='/opt/nginx' --with-http_ssl_module --with-http_gzip_static_module --with-cc-opt='-Wno-error' --add-module='/usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.17/ext/nginx'
checking for OS
 + Linux 2.6.32-220.el6.x86_64 x86_64
checking for C compiler ... not found

./configure: error: C compiler gcc is not found

What should I do?

我应该做什么?

OBS: My VPS works with CentOS 6.2 x64

我的VPS可以使用CentOS 6.2 x64

6 个解决方案

#1


9  

If you do have gcc installed, the problem stems from /tmp being mounted as noexec. The error doesn't exactly help, but if you remount /tmp as exec you can install passenger properly.

如果您确实安装了gcc,那么问题源于/tmp作为noexec挂载。这个错误并没有什么帮助,但是如果您重新安装/tmp作为exec,您可以正确地安装乘客。

mount -o remount,rw,exec,nosuid /tmp

#2


2  

Have the same problem and the following commands solve it; (on ubuntu server)

有相同的问题,以下命令解决;(ubuntu的服务器上)

sudo apt-get install linux-kernel-headers
sudo apt-get install build-essential

#3


2  

Got the same error. Just installed gcc and it started working:

有同样的错误。刚刚安装了gcc并开始工作:

yum install gcc

yum安装gcc

#4


2  

same problem here and I found out that I am not able to run command as root has to use

同样的问题,我发现我不能像root用户那样运行命令

 sudo

and it worked like charm

它就像魅力一样

#5


1  

Be sure that you sudo, if applicable.

如果可以的话,确保你有sudo。

Example:

例子:

sudo ./configure ...

#6


0  

One quick hack (I struggled a lot with it and finally install pre-built) is to install the pre-built package of Nginx rather than compiling it from source.

一个快速的hack(我和它做了很多的努力,最后安装了预置)是安装预构建的Nginx包,而不是从源代码编译它。

For RHEL/CentOS create the file named /etc/yum.repos.d/nginx.repo with the following contents:

对于RHEL/CentOS,创建名为/etc/yum.repos.d/nginx的文件。回购协议内容如下:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1

In above baseurl replace “OS” with “centos” and “OSRELEASE” with “6”.

在上面baseurl用“centos”和“OSRELEASE”替换为“6”。

Finally execute yum install nginx

最后执行yum安装nginx

Reference https://nginx.org/en/linux_packages.html#stable

参考https://nginx.org/en/linux_packages.html稳定

#1


9  

If you do have gcc installed, the problem stems from /tmp being mounted as noexec. The error doesn't exactly help, but if you remount /tmp as exec you can install passenger properly.

如果您确实安装了gcc,那么问题源于/tmp作为noexec挂载。这个错误并没有什么帮助,但是如果您重新安装/tmp作为exec,您可以正确地安装乘客。

mount -o remount,rw,exec,nosuid /tmp

#2


2  

Have the same problem and the following commands solve it; (on ubuntu server)

有相同的问题,以下命令解决;(ubuntu的服务器上)

sudo apt-get install linux-kernel-headers
sudo apt-get install build-essential

#3


2  

Got the same error. Just installed gcc and it started working:

有同样的错误。刚刚安装了gcc并开始工作:

yum install gcc

yum安装gcc

#4


2  

same problem here and I found out that I am not able to run command as root has to use

同样的问题,我发现我不能像root用户那样运行命令

 sudo

and it worked like charm

它就像魅力一样

#5


1  

Be sure that you sudo, if applicable.

如果可以的话,确保你有sudo。

Example:

例子:

sudo ./configure ...

#6


0  

One quick hack (I struggled a lot with it and finally install pre-built) is to install the pre-built package of Nginx rather than compiling it from source.

一个快速的hack(我和它做了很多的努力,最后安装了预置)是安装预构建的Nginx包,而不是从源代码编译它。

For RHEL/CentOS create the file named /etc/yum.repos.d/nginx.repo with the following contents:

对于RHEL/CentOS,创建名为/etc/yum.repos.d/nginx的文件。回购协议内容如下:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1

In above baseurl replace “OS” with “centos” and “OSRELEASE” with “6”.

在上面baseurl用“centos”和“OSRELEASE”替换为“6”。

Finally execute yum install nginx

最后执行yum安装nginx

Reference https://nginx.org/en/linux_packages.html#stable

参考https://nginx.org/en/linux_packages.html稳定