problems installing latest ruby version - ruby

I need some help here with RVM and installing the latest version of rails on a debian server. please note im not a linux programmer so you'll have to spell out everything for me.
basically i'm trying to upgrade to the newest version of ruby. I'm trying to install that on a debian server that I connect to via VPN. I'm trying to use RVM so far, but when i run the RVM install 1.9.3 from my debian bash prompt it says there are no binary available for that version, then proceeds to try and grab the source from online which fails (probably due to the firewall). basically when it grabs the source folder from online, it grabs a corrupted hunk of junk. I tried downloading the source package myself and if i click the link on the ruby site it blocks it. If i use wget it appears to download it, but the md5 doesnt match and i cant untar it the thing. it says gzip: stdin: the file is not in gzip format.
So! I neeeedddsss to help. What I was thinkin was getting the binary rubies for 1.9.3.. but I'm unsure how really.. I downloaded the tar.gz file on my windows and used winSCP to move it over, and then I can use untar the thing fine.. and then i have an unzipped folder that is the source from the site.. but im unsure where to go from there.. apt-get install doesnt seem to recognize the tar.gz or the untarred folder.. i tried rvm mount and specifying the path to ruby.exe file (ruby-1.9.3-p327/bin/ruby) but then it says unrecognized command line argument and i should see the usage..
Any advice out there? (preferably without 3rd party programs or stuff other the RVM)
thanks

Because you're a novice, I suggest skipping RVM unless you know you need it.
Debian has great way to install Ruby and make it available for all of the system users:
sudo apt-get install ruby1.9.3
You will use the root password to install it this way.
To verify it worked:
ruby -v
That should print out something like this:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

In case you want to install ruby using rvm: Just execute the commands in the same sequence..
$ sudo apt-get install curl git-core ruby
$ \curl -L https://get.rvm.io | bash -s stable
$ sudo apt-get install libssl-dev
$ source ~/.rvm/scripts/rvm
$ 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
$ rvm install 1.9.3
--give the password for sqlserver or you can just press enter.
$ gem install rails
You have ROR setup now!

Reading back on my questions, I remember now, it WAS the firewall. The firewall where I was working at the time didn't allow me to download ruby source properly. It was downloading, but not actual source, corrupted source. So, I did it at home and it worked fine.
Just thought I'd pop this in here in case anyone ever finds it when problems installing ruby.

Related

How to install ruby on linux in a specific folder

I try to install ruby and rails to start to learn ruby on rails.
I work on Windows. After many search and tries, I gave up and installed a fresh ubuntu 14 x64 in a VirtualBox.
I installed ruby with apt-get, but its files get spread all over the file system (/bin, /var...). So, I have to use always sudo and search all over the place when installing gems.
I would like, just like in windows, find a ruby tar.gz which I can decompress in a folder of mine, with all files at the same place, where I have the "control" over the files, and I can watch easily what it's hapenning while installing gems, rails, etc...
The problem : I cannot find any tar.gz (or similar archive) of ruby for linux which I simply can uncompress in a folder and work with it (I can manage the $path). The only one I can find is for Windows !
Thanks !
It sounds like what you want is Ruby's source code. Go to https://www.ruby-lang.org/en/downloads/ and look under "Compiling Ruby - Source Code". That's where you'll find the .tar.gz files you want. You'll need to compile and install it before you can actually use it. Installing normally copies files "all over the file system", but you can force it to install to a specific folder by passing the --prefix option to the ./configure script.
$ tar -xf ruby-2.2.1.tar.gz
$ cd ruby-2.2.1
$ ./configure --prefix=/my/ruby/dir
$ make && make install
You may need to install some dev packages in order to get it to compile, but any compilation errors should make it clear what you need.
These instructions are also described here.
Thank you Max for your response.
In case someone else tries to compile ruby on a fresh new ubuntu, this is what I had to do to build and use it with success :
Install missing dependencies :
get the latest "Stable Snapshot" from https://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz and not the "Current stable"
sudo apt-get install libffi-dev
sudo apt-get install zlibc zlib1g zlib1g-dev
sudo apt-get install openssl
sudo apt-get install libssl0.9.8 [[[ first, find the latest version with : apt-cache search libssl | grep SSL ]]]
sudo apt-get install ca-certificates
sudo apt-get install libssl-dev
sudo apt-get install libreadline-dev
Then :
Edit downloaded file tools/rbinstall.rb, goto line 714 and correct the typo :
change "rescue LoadErroe" to "rescue LoadError" (not corrected in date of 20 March 2015).
Run Max's instructions above
Don't move the ruby destination folder declared with "--prefix" (even if you try to correct the shells in ruby/bin)
Finally, for using rails :
sudo apt-get install libsqlite3-dev
sudo apt-get install nodejs ==> inorder to have a js runtime

Couldn't require openssl in ruby

I have openssl installed in my virtual machine ubuntu12.04lts.
When I run the gem command it gives error.
Error: while executing gem (Gem::Exception)
Unable to require openssl. install openSSL and rebuilt ruby (preferred) or use non HTTPs sources
And I also test require openssl in irb mode.
it gives error.
Loaderror: cannot load such file --openssl
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55 `require'
I have openssl
$openssl version
OpenSSL 1.0.1 14 mar 2012
How to fix the error?
Note: Calls to rubygems.org are deprecated - proceed with caution!
I had the same issue on Mac OSX after also building ruby2.1.0p0 from the source. I already had openssl installed. It appears that the reference in gems needed refreshing. I ran:
gem source -r https://rubygems.org/ to remove
followed by
gem source -a https://rubygems.org/ to read
After this, I was able to run gems install bundler successfully.
If you run into further errors, you can try ./configure --with-openssl-dir=/usr/local/ssl in your ruby downloaded dir/.
I got this error while using debian where openssl was in /usr/bin.
Following the suggestion of jspacek I reconfigured ruby using:
./configure --with-openssl-dir=/usr/bin
After make and sudo make install I was able to install rails.
make sure you have libssl-dev installed:
dpkg -s libssl-dev
if not, install it:
sudo apt-get -y install libssl-dev
In case someone else has this problem, try reinstalling your Ruby version with openssl included
brew install openssl
rvm reinstall 2.4.0 --with-openssl-dir=`brew --prefix openssl`
You might already have openssl - so you can ignore the first step.
This helped me.
I'm leaving this answer for reference to future Googlers:
Type all these commands in your Terminal (OSX) just to be extra sure you've done everything (this is what eventually worked for me)
rvm get stable
brew update
brew doctor
brew install openssl
rvm install ruby-2.1 (or whatever version)
rvm use (ruby version here) i.e. rvm use ruby-2.1
rvm gemset create NAME i.e. rvm gemset create rails41
gem install rails -v 4.1
Finally...
As many commenters have pointed out - you need OpenSSL installed before you compile ruby before you install rails (or other gems)
You probably built Ruby from source before installing OpenSSL. Make sure you install it and then try reconfiguring and rebuilding Ruby.
Recently I was struggling with ruby installations due to the recent auto-update in openssl version from 1.0 to 1.1 and wanted to revert it back to older version. No other solution except the one given below worked for me:
brew install rbenv/tap/openssl#1.0
rvm reinstall 1.9.3-p551 --with-openssl-dir='/usr/local/opt/openssl#1.0'
gem update --system
Now my ruby runs with openssl 1.0 whereas all other libraries are running on the default openssl version 1.1.
Rebuilding Ruby after running sudo apt-get install libssl-dev libreadline-dev libgdbm-dev can solve this issue.
I found this solution here.
I was getting this error installing Ruby with RVM. Nothing worked. I switched to rbenv. Problem solved!
for me it was a case of missing dependencies.
i thought i had all the dependencies required to install ruby, but i too was getting an openSSL and readline error.
i attempted to install ruby with RVM without root privileges which failed but gave me a list of missing dependencies. i then installed the dependencies with a package manager. i then re-attempted to install ruby from source from the beginning, and everything worked OK
the dependencies that were missing, for me, were:
patch libyaml-devel autoconf gcc-c++
readline-devel libffi-devel openssl-devel
automake libtool bison sqlite-devel
but they may be different for you.
update: i don't originally remember where exactly i found this list, but a quick search found similar lists on the following pages, which might also help you:
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-on-centos-6-with-rvm
http://www.itzgeek.com/how-tos/linux/ubuntu-how-tos/install-ruby-on-rails-on-centos-ubuntu-fedora-from-source.html
These steps worked for me:
Fixed ruby install:
brew upgrade openssl;
openssldir=which openssl
rvm reinstall ruby-2.4.2 --with-openssl-dir=$openssldir
Removed and re-added sources for gems
gem sources -r https://rubygems.org/
gem sources --add https://rubygems.org/
i had similar issue and tried to solve it by following guides. The "rebuild ruby" is an important step!
after openssl_devel is installed
cd folder_of_ruby_source_code/ext/openssl
ruby ./extconf.rb
make
make install
cd folder_of_ruby_source_code
./configure
make clean <= clean is important here
make
make install
Do you use RVM?
If not, try using it and see if it fixes your problem.

Recompiling/reinstalling Ruby 2.0 with openssl

I'm currently trying to install gitlab on a fresh Ubuntu server in the rackspace cloud, and this requires I install Ruby 2.0.
So I downloaded ruby via curl and installed it by doing the following:
./configure
make
make install
Then, when trying to install a gem I got an error saying cannot load such file -- openssl.
Clearly I was missing open ssl. So I installed openssl and libssl-dev, as I heard you need this too if you're using Ubuntu:
apt-get install openssl
apt-get install libssl-dev
I then reinstalled ruby by repeating the steps above:
./configure
make
make install
However, after all of this, I still get the same openssl error: cannot load such file -- openssl
I assume that I'm not reinstalling ruby correctly. There must be some steps I'm missing to remove the initial configuration, however no amount of googling yields an answer that makes sense to me. Does anyone know how I would go about doing this?
edit: I'm downloading ruby from the following source: ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
I did that on a standard debian 7, with a fresh openssl installed under /opt/openssl, like this
$cd ~/ruby-src
$./configure --prefix=/opt/ruby --without-openssl
$make
$sudo make install
And then using ext/openssl/
$export PATH=/opt/ruby/bin:/opt/openssl/bin:$PATH
$which ruby
/opt/ruby/bin/ruby
$which openssl
/opt/openssl/bin/openssl
$cd ~/ruby-src/ext/openssl/
$ruby extconf.rb --with-openssl-dir=/opt/openssl
$make
$sudo make install
I had to comment out the line with OP_MSIE_SSLV2_RSA_PADDING in ossl_ssl.c, because that constant does not exist in the current openssl distribution, but then everything compiled cleanly.

Installing RVM on existing ruby1.8 installation

I have a big problem with my Debian server configuration. Someone before me has made a big mess with ruby installation and now i can't manage to get it all working. What i'm trying to do now is to get back to environment, where ruby1.8 is installed and rails app is working correctly with apache+passenger. If it would be working on RVM it would be perfect. Here is the story:
There was ruby 1.8 installed on a server. The person has removed it with sudo apt-get remove ruby1.8 and then installed version 2.0.x manually using those commands:
mkdir /tmp/ruby && cd /tmp/ruby
curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz | tar xz
cd ruby-2.0.0-p247
./configure
make
sudo make install
Then, he has removed all the dirs listed by whereis ruby with rm command.
And here i came - i want to install RVM on this server. The problem is, no matter what i do, i get a lot of errors from all sides. Steps i've done:
# Install RVM
curl -L https://get.rvm.io | bash -s stable
# install 1.8.7 version
rvm install 1.8.7
# use 1.8.7
rvm use 1.8.7
# Install gems
bundle install
First thing (and that's just a tip of iceberg) is that i'm not able to start apache2 in cause of the following error:
apache2: Syntax error on line 203 of /etc/apache2/apache2.conf: Syntax
error on line 1 of /etc/apache2/mods-enabled/passenger.load: Cannot
load
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.5/libout/apache2/mod_passenger.so
into server:
/usr/lib/ruby/gems/1.8/gems/passenger-4.0.5/libout/apache2/mod_passenger.so:
cannot open shared object file: No such file or directory Action
'configtest' failed.
Looks like there is even no /usr/lib/ruby/ dir on my system right now.
The question is: is there any way to reset all ruby-releated libraries on debian to the original state (debian without ruby installed) and install working RVM on top of that? Thanks in advance for any help.
Verify if, Is ruby installed correct by ruby -v
Install phusion passenger
$ sudo gem install passenger
$ sudo passenger-install-apache2-module
and then follow onscreen instructions

Ruby Installation

Silly question. I went to http://rubyinstaller.org/downloads/ and installed Ruby 1.9.2, but when I pull up command prompt and type ruby -v it's not recognized as a command. Am I doing something wrong? I had version 1.8.6 installed, but I couldn't figure out how to upgrade my Ruby version so I uninstalled it and tried a fresh install.
You need to add Ruby to your path variable, regardless of your operating system.
Say you're using Windows, and Ruby is installed in C:\Program Files\ruby1.9.2\ You'll need to find out which folder the ruby executable is in (ruby.exe). Sometimes it'll be in the main folder, but usually for open source packages it'll be in the subfolder bin. To add ruby to your path, then, you'll need to use C:\Program Files\ruby1.9.1\bin
You can do this on the command line like so:
path = %PATH%;C:\Program Files\ruby1.9.2\bin
Note that %PATH% has a percent sign on either side, and that there's a semi-colon separating it from the new value. You'll have to type it in each time you start a new command line window, but it might be a good idea to try this the first time, because any mistakes in typing it in won't be permanent.
To change it permanently you can find it in Control Panel > System > Advanced System Settings. Switch to the Advanced tab, then click Environment Variables... Find path under System Variables, and add ;C:\Program Files\ruby1.9.2\bin to the end. Note that you still need a semi-colon to separate the new value from everything else, and that you don't need %PATH% this time (in face, the value you see is what %PATH% represents). Once you've done that, restart any command windows you had open, and you should be able to access things just fine!
These instructions will be different if you're using Linux or a Mac - try googling environment variables if you'd like to know more!
Did you add your bin Directory to the PATH?
Ok, when you install it, it will go in a directory:
ex: c:/program files/ruby1.9.x/
inside you will have a /bin directory which contains all the command for the command line.
To be able to use ruby in the command line, you must add it to your $PATH variable in the OS environment.
ex:
path=c:/program files/ruby1.9.x/bin;etc...
Install RVM with RUBY
sudo apt-get install curl
after install
install rvm also ruby
\curl -sSL https://get.rvm.io | bash -s stable --ruby
if you face issue with the above line (Failed to connect to get.rvm.io port 443: Network is unreachable)
in browser go to https://get.rvm.io save the page in any location
make it executable file name rvm-installer
chmod +x rvm-installer
then do the following
bash rvm-installer stable --ruby
source /home/username/.rvm/scripts/rvm
then check rvm list
note the version of ruby listing on terminal
if you failed to install due to the dependency
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev
if the above steps not installed ruby latest version you can do it by
rvm install ruby-2.1.1
installation using rvm
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.1.1
rvm use 2.1.1 --default ruby -v
**change terminal to login shell. open a new terminal **
then rvm use 2.1.1 => ( 2.1.1 version )
then its done!
pd#admin:~$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
programmers keep on coding with ruby.

Resources