Skip to content

Instantly share code, notes, and snippets.

@leommoore
Created March 22, 2012 23:42
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leommoore/2165523 to your computer and use it in GitHub Desktop.
Save leommoore/2165523 to your computer and use it in GitHub Desktop.
Install Rails on AWS Linux AMI instance
http://definenull.com/content/how-install-ruby-and-rails-amazon-ec2-server
To install Ruby and Rails on your Amazon EC2 server there are a few steps you need to follow, but none of them quite hard. By default ruby is already installed on your server by Amazon - check it by running $ ruby -v.
$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-linux]
For this tutorial I will not be using the Ruby Version Manager - RVM. It has the power to make it easier later to change ruby versions in a contained environment.
Download the RubyGems from RubyForge. The latest version at the moment is 1.8.11.
$ wget http://rubyforge.org/frs/download.php/75475/rubygems-1.8.11.tgz
Untar the file and switch to the rubygems folder.
$ tar -xzf rubygems-1.8.11.tgz
$ cd rubygems-1.8.11
Now run the installation command for the RubyGems.
$ sudo ruby setup.rb
Test the installation.
$ gem -v
1.8.11
Install the ruby developer packages and the make command.
$ sudo yum install ruby-devel
$ sudo yum install make
$ sudo yum install ruby-irb
Now install rails. This step took much longer than I expected in my Amazon EC2 Server.
$ sudo gem install rails
@macmv
Copy link

macmv commented Dec 17, 2018

This doesn't work. I just get this:

`ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

current directory: /usr/local/share/gems/gems/nokogiri-1.8.5/ext/nokogiri

/usr/bin/ruby -r ./siteconf20181216-3848-1o2ru7e.rb extconf.rb
checking if the C compiler accepts ... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)
--help
--clean
/usr/share/ruby/mkmf.rb:457:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/share/ruby/mkmf.rb:572:in block in try_compile'
from /usr/share/ruby/mkmf.rb:523:in with_werror' from /usr/share/ruby/mkmf.rb:572:in try_compile'
from extconf.rb:138:in nokogiri_try_compile' from extconf.rb:162:in block in add_cflags'
from /usr/share/ruby/mkmf.rb:630:in with_cflags' from extconf.rb:161:in add_cflags'
from extconf.rb:410:in `

'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/usr/local/lib64/gems/ruby/nokogiri-1.8.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/nokogiri-1.8.5 for inspection.
Results logged to /usr/local/lib64/gems/ruby/nokogiri-1.8.5/gem_make.outTo see why this extension failed to compile, please check the mkmf.log which can be found here:

/usr/local/lib64/gems/ruby/nokogiri-1.8.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/nokogiri-1.8.5 for inspection.
Results logged to /usr/local/lib64/gems/ruby/nokogiri-1.8.5/gem_make.out`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment