Installing OpenSSL on Ubuntu for Rails development? - ruby

I am running the latest RVM on Ubuntu 10.10 and I managed to get most of the development environment running, except for OpenSSL.
When I try to install the package I get the following error:
$ rvm package install openssl > error
ERROR: Error running 'tar zxf /home/ruby/.rvm/archives/openssl-0.9.8n.tar.gz -C
/home/ruby/.rvm/src', please read /home/ruby/.rvm/log/openssl/extract.log
ERROR: Error running './config -I/home/ruby/.rvm/usr/include -L/home/ruby/.rvm
/usr/lib
--prefix=/home/ruby/.rvm/usr zlib no-asm no-krb5 shared ', please read /home/ruby
/.rvm/log/openssl/configure.log
ERROR: Error running '/usr/bin/make ', please read /home/ruby/.rvm/log/openssl/make.log
ERROR: Error running '/usr/bin/make install', please read /home/ruby/.rvm/log/openssl
/make.install.log
It seems that the original downloaded file is corrupt when I get it via RVM. So, I downloaded and unpacked it to ~/.rvm/src/openssl0.9.8 and the first error is gone (error running tar zxf), but I still get the other ones.
Edit: my Ruby version, if anyone cares, is:
$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]

Did you run rvm requirements after installing RVM? It shows a list of all needed dependencies, and supplies the recommended "apt-get" command.
/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
This will install openssl and libssl-dev, both of which are required. I've installed RVM and Ruby many times on Ubuntu and always used RVM's recommended way without a problem.

Do you have libssl installed in Ubuntu?
sudo apt-get install libssl0.9.8
Also install the development package:
sudo apt-get install libssl-dev

Related

Conflicting packages on ubuntu

I was installing Sass on ubuntu for that I first installed Ruby and then Sass. but when i tried sass -v it gave a deprecated message about currently install ruby1.9 version saying it will not be support in future. so i tried upgrading ruby version to 2.0 (2.3 is not being installed on ubuntu) using
$ sudo apt-get install ruby2.0
But when checking the ruby version it still showed 1.9 so i tried with UN-installing Ruby1.9 then it showed a dependent library to uninstalled. I even did that but after that on installing ruby 2.0 again it gives error
the following packages have unmet dependencies:
libantlr3c-antlrdbg-3.2-0 : Conflicts: libantlr3c-3.2-0
E: Unable to correct problems, you have held broken packages.
How to solve this??
Basically you should install it directly from source, like so:
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev
libreadline6-dev libyaml-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p451.tar.gz
tar -xvzf ruby-2.0.0-p451.tar.gz
cd ruby-2.0.0-p451/
./configure --prefix=/usr/local
make
sudo make install
Solution found here.

RVM installed but not working?

I installed RVM on my Fedora 19 system a few months ago, and it was working fine. Then I had some other work and when I opened the machine again, it said:
# rvm
bash: rvm: command not found...
I tried to reinstall RVM, and this is what I get:
# rpm -i rvm-devel-1.17-8.fc19.x86_64.rpm
package rvm-devel-1.17-8.fc19.x86_64 is already installed
But I can't find it.
# ps ax | grep rvm
14363 pts/0 S+ 0:00 grep --color=auto rvm
Can anyone help me? What exactly is the problem?
P.S: The package rvm is there on the system.
# rpm -q rvm
rvm-1.17-8.fc19.x86_64
I recommend you to reinstall RVM, maybe it's crashed due to some event.
Use this command to implode it:
rvm implode
Or:
rm -rf ~/.rvm
Then install it by running:
sudo apt-get install curl
curl -L get.rvm.io | bash -s stable --auto
Then you'll need to reload the ~/.bash_profile file which you can do with this small command:
. ~/.bash_profile
Make sure to install other packages needed for Ruby to work:
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
sudo apt-get install pkgconfig
Now install the latest Ruby:
rvm install 2.0.0
rvm use 2.0.0
ruby -v
Now you can install Rails:
gem install rails -v 4.0.0
the package rvm-devel-1.17-8.fc19.x86_64 is not rvm as per http://rpm.pbone.net/index.php3/stat/4/idpl/20537074/dir/fedora_19/com/rvm-devel-1.17-8.fc19.x86_64.rpm.html it is:
The rvm-devel package contains libraries and header files for
developing applications that use rvm.
Follow installation instructions http://rvm.io/rvm/install to get RVM installed, make sure to read the outputs as important hints might be printed for you.
to uninstall rvm use anyone of the following:
rvm implode
or
rm -rf ~/.rvm
Just to be sure restart the terminal before you try installing rvm again

Error in ruby: cannot load such file -- zlib

When I try to install rails in Ubuntu 12.10 I get this error:
$ gem install rails
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
So I completely removed rvm:
rvm implode
sudo rm -rf ~/.rvm
removed the script calls in my .bashrc and .bash_profile
and checked if they're really removed:
env | grep rvm #no output, so rvm is removed
ruby -v #The program 'ruby' can be found in the following packages: blabla
I already have these via sudo apt-get install:
curl zlib1g-dev zlib1g libssl-dev build-essential openssl libreadline6 libreadline6-dev curl git-core libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
Then proceed to install from scratch
curl -L https://get.rvm.io | bash -s stable --ruby --auto-dotfiles
then run that line and restarted terminal regard to this message:
* To start using RVM you need to run `source /home/adige/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
Then rvm pkg install readline but completed with error:
...
Error running 'autoreconf -is --force', please read /home/adige/.rvm/log/readline/autoreconf.log
...
Please note that it's required to reinstall all rubies:
rvm reinstall all --force
I think it's installed anyway, right? Before reinstall all rubies, I installed zlib of course:
# w/out verify, it gives checksum error
rvm pkg install zlib --verify-downloads 1
Then run rvm reinstall all --force and completed with error again:
...
Install of ruby-1.9.3-p374 - #complete
Making gemset ruby-1.9.3-p374 pristine.
Error running '' under ,
please read /home/adige/.rvm/log/ruby-1.9.3-p374/gemset.pristine.log
Making gemset ruby-1.9.3-p374#global pristine.
gemset.pristine.log
Then reinstall ruby with zlib support:
rvm reinstall 1.9.3-p374 --with-zlib-dir=$rvm_path/usr
which returned same error and same log but completed anyway.
Finally I tried to install rails gem again but cannot load such file -- zlib !
Here is the rvm info
What am I doing wrong?
You should not install readline / zlib on ubuntu, follow this steps:
rvm get head
rvm pkg remove
rvm requirements run force
rvm reinstall 1.9.3-p374
make sure to include output of the installation process if this fails, also include all mentioned log files

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)
uninitialized 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

has anyone tried installing ruby & rubygems from source on Ubuntu (preferably Ubuntu 9)?

The Ruby on Rails website recommends installing Ruby from source under Linux.
I encountered a number of C library problems building ruby from source on a clean install of Ubuntu 9.
All the instructions I found on the net about installing ruby on Ubuntu have involved using the prepackaged (.deb-based) ruby. Clearly this isn't what the rails people recommend.
When I did a clean source build of ruby I found Rubygems failed to install because the zlib extension didn't work.
Two problems occur:
1) The zlib extension isn't built.
Solution:
i) ensure zlib is uncommented in the Setup file within the extn directory of the ruby source, and
ii) ensure these zlib ubuntu packages are installed:
aptitude install zlib1g
aptitude install zlib1g-dbg
aptitude install zlib1g-dev
aptitude install zlibc
2) After fixing Problem 1 above (and doing a clean rebuild of ruby), zlib still doesn't work because the extension fails to load.
You can see that the module fails to load by running this and getting the output "false":
puts require 'zlib'
I observed this happens to any number of other C extensions in the extn directory, so it appears to be a more general problem with these extensions than just something zlib-specific.
To summarize:
My build of ruby finds the ruby-specific C zlib extension but it fails to load the zlib module.
This behaviour appears to happen to other extensions in /extn.
Is there a way I can find out why a module fails to load? some kind of trace/verbose mode?
Here is what I did to install ruby, gems and rails on Ubuntu 11.04
Install ruby from sources
Install RubyGems from sources
Install zlib:
sudo apt-get install zlib1g-dev
cd your-ruby-sources/ext/zlib
ruby extconf.rb
make
sudo make install
Install readline:
sudo apt-get install libreadline5-dev
cd your-ruby-sources/ext/readline
ruby extconf.rb
make
sudo make install
Install openssl:
sudo apt-get install libssl-dev
cd your-ruby-sources/ext/openssl
ruby extconf.rb
make
sudo make install
I don't see what your problem is. You say that require 'zlib' returns false. But that means that it did work! If there were an error, you would get a LoadError exception.
Did you install libzlib-ruby? Here's my typical Ubuntu initialization before installing Rubygems:
$ apt-get update
$ apt-get dist-upgrade
$ apt-get install build-essential -y
$ apt-get install rsync -y
$ apt-get install ruby ri rdoc irb ri1.8 ruby1.8-dev libzlib-ruby zlib1g libopenssl-ruby -y

Resources