11

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

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:

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

6
  • Have you installed the CentOS package that contains gcc? If not, install that, it should fix the problem you're seeing. Oct 7, 2012 at 16:16
  • 2
    Did you really run yum install zlib-devel wget openssl-devel pcre pcre-devel make gcc gcc-c++ curl-devel?
    – Petr
    Oct 7, 2012 at 16:18
  • Yes I installed the gcc package and ran yum install zlib-devel wget openssl-devel pcre pcre-devel make gcc gcc-c++ curl-devel Oct 7, 2012 at 16:29
  • Look I ran gcc -vand got Using built-in specs. Target: x86_64-redhat-linux gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) Oct 7, 2012 at 16:30
  • @EduardoLeal: There is a remote possibility that the configure script is checking some location for existence of gcc while it is installed at some other location. For example: /usr/bin vs /usr/local/bin. This may be an issue of incompatibility between the packages vs the OS version. Oct 7, 2012 at 20:38

6 Answers 6

14

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

sudo apt-get install linux-kernel-headers
sudo apt-get install build-essential
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.

mount -o remount,rw,exec,nosuid /tmp
2
  • That worked. However, redmine doesn't seem to be working since I get an 403 forbidden error. In nginx logs I found nginx: [emerg] unknown directive "passenger_enabled" in /etc/nginx/sites-enabled/site:33
    – MacMac
    Nov 2, 2012 at 14:25
  • That sounds like you didn't install Nginx with the passenger module. You can do nginx -V list the compiled flags. Make sure passenger is listed there. Also make sure passenger_enabled on; is listed inside the server block.
    – excid3
    Nov 3, 2012 at 21:40
8

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

yum install gcc

1
  • 1
    Got the same problem on Amazon Linux AMI and this worked!
    – Sashi
    Jan 3, 2019 at 9:53
6

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

 sudo

and it worked like charm

4

Be sure that you sudo, if applicable.

Example:

sudo ./configure ...
1

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.

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

[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”.

Finally execute yum install nginx

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.