Fresh install of RVM in Ubuntu isn't letting me install gems (zlib error)
Ok, I just created a fresh Ubuntu 11.04 install on Windows 7 using VirtualBox (not sure if this matters or not but just an fyi)
listing my rubies I get:
aaron@aaron-VirtualBox:~$ rvm list
rvm rubies
=> ruby-1.9.2-p290 [ x86_64 ]
but then trying to install the rails gem I get this:
aaron@aaron-VirtualBox:~$ gem install rails
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
aaron@aaron-VirtualBox:~$
What am I doing wrong?
Edit:
After doing what Dylan said my output (to prove those libraries are now installed):aaron@aaron-VirtualBox:~$ sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
[sudo] password for aaron:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'libxslt1-dev' instead of 'libxslt-dev'
Note, selecting 'libncurses5-dev' instead of 'ncurses-dev'
autoconf is already the newest version.
bison is already the newest version.
build-essential is already the newest version.
git-core is already the newest version.
libc6-dev is already the newest version.
libncurses5-dev is already the newest version.
libreadline6 is already the newest version.
libreadline6-dev is already the newest version.
libsqlite3-0 is already the newest version.
libsqlite3-dev is already the newest version.
libssl-dev is already the newest version.
libxslt1-dev is already the newest version.
libyaml-dev is already the newest version.
openssl is already the newest version.
sqlite3 is already the newest version.
zlib1g is already the newest version.
zlib1g-dev is already the newest version.
curl is already the newest version.
libxml2-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
aaron@aaron-VirtualBox:~$ gem install rails
ERROR: Loading command: install (LoadError)
no such file to load -- zlib
ERROR: While executing gem ... (NameError)
uninitialize开发者_JS百科d constant Gem::Commands::InstallCommand
aaron@aaron-VirtualBox:~$
Run rvm notes
and make sure to use apt-get
to install the things RVM tells you to. It (something along the lines of zlib1g-devel
will be one of them).
For Ubuntu, it should be something like this:
/usr/bin/apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev
You might have to recompile your 1.9.2 afterwards (not 100% sure of that).
I found that we need to install package zlib after installing above packages(that rvm said).
So we need to do:
rvm pkg install zlib
After that, re-install ruby.
rvm reinstall 1.9.3
Run
gem install rails
It will successfully install rails.
If you trust RVM you can run the following two commands. This
rvm requirements run
rvm reinstall all --force
Then the gem install rails command should work.
The first step will install all the packages that are needed for RVM. You do not normally need all, but it beats trying to search package by package.
Most people miss this part of the RVM install
Finally, see if there are any dependency requirements for your operating system by running:
user$ rvm requirements
精彩评论