Rails install fails on Ubuntu 10.10 - ruby-on-rails

I'm trying to install rails on Ubuntu 10.10, but get File not found: lib every time. Ruby and Rubygems have been installed correctly. I've seen this problem posted all over the web but no solutions work for me. I reinstalled rdoc and I still get the same result.
$ sudo gem install rails
...
Successfully installed rails-3.0.1
24 gems installed
...
Installing ri documentation for builder-2.1.2...
ERROR: While generating documentation for builder-2.1.2
... MESSAGE: Unhandled special: Special: type=17, text="<!-- HI -->"
... RDOC args: --ri --op /var/lib/gems/1.8/doc/builder-2.1.2/ri --title Builder -- Easy XML Building --main README --line-numbers --quiet lib CHANGES Rakefile README doc/releases/builder-1.2.4.rdoc doc/releases/builder-2.0.0.rdoc doc/releases/builder-2.1.1.rdoc --title builder-2.1.2 Documentation
(continuing with the rest of the installation)
...
Installing ri documentation for rails-3.0.1...
File not found: lib
$ rails -v
The program 'rails' is currently not installed. You can install it by typing:
sudo apt-get install rails

I wrote a detailed how-to guide on installing Ruby and Rails on Ubuntu 10.10 that will help you with this.
Guaranteed, or your money back!

You should avoid the packaged version of Ruby (i.e., avoid the version of Ruby that comes from apt-get install ruby). The Debian packaging system (which Ubuntu uses) conflicts with what Ruby expects.
Instead, you should install Ruby from source.
There's a nice tool called RVM to help you do this.
# Install prerequisites
$ sudo apt-get install git curl wget
# Download and install RVM
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-latest )
# Install RVM into your .bash_profile
$ cat >> ~/.bash_profile <<-PROFILE
> [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
> PROFILE
# Load RVM into the current shell
$ rvm reload
# Install prerequisites
$ rvm notes
$ 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
# Install Ruby
$ rvm install ruby-1.9.2-p180 # latest version as of now
$ rvm use ruby-1.9.2-p180 --default
# Check it
$ ruby -v
$ which ruby
$ gem install rails

Related

rails install - ERROR ... executing gem ... (OpenSSL::SSL::SSLError) SSL_connect ... read server hello A: wrong version number

I am very new to Linux (been living in MS world for many years). I thought I'd try something different, like ruby on rails under linux. Been trying to get a dev machine set up, and I must say, it's been quite overwhelming! Here is what I have done so far, and my current problem that I cannot figure out:
Installed Linux Mint 15 (was this a bad choice? the only reason I ask is all the difficulties I've had so far)
Ran the update manager and installed all updates.
Install git
sudo apt-get install git
Install rbenv
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
Install ruby-build as a rbenv plugin
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
Install opensssl (the ruby install fails if I don't do this)
sudo apt-get install libssl-dev
Install ruby
rbenv install 2.0.0-p247
Set my ruby version
rbenv global 2.0.0-p247
Install rails
gem install rails
This fails with
Fetching: i18n-0.6.5.gem (100%)
Successfully installed i18n-0.6.5
ERROR: While executing gem ... (OpenSSL::SSL::SSLError)
SSL_connect returned=1 errno=0 state=SSLv3 read server hello A: wrong version number
So apparently, there's still something not quite right with the ssl lib? Either that or I've taken a wrong step somewhere? Please help, thanks!
I am pretty new in linux world.
I was having exactly the same problem after following the same steps.
In my case it got solve just doing:
gem update --system
After that the rails installation gave me no prob.
Hope is just that!
I'm running rails 4 with ruby 2.0 on Linux Mint 15.
I did:
sudo apt-get install git
sudo apt-get install curl
curl -L https://get.rvm.io | bash -s stable --ruby
sudo apt-get install git-core
source ~/.rvm/scripts/rvm
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts /rvm-installer)
rvm autolibs enable
rvm reload
rvm requirements
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
rvm install ruby-2.0
curl -L https://get.rvm.io | bash -s stable --rails
and it worked for me. Maybe this helps

ruby 2.0 rails gem install error "cannot load such file -- openssl"

I am using osx 10.8.2 installed ruby 2.0 and....
got this when trying to run "sudo gem install rails"
$ sudo gem install rails
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
I had ruby 1.9.x and rails 3.2.x working alright before
You have to install OpenSSL first and recompile ruby again:
RVM:
rvm pkg install openssl
rvm reinstall ruby-2.0.0-p0 --with-gcc=gcc-4.7 --with-openssl-dir=$rvm_path/usr
If you're using RVM please follow:
$ brew install automake
$ rvm pkg install openssl
$ rvm requirements run
$ rvm reinstall all --force
$ gem install rails
It worked for me.
I had very bad time with this ERROR.
Finally i done with it. There is only Once solution either you are with RVM or without RVM.
Make sure you have installed OpenSSL first BEFORE installing ruby.
RVM
Uninstall rvm
rvm implode
or
rm -rf ~/.rvm
Don’t forget to remove the script calls in your .bashrc and/or .bash_profile (or whatever shell you’re using).
sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev curl git-core python-software-properties libpq-dev nodejs
Then install RVM, post ruby.
OR
rvm pkg install openssl
rvm reinstall ruby-2.0.0-p0 --with-gcc=gcc-4.7 --with-openssl-dir=$rvm_path/usr
WITHOUT RVM
First you should find where Ruby is:
whereis ruby
will list all the places where it exists on your system, then you can remove all them explicitly. Or you can use something like this:
rm -rf /usr/local/lib/ruby
rm -rf /usr/lib/ruby
rm -f /usr/local/bin/ruby
rm -f /usr/bin/ruby
rm -f /usr/local/bin/irb
rm -f /usr/bin/irb
rm -f /usr/local/bin/gem
rm -f /usr/bin/gem
THEN
sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev curl git-core python-software-properties libpq-dev nodejs
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar -xvzf ruby-2.0.0-p247.tar.gz
cd ruby-2.0.0-p247/
./configure --prefix=/usr/local
make
make install
I hope this help you.
I fix this error for ruby 2.1.2 as follow.
rvm pkg install openssl
rvm reinstall ruby-2.1.2 --with-openssl-dir=$rvm_path/usr
On OSX, with rbenv and homebrew, the following worked for me:
brew install openssl
CONFIGURE_OPTS=--with-openssl-dir=$(brew --prefix openssl) rbenv install whatever-ruby-version
This worked for me which is similar to some of the other answers already posted.
rvm pkg install openssl
rvm reinstall all --force
When installing ruby 2.0, it is possible that rubygems 2.0 installation did not complete ok, because of openssl.
Make sure you provide a valid path to the openssl config file; you could:
find . -type f -name "openssl.cnf"
path is usually $HOME/.rvm/usr or $HOME/.rvm/usr/ssl
Then
[sudo] rvm reinstall ruby-2.0.0-p0 --with-openssl-dir=[openssl.cnf path] --verify-downloads 1
Make sure rubygems installation complete successfully.
Might be a better way to fix that path without reinstalling, but this should do it.
Make sure to check out this page on the rvm site: https://rvm.io/packages/openssl/
Running
rvm requirements run
gave me:
Missing required packages: autoconf, automake, libtool, pkg-config, apple-gcc42, readline, libxml2, libxslt, libksba, openssl, sqlite
after brew install autoconf automake ...
I was able to rvm reinstall 2.0.0 without openssl errors
I had the same problem with the same OS version. I use rvm and followed the steps in this command:
$ rvm requirements
Following those instructions, I ran:
$ brew update
$ brew tap homebrew/dupes
$ brew install bash curl git
$ brew install autoconf automake apple-gcc42 libtool pkg-config openssl readline libyaml sqlite libxml2 libxslt libksba
I had the same problem earlier, tried all of the snippets about and none of them worked out. After looking around for a bit the following worked for me:
$ rvm remove 2.0.0 # get rid of unsuccessful installation
$ rvm get head --autolibs=3 # get the latest RVM and build required libs
$ rvm requirements # just in case, install all other required stuff
$ rvm install ruby-2.0.0
$ rvm --default use ruby-2.0.0
What does rvm get head --autolibs=3 do exactly? I'm guess it automatically downloads dependencies, but I was hoping for a clear answer.
I encountered the same openssl error on Fedora when trying to use gem install <package>. It seems you need to install additional packages with yum/dnf
sudo dnf install rubygems rubygem-bundler ruby-devel mariadb-devel
After running the above command, gem install <package> should now work.
just went through the same problem. Takes a bit time but, upgrading openssl with
brew upgrade openssl#1.1
worked for me. Version might be different in the future, type brew install openssl to see which version you can upgrade to. I hope it helps.
If you have libssl1.1, your problem may be that these older versions of ruby (2.4 is the cutoff) are only compatible with libssl1.0.
For debian/ubuntu, please ensure that apt-get install libssl1.0-dev succeeds.
If you are using ruby-install, it will take the same openssl argument as rvm:
ruby-install ruby-2.0.0-p247 -- --with-openssl-dir=/usr/local/opt/openssl

How do I install Ruby 1.9.3 on Ubuntu without RVM?

I want to install ruby 1.9.3 on Ubuntu without rvm
I run
sudo apt-get install ruby
It's taking ruby 1.8 and ruby 1.9.1.
And if I do
sudo apt-get install ruby 1.9.3 -p XXXX
I am still not able to install ruby. How can I install ruby on Ubuntu?
On Ubuntu 12.04 LTS, I got it to work with the following:
sudo apt-get install ruby 1.9.3
cd /etc/alternatives
sudo ln -sf /usr/bin/ruby1.9.3 ruby
Use the brightbox packages for 1.9.3. You will have to add their repo though but to keep it short here just use their help pages: http://blog.brightbox.co.uk/posts/next-generation-ruby-packages-for-ubuntu
1st approach
Source
http://lenni.info/blog/2012/05/installing-ruby-1-9-3-on-ubuntu-12-04-precise-pengolin/
The new Ubuntu release has just rolled around and with it a slew of new packages. Personally, I'm tracking the development of Ruby quite closely but the default Ruby on Ubuntu ist still the 1.8 series which I can't recommend. Ruby 1.9 has some performance improvements and 1.9.3 in particular a lot of them compared to 1.9.2.
However, as I have elaborated in a previous post getting the Ruby 1.9 series on Ubuntu without using RVM instead of 1.8 isn't all that easy. Please read the post if you are interested in the details.
The short version is: You can get Ruby 1.9.3-p0 by installing the ruby-1.9.1 package. (The package is called 1.9.1 because that is the ABI version.)
If you want to make Ruby 1.9 the default do the following:
sudo apt-get update
sudo apt-get install ruby1.9.1 ruby1.9.1-dev \
rubygems1.9.1 irb1.9.1 ri1.9.1 rdoc1.9.1 \ build-essential libopenssl-ruby1.9.1 libssl-dev zlib1g-dev
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby1.9.1 400 \
--slave /usr/share/man/man1/ruby.1.gz ruby.1.gz \
/usr/share/man/man1/ruby1.9.1.1.gz \
--slave /usr/bin/ri ri /usr/bin/ri1.9.1 \
--slave /usr/bin/irb irb /usr/bin/irb1.9.1 \
--slave /usr/bin/rdoc rdoc /usr/bin/rdoc1.9.1
# choose your interpreter
# changes symlinks for /usr/bin/ruby , /usr/bin/gem
# /usr/bin/irb, /usr/bin/ri and man (1) ruby
sudo update-alternatives --config ruby
sudo update-alternatives --config gem
# now try
ruby --version
If you want to make this your exclusive Ruby and get rid of Ruby 1.8 follow the uninstallation instructions.
Edit: I found out today that there also is a package called ruby1.9.3 however that is just a proxy package that doesn't have any files itself and only depends on ruby1.9.1. Aptitude confirms this:
Ruby uses two parallel versioning schemes: the `Ruby library compatibility version' (1.9.1 for this package), which is similar to a library SONAME, and the 'Ruby version' (1.9.3 for this package). Ruby packages in Debian are named using the Ruby library compatibility version, which is sometimes confusing for users who do not follow Ruby development closely. This package depends on the ruby1.9.1 package, and provides compatibility symbolic links from 1.9.3 executables and manual pages to their 1.9.1 counterparts.
There doesn't seem to be a rubygems1.9.3.
2nd approach
Also This link i found useful its very simple and effective.
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/
Compiling from Source is the standard way.
Download source code from Here, Use README file to get instruction.
Another method is apt package manager system.
$ sudo apt-get install ruby1.9.1
Yes, this will install Ruby 1.9.2. It has a ‘library compatibility version’ of 1.9.1, hence the name.
If you install the ‘ruby’ package, you’ll get the older Ruby 1.8.
In my cluster this is really the only solution that worked:
#!/usr/bin/env bash
# -- this really is the only solution that worked for me on snap :/
ruby -v
if ! command -v ruby &> /dev/null
then
echo "Going to try to install ruby (ideally 3.1.2)"
# - install rebenv (following ruby-build really is needed eventhough it doesn't look like it)
mkdir -p ~/.rbenv
cd ~/.rbenv
git clone https://github.com/rbenv/rbenv.git .
# if $HOME/.rbenv/bin not in path append it, otherwise don't change it
echo $PATH | tr ':' '\n' | awk '{print " " $0}';
if [[ ":$PATH:" != *":$HOME/.rbenv/bin:"* ]]; then
echo "might want to put $HOME/.rbenv/bin in your path"
export PATH="$HOME/.rbenv/bin:$PATH"
# echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc.lfs
fi
eval "$(rbenv init -)"
rbenv -v
# - install ruby-build, odd, this really is needed for ruby to install despite it not looking like ruby build is need at the bottom
mkdir -p ~/.ruby-build
cd ~/.ruby-build
git clone https://github.com/rbenv/ruby-build.git .
# if $HOME/.ruby-build/bin not in path append it, otherwise don't change it
echo $PATH | tr ':' '\n' | awk '{print " " $0}';
if [[ $PATH != *"$HOME/.ruby-build/bin"* ]]; then
echo "might want to put $HOME/.ruby-build/bin in your path"
export PATH="$HOME/.ruby-build/bin:$PATH"
# echo 'export PATH="$HOME/.ruby-build/bin:$PATH"' >> ~/.bashrc.lfs
fi
ruby-build --version
# - install ruby without sudo -- using rbenv
mkdir -p ~/.local
# ruby-build 3.1.2 ~/.local/
rbenv install 3.1.2
rbenv global 3.1.2
fi
ruby -v
# - Original Prover doesn't work on SNAP
# Proverbot's way to install ruby
# # First, install Ruby, as that is for some reason required to build the "system" project
# git clone https://github.com/rbenv/ruby-build.git ~/ruby-build
# mkdir -p ~/.local
# PREFIX=~/.local ./ruby-build/install.sh
# ~/.local/ruby-build 3.1.2 ~/.local/
# ref: https://superuser.com/questions/340490/how-to-install-and-use-different-versions-of-ruby/1756372#1756372

How do I install Ruby with libyaml on Ubuntu 11.10?

I installed ruby-1.9.3-p0 on my Ubuntu 11.10 wubi and then rubygems to get Rails set up.
This is my code:
sudo ruby setup.rb
I got this error:
"/usr/local/lib/ruby/1.9.1/yaml.rb:56:in'<top(required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby."
I installed libyaml and reinstalled Ruby but still it doesn't work.
The information changed and I have no idea what's wrong with it.
You must install the paquage libyaml-dev before installing ruby, if not you can still use extconf.rb for the missing library. So for this problem you can do (from the ruby install folder) :
cd ext/psych
ruby extconf.rb
make
make install
Extconf.rb is usefull for adding a library after have installed ruby.
Do the following:
you must have "curl" installed :sudo apt-get install curl
Go To this link RVM
Copy the command in the quick install box and Paste it in your command prompt
Type echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
Type ~/.bashrc
Type the following code:
sudo apt-get install build-essential libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
Type: rvm install 1.9.3-p0
Type: rvm use 1.9.3-p0
Type: gem install rails
Have fun :)
Ok, after a failed attempt at installing RoR on my Ubuntu 11.10 box, I combined the tips from this page and from this resource: http://www.thegeekwork.com/how-to-install-ruby-on-rails-in-ubuntu-11-10/
This is the breakdown, step-by-step of what I just did to make this work (sorry if I didn't format this so great, I was just trying to keep it neat):
1) Fresh install of Ubuntu 11.10
2) me#Box:~$ sudo apt-get install curl
3) me#Box:~$ sudo apt-get install git
4) me#Box:~$ sudo apt-get update
5) me#Box:~$ sudo apt-get dist-update
6) me#Box:~$ sudo shutdown -r now
7) me#Box:~$ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
8) me#Box:~$ gedit ~/.bashrc
9) add the following line to the end (and save the file)
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
10) me#Box:~$ source ~/.bashrc
11) me#Box:~$ type rvm | head -1
After executing above command you should be getting this output -
rvm is a function
You’ve successfully installed the RVM. Next, you are supposed to install additional dependencies. To find out those programs type -
12) me#Box:~$ rvm requirements
After the above command, install the additional packages recommended by RVM -
13) me#Box:~$ sudo apt-get install build-essential 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 automake libtool bison subversion
14) me#Box:~$ rvm install 1.9.2
(#14 takes a little while)
15) me#Box:~$ rvm use 1.9.2
(This selects the version you want to use)
(If you aren’t sure about the ruby version currently being used, then type -
ruby -v)
16) me#Box:~$ gem install rails
(this will take a little while...)
17) Make a sample application as a test...
me#Box:~$ rails new test_app
me#Box:~$ cd test_app
me#Box:~/test_app$ rails server
AND THAT"S WHERE THIS THING DIDN"T WORK. ARRRRRRRRRrrrrrrrrrrrrrgh.
So,
18) in your application folder ("test_app"), open Gemfile and uncomment "therubyracer" line
19) me#Box:~/test_app$ bundle install
20) me#Box:~/test_app$ rails server
Done, and done.
I don't understand why it set 0.0.0.0:3000 as the host address (I thought it would be 127.0.0.1), but quite frankly, that's not bothering me right now -- I got it to work (so far). Time to get going with some Rails! :D
I hope this helps anyone else who is looking to make this work! :)
Note: I realize that #13 repeats some of the things I already installed, but I don't care, I'm just doing what the thing says. :/
Note2: Holy learning curve on just posting an answer! I wasn't sure what was considered "code" and apparently the prompt is considered code. Makes sense now :)
Note3: This is my first "Answer" on StackOverflow! :D
If you are compiling ruby you might need libyaml-dev
Debian (and Ubuntu, etc.) packages that contain the files needed to install some other program from source usually end in -dev, e.g. libyaml-dev, so try installing that. Or just use rvm, it will actually install this for you.
Compling yaml from its source will make it work. I am running the same config as yours. I followed this http://collectiveidea.com/blog/archives/2011/10/31/install-ruby-193-with-libyaml-on-centos/. It definitely works.

How to install Rails application on ubuntu?

While installing, some errors are displayed. The command I am using is:
sudo gem install rails --include-dependencies
or
sudo gem install rails --no-rdoc --no-ri
In both cases, it is the same error. I think my rubygems may not be installed properly?
ERROR: Loading command: install (LoadError) no such file to load -- zlib ERROR: While executing gem ... (NameError) uninitialized constant Gem::Commands::InstallCommand
I have installed ruby-1.9.2-p0 and rubygems-1.3.7
One more thing: Do I have to cd into the ruby or rubygems directory and then install rails or can I do it from default directory?
Open command prompt and please let us know the results
verify Ruby version
ruby -v
verify gem version
gem -v
Use command
gem install rails
verify the rails version
rails -v
$ sudo apt-get install ruby1.9 gem1.9
checkout below mentioned link that would help you to install rails3 using rvm on ubuntu box
http://www.jaikeerthi.in/2010/11/install-rails-ubuntu/
You have to install zlib1g and zlib1g-dev
sudo aptitude install zlib1g zlib1g-dev
Some GEMs compile some binaries at installation time and need other libraries (such as zlib) be installed on the system.
Assuming that you are installing on Ubuntu 14.04...
First install rbev to pick a Ruby version for your application.
sudo apt-get update
Install the rbenv and Ruby dependencies with apt-get:
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
Now let's install rbenv
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
And now let's install Ruby:
rbenv install -v 2.2.3
rbenv global 2.2.3
Verify that Ruby is installed with this command:
ruby -v
Install bundler to manage gems:
gem install bundler
Now we are set to install Rails:
gem install rails
Then run
rbenv rehash
It's good to verify if the Rails is installed properly:
rails -v
Make sure to install database and Javascript runtime afterwards...

Resources