Problem installing passenger with Nginx with rvm on linux - ruby-on-rails

Tried to install Passenger with Nginx (on EC2 Linux). I'm using ec2-user (instead of Root). Ruby 1.9.2 with RVM.
Passenger gem installs correctly.
But when I try:
passenger-install-nginx-module
I get:
Checking for required software...
* GNU C++ compiler... not found
* The 'make' tool... found at /usr/bin/make
* A download tool like 'wget' or 'curl'... found at /usr/bin/wget
* Ruby development headers... found
* OpenSSL support for Ruby... not found
* RubyGems... found
* Rake... found at /home/ec2-user/.rvm/wrappers/ruby-1.9.2-p180/rake
* rack... found
* Curl development headers with SSL support... not found
* OpenSSL development headers... not found
* Zlib development headers... not found
Although the above exist. for instance if I type:
$> gcc
$> gcc: no input files
Saw somewhere online that I can try using:
rvmsudo passenger-install-nginx-module
but I get a problem:
--------------------------------------------
Checking for required software...
* GNU C++ compiler... not found
* The 'make' tool... found at /usr/bin/make
* A download tool like 'wget' or 'curl'... found at /usr/bin/wget
* Ruby development headers... found
* OpenSSL support for Ruby... not found
* RubyGems... found
Unable to locate the RVM path. Your RVM installation is probably too old. Please update it with 'rvm update --head && rvm reload && rvm repair all'.
Any ideas?

you have to do this:
rvm remove 1.9.2
rvm pkg install openssl
rvm install 1.9.2 --with-openssl-dir=$HOME/.rvm/usr

Be sure that a compiler and all dependency libraries are present on the system before attempting to install Rubies and/or Passenger. You can obtain a list of recommended base dependencies for Ruby based applications by running the following command.
user$ rvm requirements
Install all dependencies listed for 'ruby' before attempting to install the interpreter?
The list varies by OS.
More information can be found on the RVM basics documentation page, https://rvm.io/rvm/basics/
~Wayne

Unable to locate the RVM path.
That could be a symptom of not adding:
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"
to your .bashrc (or profile or whatever). That can cause all kinds of weird problems.

Am using ruby-1.9.2-p180 with rvm.
cd ~/.rvm/src/ruby-1.9.2-p180/ext/openssl/
ruby extconf.rb
make
make install
passenger-install-gninx-module

gcc is the wrong executable, Passenger is looking for g++ . Install it with this:
sudo yum install gcc-c++
and passenger-install-nginx-module should stop complaining about gcc missing

Related

ERROR: Ruby install aborted due to missing extensions

On Mac Catalina OS, while installing Ruby with rbenv, I am getting this error.
Last 10 log lines:
The Ruby openssl extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Configure options used:
--prefix=/Users/dev/.rbenv/versions/2.5.8
--with-openssl-dir=/usr/local/opt/openssl#1.1
--enable-shared
--with-readline-dir=/usr/local/opt/readline
CC=clang
LDFLAGS=-L/Users/dev/.rbenv/versions/2.5.8/lib
CPPFLAGS=-I/Users/dev/.rbenv/versions/2.5.8/include
EDIT - I have attached the solution which I found and worked for me. I hope this helps others too.
The issue is with OpenSSL. Mac CommandLine Tools is coming with OpenSSL 1.1 whereas you need OpenSSL 1.0. This is the solution for it
$ brew install rbenv/tap/openssl#1.0
$ RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl#1.0)" rbenv install 2.5.8
This will install Ruby 2.5.8. Do not forget to set
rbenv global 2.5.8
to make it work

Setup RVM, Ruby on Mac OS X Sierra: Unable to require openssl

I've hit the problem of setup of RVM + Rubies on a new Mac laptop where after getting RVM installed plus Homebrew the install for Rails hits the error:
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
Background and Environment
Mac OS X 10.12.3. (Sierra)
Homebrew 1.1.8. with OpenSSL installed
RVM 1.28.0
Ruby 2.3.3 Rails (attempting to install the latest)
Environment variables (following OpenSSL crate fails compilation on Mac OS X 10.11) the following variables have been setup in the Shell environment
LDFLAGS = -L/usr/local/opt/openssl#1.1/lib
CPPFLAGS = -I/usr/local/opt/openssl#1.1/include
PKG_CONFIG_PATH = /usr/local/opt/openssl#1.1/lib/pkgconfig
Discoveries & Fault Diagnosis
Starting with a clean laptop I had followed the usual path of installing Homebrew, Xcode command line tools, MySQL (for rails dev), Git and then RVM. Even with the environment variables set and also uninstalling and rebuild of RVM, removing and re-adding OpenSSL within Homebrew, when trying to get Rails installed I'm greeted with the error:
ERROR: While executing gem ... (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources
The other item to note is that when installing RVM I made sure that RVM was aware of Homebrew:
rvm autolibs enable
ram autolibs homebrew
The output from the install of ruby-2.3.3 is below:
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/osx/10.12/x86_64/ruby-2.3.3.tar.bz2
Checking requirements for osx_brew.
Updating Homebrew...
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
ruby-2.3.3 - #configure
ruby-2.3.3 - #download
ruby-2.3.3 - #validate archive
ruby-2.3.3 - #extract
ruby-2.3.3 - #validate binary
Libraries missing for ruby-2.3.3: /Users/travis/.rvm/rubies/ruby-2.3.3/lib/libruby.2.3.0.dylib. Refer to your system manual for installing libraries
Mounting remote ruby failed with status 10, trying to compile.
Checking requirements for osx_brew.
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/grantsayer/.rvm/rubies/ruby-2.3.3, this may take a while depending on your cpu(s)...
ruby-2.3.3 - #downloading ruby-2.3.3, this may take a while depending on your connection...
ruby-2.3.3 - #extracting ruby-2.3.3 to /Users/grantsayer/.rvm/src/ruby-2.3.3
Next Steps
Currently I'm stuck - not been able to get past this step or validate through reviewing other postings to get a solution that works.
Well I found a solution to the problem previously described. The following steps outline how it was resolved.
CleanUp
Removed the installation of Homebrew via ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Removed the installation of RVM via rvm implode
Rebuild
Install Homebrew using ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
Do integrity check on Brew using brew upgrade followed by brew doctor
Install RVM (again!) using \curl -sSL https://get.rvm.io | bash -s stable
Ensure that RVM knows about homebrew through the autolibs option using rvm autolibs homebrew
Setup the environment variables so that we know where the openssl is installed:
export LDFLAGS=-L/usr/local/opt/openssl/lib
export CPPFLAGS=-I/usr/local/opt/openssl/include
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
Install ruby via rvm install 2.3.3 --autolibs=homebrew
Check that it Works
Check that the rvm space knows about the OpenSSL certificates using rvm osx-ssl-certs status all. Running this command produced the following output: Certificates for /usr/local/etc/openssl/cert.pem: Up to date.
Install rails via gem install rails
At the last step the installation succeeded and Rails was working (at last!)
If that doesn't work for another reader -
try this:
rvm get branch /bugfix/3923_set_osx_brew_openssl_compiler_config
rvm install 2.4.0
If that works for you, go to the rvm issue and tell the developer how much you appreciate his effort :)

The program 'gem' can be found in the following packages Windows Bash

I have installed Ruby via RVM on Windows Insider Build(Ubuntu Bash). RVM installed successfully and so did ruby.
I have also installed bundler with "gem install bundler". Updated few gems and stuff. But now it says on ruby -v
cooldudeabhi#ACERASPIRE:~$ ruby -v
The program 'ruby' can be found in the following packages:
* ruby
* ruby1.8
Try: sudo apt-get install <selected package>
cooldudeabhi#ACERASPIRE:~$ gem
The program 'gem' can be found in the following packages:
* ruby
* rubygems
Try: sudo apt-get install <selected package>
cooldudeabhi#ACERASPIRE:~$
I suspect its a PATH problem but I am not sure if it really is? If its a PATH problem I don't know what to set in bashrc files please tell that. Thanks
I have found similar question on stackoverflow but it doesn't help in case of Windows.
Also /usr/local/bin is empty that's strange
Add this line to your profile settings (.bashrc or .bash_profile)
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
answer referred from here

passenger-install-apache2-module is not working in ruby 2.0.0

I'm trying to execute passenger-install-apache2-module but it is not working.
My Command Results:
$ passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v4.0.24.
This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.
Here's what you can expect from the installation process:
1. The Apache 2 module will be installed for you.
2. You'll learn how to configure Apache.
3. You'll learn how to deploy a Ruby on Rails application.
Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.
Press Enter to continue, or Ctrl-C to abort.
--------------------------------------------
Checking for required software...
* Checking for C compiler...
Found: yes
Location: /usr/bin/gcc
* Checking for C++ compiler...
Found: yes
Location: /usr/bin/g++
* Checking for Curl development headers with SSL support...
Found: no
Error: Cannot find the `curl-config` command.
* Checking for OpenSSL development headers...
Found: yes
Location: /usr/include/openssl/ssl.h
* Checking for Zlib development headers...
Found: yes
Location: /usr/include/zlib.h
* Checking for Ruby development headers...
Found: yes
Location: /home/hemant/.rbenv/versions/2.0.0-p247/include/ruby-2.0.0/ruby.h
* Checking for OpenSSL support for Ruby...
Found: yes
* Checking for RubyGems...
Found: yes
* Checking for Rake (associated with /home/hemant/.rbenv/versions/2.0.0-p247/bin/ruby)...
Found: yes
Location: /home/hemant/.rbenv/versions/2.0.0-p247/bin/ruby /home/hemant/.rbenv/versions/2.0.0-p247/bin/rake
* Checking for rack...
Found: yes
* Checking for Apache 2...
Found: no
* Checking for Apache 2 development headers...
Found: no
* Checking for Apache Portable Runtime (APR) development headers...
Found: no
* Checking for Apache Portable Runtime Utility (APU) development headers...
Found: no
Some required software is not installed.
But don't worry, this installer will tell you how to install them.
Press Enter to continue, or Ctrl-C to abort.
--------------------------------------------
Installation instructions for required software
* To install Curl development headers with SSL support:
Please run apt-get install libcurl4-openssl-dev or libcurl4-gnutls-dev, whichever you prefer.
* To install Apache 2:
Please install it with apt-get install apache2-mpm-worker
* To install Apache 2 development headers:
Please install it with apt-get install apache2-threaded-dev
* To install Apache Portable Runtime (APR) development headers:
Please install it with apt-get install libapr1-dev
* To install Apache Portable Runtime Utility (APU) development headers:
Please install it with apt-get install libaprutil1-dev
If the aforementioned instructions didn't solve your problem, then please take
a look at the Users Guide:
/home/hemant/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/passenger-4.0.24/doc/Users guide Apache.html
http://www.modrails.com/documentation/Users%20guide%20Apache.html
And I tried to run apt-get install libcurl4-openssl-dev.
$ sudo apt-get install libcurl4-openssl-dev
[sudo] password for hemant:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
libcurl4-openssl-dev : Depends: libcurl3 (= 7.29.0-1ubuntu3.1) but 7.29.0-1ubuntu3.2 is to be installed
Depends: libldap2-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Here's my system versions.
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux]
$ gem -v
2.1.11
rvm -v
rvm 1.23.16 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
$ rails -v
Rails 4.0.1.rc4
$ bundle -v
Bundler version 1.3.5
Can anyone please help me on this matter? :(
Plus I'm having this problem! :(
$ require_relative '../spec_helper'
WARNING:root:could not open file '/etc/apt/sources.list.d/passenger.list'
require_relative: command not found
According to your log, it seems that Apache2 is not installed.
* Checking for Apache 2...
Found: no
If it is, could you provide its version ?

Installing Apache Passenger , Ruby Development Headers Not Found

I have a RoR app that needs to be hosted on Apache, so I have been trying to install Apache Passenger. When I run the following command:
sudo passenger-install-apache2-module
I get:
Checking for required software...
* GNU C++ compiler... found at /usr/bin/g++
* Curl development headers with SSL support... found
* OpenSSL development headers... found
* Zlib development headers... found
* Ruby development headers... not found
* OpenSSL support for Ruby... found
* RubyGems... found
* Rake... found at /usr/local/bin/rake
* rack... found
* Apache 2... found at /usr/sbin/apache2
* Apache 2 development headers... found at /usr/bin/apxs2
* Apache Portable Runtime (APR) development headers... found at /usr/bin/apr-1-config
* Apache Portable Runtime Utility (APU) development headers... found at /usr/bin/apu-1-config
So it asked me to run the following command:
sudo apt-get install ruby1.8-dev
and I have done this with the following result
Reading package lists... Done
Building dependency tree
Reading state information... Done
ruby1.8-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 40 not upgraded.
So when I run:
sudo passenger-install-apache2-module
I get the same result asking me to run:
sudo apt-get install ruby1.8-dev
If, like me, you are running the apt package ruby1.9.1 instead of 1.8 then install ruby1.9.1-dev instead
sudo apt-get install ruby1.9.1-dev
This worked for me. Hope it helps.
After installing the missing headers, go back to the beginning and recompile passenger:
gem install passenger
Try uninstalling ruby1.9 and installing ruby1.8 instead then reinstall the passenger gem. This worked for me.
First install packages:
for Ubuntu:
sudo apt-get install libcurl4-gnutls-dev
sudo apt-get install apache2-dev
for CentOS (good tutorial):
yum install curl-devel apache2-devel
After install gem:
gem install passenger
And successfully configurate it:
sudo passenger-install-apache2-module
I have found that with some Passenger requirements you need to log out of and then log back into the current user after you've installed them before passenger-install-apache2-module recognises the changed configuration.

Resources