A Ruby on Rails problem at a Virtual Machine

93 views
Skip to first unread message

kai

unread,
Dec 1, 2011, 8:18:45 PM12/1/11
to ncl.rb
The shared-hoster I use do offer Rails feature, so I tried it out.
Interestingly, without SSH access, the terminal commands are done out
indirectly via cron, at a minute interval, with terminal outputs sent
over via email.

However the version of Rails installed was Rails2, so I spend the
weekend down-converting my Rails 3 app so it can work in a Rails 2
machine. Not an exercise one wants to do too often but it helps me
learn both flavours. Though the localhost (Windows) conversion was
successful, the deployment still need more cycles of unravelling.

Nevermind, I proceded to subscribe another service that have more
Rails & SSH support. They have Rails 3. Good. Then I, sort of, went
the long way round to install a VM. Apparently there's a Bitnami
download that has full-stack Ruby on Rails LAMP on Ubuntu as an VMware
image! I am quite impress that it didn't take much effort to get this
working in a VMware Player on Windows. It's quite cool in simulating
what I need to do online but all within my local machine. Though I
remember things had worked at one time, (showing "You're riding Ruby
on Rails" screen etc), I am now rather stuck in a loop which pumps
this error message:

/opt/bitnami/ruby/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:
552:in `rescue in block in build_extensions': ERROR: Failed to build
gem native extension. (Gem::Installer::ExtensionBuildError)
/opt/bitnami/ruby/bin/ruby extconf.rb
creating Makefile
make
sh: make: not found

I wonder if anyone can suggest what I can do to fix this error (I've
tried all sorts of things inc reinstalling the image a few times and
permutating the updates).

Howevevr for now, I feel familiar enough with what to do via terminal
access to see if I could have better luck with the online hosting
machine that I expect has been set up properly by Rails experts.

Cheers

Kai

Phil Lee

unread,
Dec 2, 2011, 2:02:59 AM12/2/11
to ncl.rb
sudo apt-get install gcc build-essential
then try running the installer again

its trying to compile stuff except youre missing a compiler

David Jeffrey

unread,
Dec 2, 2011, 1:46:13 AM12/2/11
to ncl...@googlegroups.com

Looks like the image is missing buildtools/GCC. 'sudo apt-get install buildtools gcc' should get you somewhere, or Google for installing GCC. It'll be required for compiling native instructions.

--
================
 -- ncl.rb --
================
To post to this group, send email to ncl...@googlegroups.com
To unsubscribe from this group, send email to ncl-rb-un...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/ncl-rb?hl=en-GB

Jase

unread,
Dec 2, 2011, 6:03:35 AM12/2/11
to ncl...@googlegroups.com
Here's an extract / copy+paste of some of my Ubuntu install notes I keep
handy, you might find them useful if you are setting up an Ubuntu box
from scratch. If you are using Ubuntu or Linux in general for that
matter it is much better to know how to do things from scratch using the
native tools rather than use some 3rd party system. This is because the
package management in Ubuntu is about 10x more superior than the rather
non-standard Window's install process.

You should be able to copy and paste this line by line on a fresh Ubuntu
install to get a fully setup Ruby environment (and probably on Debian as
well, though I think some packages have different names). I've added
comments so you know what the different commands do.

# ---[ System update ]---

sudo apt-get update

sudo apt-get upgrade

# ---[ General Tools and Dependencies ]---

# General build tools and kernel headers (often handy because things
like VirtualBox guest additions, and similar tools like to compile
against the headers. build-essential contains GCC, make, and autoconf
which are needed for standard Linux compilations (i.e. ./configure &&
make && sudo make install)

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

# General tools, these are tools I use a lot, you might not use things
like iptraf, and if you've not used screen in Linux I suggest you learn
about it. It's very handy when you want to disconnect from an SSH
session but leave it running (or if you have a poor connection to SSH)

sudo apt-get install subversion unzip curl strace p7zip screen htop
iptraf git openssh-server bash-completion

# These are all the Ruby specific libraries you want to compile ruby
from scratch

sudo apt-get install libreadline-dev libyaml-dev autoconf bison ruby
zlib1g-dev libssl-dev libffi-dev libgdbm-dev

# ---[ Compiling Ruby ]---

# If Ruby isn't installed you might want to install Ruby 1.8 as the Ruby
compilation process needs a version of ruby to bootstrap the compile
process. I build my own Ruby because I often find the packages supplied
by distros are old and/or have bugs. However I tend to avoid manual
compilation in favour of using distro packages and/or rvm because it
gives you a clean uninstall process and unified way to manage installed
software.

sudo apt-get install ruby

# Build Ruby from scratch. You may also want to look at alternative
systems here, like RVM or rbenv. However knowing how to compile from
scratch is always handy. I've used 1.9.2 p290 as this works with most
things, as does 1.9.3.

cd ~

svn co http://svn.ruby-lang.org/repos/ruby/tags/v1_9_2_290/ ruby

cd ruby

autoconf

# Note under Debian we need to set the /usr path
./configure # --prefix=/usr/local --with-openssl-dir=/usr
--with-readline-dir=/usr --with-zlib-dir=/usr

make

# Remove the old version of ruby used for bootstrapping the compile
process, as our newly bade version is superior.

sudo apt-get remove ruby ruby1.8 libruby*

sudo make install

# ---[ Specific to certain commonly used Gems ]---

# Nokogiri

sudo apt-get install libxml2-dev libxslt-dev

gem install nokogiri

# RMagick

sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev

gem install rmagick

# Passenger with Nginx

sudo apt-get install apache2-prefork-dev libapr1-dev libaprutil1-dev
libcurl4-gnutls-dev

sudo apt-get install passenger

sudo passenger-install-nginx-module

# Other useful gems - You might not want all of these but most are used
a lot in the community and are worth looking at if you don't use them
already

gem install rails haml sass sass-rails therubyracer devise
inherited_resources simple_form rspec-rails pry

---------------

Just some pointers about Debian/Ubuntu. If you are compiling something
and it is missing a library, I suggest using http://packages.ubuntu.com
to find the package names of the missing libraries, you should then be
able to sudo apt-get install them and recompile.

If you are starting off with Linux, I suggest using VirtualBox (or
similar) to run a Virtual Machine. VirtualBox is good because you can
use the snapshot tool periodically to save the whole system state (be
warned, because the virtual harddisk images use copy-on-write semantics,
each having lots of snapshots stacked on top of each other will slow
down disc access as it adds extra looks ups and some disc/image
fragmentation). It's worth looking at the railscast screencast for
vagrant which uses VirtualBox to aid deployment to Ubuntu, and allows
you to share your Rails apps between the host and guest OS
transparently.

I haven't put MySQL instructions here as I use PostgreSQL. You should be
able to use apt-get install mysql-server though and the defaults will
probably be fine for you. You'll need to sudo apt-get install
libmysqlclient-dev before gem install mysql to ensure you have the C
headers and library files

If you are setting up a production server. Look at using iptables or
similar to setup a firewall. I have a iptables script that does a basic
job of blocking everything except SSH / PostgreSQL.

You can setup aliases, and add them to ~/.bashrc - This is very handy
for long commands you use a lot but tend to forgot or hate typing

My setup instructions for passenger are for Nginx. Using apache isn't
much different (sudo passenger-install-apache-module). It's down to a
matter of taste but I prefer nginx, as do a lot of people these days.
However if you still use PHP a bit, Apache might be better/easier

You might need to change the gem install commands to sudo gem install if
you want the gem to be accessible to all users (e.g. www-data user which
is used to spawn web processes)

Jase.

kai

unread,
Dec 2, 2011, 11:12:35 AM12/2/11
to ncl.rb
Much, Much thanks for tremendous clues & additional notes!! The issue
seem to have been solved now but, typically, I lost track of the exact
steps that made the impact.

Next problem turned up, but I remembered enough to make some notes. In
case anybody may be interested:
##____##____##
## DEBUG SYMPTON: "rails s" give error (on Rubystack Ubuntu VM)
## /opt/bitnami/ruby/lib/ruby/gems/1.9.1/gems/execjs-1.2.9/lib/execjs/
runtimes.rb:47:in `autodetect': Could not find a JavaScript runtime.
#1[]
sudo gem install execjs
#2[]
ruby -r execjs -e "p ExecJS.runtime.name" "JScript"
#3 Add to Gemfile
gem "therubyracer", :require => 'v8'
/* refs:
http://8elite.com/2011/09/instalacion-de-ruby-on-rails-en-linux/
http://forums.pragprog.com/forums/148/topics/9946
/**/

I now have to keep notes of the reference sources, as there can well
be mistakes in my own notes.

But things finally worked & my VM is servering up Ruby on Rails web
app for the network!!!

Cheers


Kai

Reply all
Reply to author
Forward
0 new messages