Installing rails on Ubuntu

Hello, I’m trying to install the rails on ubuntu 11.10, but when I put
the command

[email protected]:~/Downloads/rubygems-1.8.15$ sudo gem install rails
–no-r1 --no-rdoc
ERROR: Loading command: install (LoadError)
no such file to load – zlib
ERROR: While executing gem … (NameError)
uninitialized constant Gem::Commands::InstallCommand
[email protected]:~/Downloads/rubygems-1.8.15$

it return this error, how can I install correctly.

Thanks

On 21 January 2012 21:39, Felipe Pieretti U.
[email protected] wrote:

Hello, I’m trying to install the rails on ubuntu 11.10, but when I put
the command

[email protected]:~/Downloads/rubygems-1.8.15$ sudo gem install rails

The best way to install rails is to use rvm. See
http://beginrescueend.com/

Colin


Posted via http://www.ruby-forum.com/.


You received this message because you are subscribed to the Google G. “Ruby
on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


gplus.to/clanlaw

On Jan 21, 3:39pm, Felipe Pieretti U. [email protected]
wrote:

it return this error, how can I install correctly.

Have you installed:
apt-get install zlib1g zlib1g-dev

Also - in general, it is not a good idea to install gems using sudo.

CavalryJim wrote in post #1041969:

Also - in general, it is not a good idea to install gems using sudo.

CavalryJim, what is the best way to install ?

On Sat, Jan 21, 2012 at 10:39 PM, Felipe Pieretti U. <
[email protected]> wrote:

it return this error, how can I install correctly.

  1. The default first answer to these questions is, “use rvm” (really !).

https://rvm.beginrescueend.com/

E.g. for Ubuntu 11.10, I wrote a detailed log of doing it from scratch
(and there are many others if you Google):

http://rails.vandenabeele.com/blog/2011/11/26/installing-ruby-and-rails-with-rvm-on-ubuntu-11-dot-10/

Note that you will NOT need to do “sudo” with rvm, It is a local install
that you could alway wipe out and start over etc. if you are
experimenting …
(you could even make a separate “ror” user and do rvm there,
just to practice without risk.

  1. If you really want to install system with sudo , than the specific
    problem
    you face is probably that you miss a number -dev libraries.

Probably

$ sudo apt-get install zlib1g zlib1g-dev

will get you out of this one and then you will probably hit the next
error

(I recently installed on a different Ubuntu 11.10 without rvm, it was a
lot
harder and the write-up is here:
http://rails.vandenabeele.com/blog/2012/01/15/installing-ruby-rails-passenger-on-ubuntu-11-dot-10/
Not advised unless you are more experienced).

HTH,

Peter


Peter V.
http://twitter.com/peter_v
http://rails.vandenabeele.com

On Jan 21, 3:53pm, Felipe Pieretti U. [email protected]
wrote:

CavalryJim wrote in post #1041969:

Also - in general, it is not a good idea to install gems using sudo.

CavalryJim, what is the best way to install ?


Posted viahttp://www.ruby-forum.com/.

As Colin stated, a best practice for installing ruby is rvm.

For installing rails, use ‘gem install rails’

For all other gems, add the gem to your projects gemfile and run
‘bundle install’.

Ok, but, when I try with ‘gem install rails’

[email protected]:~$ gem install rails
ERROR: Loading command: install (LoadError)
no such file to load – zlib
ERROR: While executing gem … (NameError)
uninitialized constant Gem::Commands::InstallCommand
[email protected]:~$

some lib are missing, but I put the command

sudo apt-get install zlib1g zlib1g-dev

and was all updated

I’m following the tutorial, but when I try put the commando ‘rvm install
1.8.7’ shows

[email protected]:~$ rvm install 1.8.7
bash: /usr/bin/rvm: File or folder not found
[email protected]:~$

On Sat, Jan 21, 2012 at 11:30 PM, Felipe Pieretti U. <
[email protected]> wrote:

some lib are missing, but I put the command

sudo apt-get install zlib1g zlib1g-dev

and was all updated

From which source did you install your ruby and rubygems?
Where are they installed?

Could you run these commands and show the output please.

$ ruby -v

$ which ruby # if it is a symlink, follow it also

$ gem -v

$ which gem # if it is a symlink follow it also

$ echo $PATH

And again … even if you have started with manual install
of Ruby etc, you can still go to rvm (and inside rvm you
can use $ rvm system to go back to the system installed
ruby if you need to; I demonstrate that below).

As reference, on my system (rvm on Ubuntu 11.10):

[email protected]:~$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]
[email protected]:~$ which ruby
/home/peterv/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
[email protected]:~$ gem -v
1.8.10
[email protected]:~$ which gem
/home/peterv/.rvm/rubies/ruby-1.9.3-p0/bin/gem
[email protected]:~$ echo $PATH
/home/peterv/.rvm/gems/ruby-1.9.3-p0/bin:/home/peterv/.rvm/gems/[email protected]
/bin:/home/peterv/.rvm/rubies/ruby-1.9.3-p0/bin:/home/peterv/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

Falling back (what I normally never do anymore) to system ruby:

[email protected]:~$ rvm use system
Now using system ruby.
[email protected]:~$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
[email protected]:~$ which ruby
/usr/bin/ruby
[email protected]:~$ gem -v
1.3.7
[email protected]:~$ which gem
/usr/bin/gem
[email protected]:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/peterv/.rvm/bin

HTH,

Peter

On Sat, Jan 21, 2012 at 4:30 PM, Felipe Pieretti U. <
[email protected]> wrote:

some lib are missing, but I put the command

sudo apt-get install zlib1g zlib1g-dev

and was all updated

I have used Rails Ready in the past, and it made the setup rather easy.

https://github.com/joshfng/railsready

Jason

[email protected]:~/Downloads/rubygems-1.8.15$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
[email protected]:~/Downloads/rubygems-1.8.15$ which ruby
/usr/local/bin/ruby
[email protected]:~/Downloads/rubygems-1.8.15$ gem -v
1.8.15
[email protected]:~/Downloads/rubygems-1.8.15$ which gem
/usr/local/bin/gem
[email protected]:~/Downloads/rubygems-1.8.15$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games


[email protected]:~/Downloads/rubygems-1.8.15$ rvm use system
Now using system ruby.
[email protected]:~/Downloads/rubygems-1.8.15$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
[email protected]:~/Downloads/rubygems-1.8.15$ which ruby
/usr/local/bin/ruby
[email protected]:~/Downloads/rubygems-1.8.15$ gem -v
1.8.15
[email protected]:~/Downloads/rubygems-1.8.15$ which gem
/usr/local/bin/gem
[email protected]:~/Downloads/rubygems-1.8.15$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

Ok, I try, but, look what happen when I put rvm get stable

[email protected]:~$ rvm get stable
[email protected]:~$

nothing…

I’m brazilian, so, the language is portuguese, but I guess is easy to
know the error messages.

[email protected]:~$ rvm get stable
[email protected]:~$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
[email protected]:~$ which ruby
/usr/local/bin/ruby
[email protected]:~$ gem -v
1.8.15
[email protected]:~$ which gem
/usr/local/bin/gem
[email protected]:~$ echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
[email protected]:~$ rvm use 1.9.3 --default
WARN: ruby ruby-1.9.3 is not installed.
To install do: ‘rvm install ruby-1.9.3’
[email protected]:~$ rvm list

rvm rubies

[email protected]:~$ rvm gemset create first_app
mkdir: é impossível criar o diretório
“/usr/local/lib/ruby/gems/[email protected]_app”: Permissão negada
‘first_app’ gemset created (/usr/local/lib/ruby/gems/[email protected]_app).
[email protected]:~$ gem install rails
ERROR: Loading command: install (LoadError)
no such file to load – zlib
ERROR: While executing gem … (NameError)
uninitialized constant Gem::Commands::InstallCommand
[email protected]:~$ rails help
O programa ‘rails’ não está instalado no momento. Você pode instalá-lo
digitando:
sudo apt-get install rails
[email protected]:~$ rails new first_app -skip-bundle
O programa ‘rails’ não está instalado no momento. Você pode instalá-lo
digitando:
sudo apt-get install rails
[email protected]:~$ cd first_app
bash: cd: first_app: Arquivo ou diretório não encontrado
[email protected]:~$ echo “gem ‘therubyracer’” >> Gemfile
[email protected]:~$ bundle install
O programa ‘bundle’ não está instalado no momento. Você pode instalá-lo
digitando:
sudo apt-get install ruby-bundler
[email protected]:~$ rake environment
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb,
Rakefile.rb)
/usr/local/lib/ruby/1.9.1/rake.rb:2367:in raw_load_rakefile' /usr/local/lib/ruby/1.9.1/rake.rb:2007:inblock in load_rakefile’
/usr/local/lib/ruby/1.9.1/rake.rb:2058:in standard_exception_handling' /usr/local/lib/ruby/1.9.1/rake.rb:2006:inload_rakefile’
/usr/local/lib/ruby/1.9.1/rake.rb:1991:in run' /usr/local/bin/rake:31:in
[email protected]:~$

Thank’s

On Sat, Jan 21, 2012 at 11:55 PM, Felipe Pieretti U. <
[email protected]> wrote:

/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games


[email protected]:~/Downloads/rubygems-1.8.15$ rvm use system
Now using system ruby.

Ah, you actually do have rvm installed …

Did you already install some rubies ?

Anyway, this sequence should work then

[email protected]:~$ rvm get stable

Original installed RVM version:

rvm 1.10.2 by Wayne E. Seguin [email protected], Michal P. <
[email protected]> [https://rvm.beginrescueend.com/]

Downloading RVM from wayneeseguin branch stable
% Total % Received % Xferd Average Speed Time Time Time
Current
Dload Upload Total Spent Left
Speed
100 799k 100 799k 0 0 337k 0 0:00:02 0:00:02 --:–:--
677k

Upgrading the RVM installation in /home/peterv/.rvm/
RVM sourcing line found in: /home/peterv/.bashrc.

Upgrade Notes:

  • No new notes to display.

RVM: Shell scripts enabling management of multiple ruby environments.

RTFM: https://rvm.beginrescueend.com/

HELP: http://webchat.freenode.net/?channels=rvm (#rvm on

irc.freenode.net)

Screencast: http://screencasts.org/episodes/how-to-use-rvm

In case of any issues read output of ‘rvm requirements’ and/or 'rvm

notes’

Upgrade of RVM in /home/peterv/.rvm/ is complete.

Peter V.,

Thank you for using RVM!

I sincerely hope that RVM helps to make your life easier and more

enjoyable!!!

~Wayne

Installed RVM stable version:

rvm 1.10.2 by Wayne E. Seguin [email protected], Michal P. <
[email protected]> [https://rvm.beginrescueend.com/]

RVM reloaded!

[email protected]:~$ ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]

[email protected]:~$ which ruby
/home/peterv/.rvm/rubies/ruby-1.9.3-p0/bin/ruby

[email protected]:~$ gem -v
1.8.10

[email protected]:~$ which gem
/home/peterv/.rvm/rubies/ruby-1.9.3-p0/bin/gem

[email protected]:~$ echo $PATH
/home/peterv/.rvm/gems/ruby-1.9.3-p0/bin:/home/peterv/.rvm/gems/[email protected]
/bin:/home/peterv/.rvm/rubies/ruby-1.9.3-p0/bin:/home/peterv/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

[email protected]:~$ rvm use 1.9.3 --default
Using /home/peterv/.rvm/gems/ruby-1.9.3-p0

[email protected]:~$ rvm list

rvm rubies

jruby-1.6.4 [ i386 ]
jruby-1.6.5.1-d19 [ i386 ]
ruby-1.8.7-p352 [ i686 ]
ruby-1.9.2-head [ i686 ]
ruby-1.9.2-p290 [ i686 ]
ruby-1.9.3-head [ i686 ]
=* ruby-1.9.3-p0 [ i686 ]
ruby-1.9.3-rc1 [ i686 ]

=> - current

=* - current && default

* - default

rvm [email protected]:~$ rvm gemset create first_app
‘first_app’ gemset created
(/home/peterv/.rvm/gems/[email protected]_app).
[email protected]:~$ rvm use [email protected]_app
Using /home/peterv/.rvm/gems/ruby-1.9.3-p0 with gemset first_app
[email protected]:~$ gem list

*** LOCAL GEMS ***

bundler (1.0.21)
rake (0.9.2.2)

[email protected]:~$ gem install rails
Fetching: i18n-0.6.0.gem (100%)

Fetching: json-1.6.5.gem (100%)
Building native extensions. This could take a while…

Fetching: rdoc-3.12.gem (100%)
Depending on your version of ruby, you may need to install ruby rdoc/ri
data:

<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install

= 1.9.2 : nothing to do! Yay!
Fetching: railties-3.2.0.gem (100%)
Fetching: rails-3.2.0.gem (100%)
Successfully installed i18n-0.6.0

Successfully installed rails-3.2.0
29 gems installed

[email protected]:~$ rails help
Usage:
rails new APP_PATH [options]

[email protected]:~$ rails new first_app --skip-bundle
create
create README.rdoc

create vendor/plugins/.gitkeep

[email protected]:~$ cd first_app/

[email protected]:~/first_app$ echo “gem ‘therubyracer’” >> Gemfile

[email protected]:~/first_app$ bundle install
Fetching source index for https://rubygems.org/
Using rake (0.9.2.2)
Using i18n (0.6.0)
Using multi_json (1.0.4)
Using activesupport (3.2.0)
Using builder (3.0.0)
Using activemodel (3.2.0)
Using erubis (2.7.0)
Using journey (1.0.0)
Using rack (1.4.0)
Using rack-cache (1.1)
Using rack-test (0.6.1)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.1.2)
Using actionpack (3.2.0)
Using mime-types (1.17.2)
Using polyglot (0.3.3)
Using treetop (1.4.10)
Using mail (2.4.1)
Using actionmailer (3.2.0)
Using arel (3.0.0)
Using tzinfo (0.3.31)
Using activerecord (3.2.0)
Using activeresource (3.2.0)
Using bundler (1.0.21)
Installing coffee-script-source (1.2.0)
Installing execjs (1.3.0)
Installing coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.6.5)
Using rdoc (3.12)
Using thor (0.14.6)
Using railties (3.2.0)
Installing coffee-rails (3.2.1)
Installing jquery-rails (2.0.0)
Installing libv8 (3.3.10.4)
Using rails (3.2.0)
Installing sass (3.1.12)
Installing sass-rails (3.2.3)
Installing sqlite3 (1.3.5) with native extensions
Installing therubyracer (0.9.9) with native extensions
Installing uglifier (1.2.2)
Your bundle is complete! Use bundle show [gemname] to see where a
bundled
gem is installed.
[email protected]:~/first_app$ rake environment #This should not fail now
[email protected]:~/first_app$ # go on from here …

HTH,

Peter


Peter V.
http://twitter.com/peter_v
http://rails.vandenabeele.com

On Sun, Jan 22, 2012 at 1:09 AM, Felipe Pieretti U. <
[email protected]> wrote:

[email protected]:~$ rvm get stable

/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

[email protected]:~$ rvm use 1.9.3 --default
WARN: ruby ruby-1.9.3 is not installed.
To install do: ‘rvm install ruby-1.9.3’
[email protected]:~$ rvm list

rvm rubies

OK, since you do not have any rubies installed yet
(unlike my system), you should do here:

$ ruby list known # this will show all available rubies

pick one of them, best is ruby 1.9.3 to start

$ ruby install 1.9.3

sorry, I probably forgot to document that step, since the

rubies are already installed on my computer.

now all commands here after should work.

O programa ‘rails’ no est instalado no momento. Voc pode instal-lo
O programa ‘bundle’ no est instalado no momento. Voc pode instal-lo
/usr/local/lib/ruby/1.9.1/rake.rb:1991:in `run’
You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


Peter V.
http://twitter.com/peter_v
http://rails.vandenabeele.com
gsm: +32-478-27.40.69
e-mail: [email protected]

On Sun, Jan 22, 2012 at 1:27 AM, Peter V.
[email protected]wrote:

nothing…
1.8.15
rvm rubies
$ ruby install 1.9.3

That’s gibberish … sorry

$ rvm install ruby-1.9.3

Peter

$ ruby list known # this will show all available rubies

pick one of them, best is ruby 1.9.3 to start

[email protected]:~$ ruby list know
ruby: No such file or directory – list (LoadError)
[email protected]:~$

That’s gibberish … sorry

$ rvm install ruby-1.9.3

[email protected]:~$ rvm install ruby-1.9.3
Installing Ruby from source to: /usr/share/ruby-rvm/rubies/ruby-1.9.3,
this may take a while depending on your cpu(s)…

ruby-1.9.3 - #fetching
ruby-1.9.3 - #extracting ruby-1.9.3- to
/usr/share/ruby-rvm/src/ruby-1.9.3
ERROR: Error running ‘bunzip2 <
‘/usr/share/ruby-rvm/archives/ruby-1.9.3-.tar.bz2’ | tar xf - -C
/usr/share/ruby-rvm/tmp/rvm_src_2991’, please read
/usr/share/ruby-rvm/log/ruby-1.9.3/extract.log
ERROR: There has been an error while trying to extract the source.
Halting the installation.
ERROR: There has been an error fetching the ruby interpreter. Halting
the installation.
[email protected]:~$

I’m using Ubuntu 11.10, I was following, before your steps, this
tutorial:
http://blog.sudobits.com/2011/10/27/how-to-install-ruby-on-rails-in-ubuntu-11-10/

Thank for all the people that help me, I see another tutorial, and I was
having a huge mistake, I wasn’t restart the terminal, that was the
problem…

Thank’s again…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs