how to install ruby 2.0 in debian 6? - ruby

I want o install ruby 2.0 and I have followed many tutorials, but none of them works, and the defaul repo apt-get install ruby brings me the 1.8 version (and due is debian has restrictions to update it if is not through the repo) any way to do it?
Ive tried this way
cd /usr/src
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz
tar xjf ruby.xxx.tar.bz2
cd rubyxxx
./configure --enable-shared
make
make install
and just that, I get error on the next steps, when I make a ruby -version I get this
-bash: /usr/bin/ruby: No such file or directory
the end of the tuto install
cd ext/openssl/
ruby extconf.rb
make install
cd ../readline/
ruby extconf.rb
make install
gem update --system
any idea how to do this in debian 6? thanks

Compile it from the source.
Go here: https://www.ruby-lang.org/en/downloads/
Get the latest stable Ruby 2.x, download the tarball, and compile it. You will be surprised that everything will actually work out of the box, except that you'll have to reinstall the gems once you upgrade to 2.x. Your 2.x will be installed into /usr/local/bin/ruby, so in some of my local scripts, I had to change the shebang to #! /usr/local/bin/ruby to get them work with 2.x. Ruby 1.9.3 will continue being available under /usr/bin/ruby. I'm no theorist or core developer, but this is my experience as a user. And while most gems work with 2.x perfectly, some more complicated ones (such as watir-webdriver), I wasn't able to get working with it, so I still keep 1.9.3 around.
(Update: Now with higher versions of 2.0 and 2.1 in sight, most developers whose gems are alive already adapted to Ruby 2.x.)

If it's a server, you may want to take a look at RVM (https://rvm.io/). It would make your install as simple as :
curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled

Related

Configuring OpenLiteSpeed for Ruby & Rails

On Ubuntu 18.04 using the instructions here I've installed OpenLiteSpeed via the CyberPanel install, and then installed Ruby using the following commands in the terminal/console:
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
apt install rbenv libreadline-dev ruby-dev -y
export TMPDIR=/mytmp/
rbenv install 2.5.0
rbenv global 2.5.0
gem install rack -v 1.6.11
gem install ruby-lsapi
But now I'm confused about the paths and where to "setup context". The instructions above show the default ruby location different to the instructions for Litespeed and different to where I've found ruby on the server and the ENV values. The locations on the server for 'ruby' are:
/root/.rbenv/versions/2.5.0/bin/ruby
/root/.rbenv/shims/ruby
/etc/apparmor.d/abstractions/ruby
The command gem env shows the following:
Installation directory: /var/lib/gems/2.5.0
User installation directory: /root/.gem/ruby/2.5.0
Ruby executable: /usr/bin/ruby2.5
Executable directory: /usr/local/bin/
In the OpenLiteSpeed admin panel under Server Configuration > App Server I've found Rack/Rails Default Settings. What should I add here for Ruby Path and what other configuration would I need to do please?
I have limited knowledge of Ubuntu/Linux and OpenLiteSpeed, and almost zero knowledge about Ruby.
EDIT: I'm installing Ruby only because I want to install and test ShareTribe which requires Ruby.
EDIT: I've removed Ruby 2.5 and installed 2.6 with the following commands:
sudo apt-get purge ruby
wget http://ftp.ruby-lang.org/pub/ruby/2.6/ruby-2.6.6.tar.gz
tar -xzvf ruby-2.6.6.tar.gz
cd ruby-2.6.6/
./configure
make ...SLOW
sudo make install
All looked good so far, but then the next command gem install bundler gave the error /usr/bin/gem: no such file or directory. So another path error.
From the docs you've linked to it seems you have a few issues, some are not related at all to ruby. However it seems that the documentation for using Ruby on Rails in OpenLiteSpeed are instructing you to use a older version of Ruby than what is required in the documentation for ShareTribe requirements which seem to require you use Heroku for hosting your application. There may be ways to get all of this work on other platforms, but you are traversing the waters of DevOps Hell in which case you may want to post some questions on https://devops.stackexchange.com/
From what I can see you'll need to follow instructions to install ruby 2.65 in place of 2.5.0 but you may want to check with OpenLiteSpeed support to make sure it is supported.
As for SharTribe you'll also want to find out if they will support running on your Digital Ocean droplet.

How to remove Ubuntu stock Ruby 1.8? Not apt

Ubuntu came with Ruby 1.8 installed, but I really would rather (and need, for rails) 1.9.2. I tried apt-get purge but apt doesn't believe there is a ruby package (however ruby -v keeps returning ruby 1.8).
I have installed rvm but ruby -v now only returns bash: /usr/bin/ruby: No such file or directory. I'm lost, any help?
I removed ruby from /usr/bin but it refuses to accept that rvm exists and keeps suggesting i install the 1.8 or 1.9.1 packages.
RVM is a bit wonky on Ubuntu. Look here for a fix before going any further.
If you have access to a GUI, try running The Synaptics Packet Manager
I had the same problem and Synaptics marked ruby 1.8 as installed. Unchecked the package, clicked on run and ruby was GONE
$ ruby -v now yields command not found
Now you can safely run
$ apt-get install rubyX.X.X
Happy coding!

Ruby command-t SEGV

I am on ubuntu 11.10 and have had vim-gnome installed and working. Using vundle and have installed seeral packages all working.
I have installed command-t but it will not function until C extensions are compiled. Reading the manual this is the solution.
rake make
For me the location is actually:
~/.vim/bundle/command-t
Anyway so I turned rvm off and installed the system 1.8 as advised in the command-t help guide.
I checked the documentation and the most common cause of command-t errors is compiling against the wrong ruby.
So I found this command to check the compiled version.
renshaw#renshaw-TravelMate-5740G:~/.vim/bundle/command-t$ ldd `which vim` | grep ruby
libruby1.8.so.1.8 => /usr/lib/libruby1.8.so.1.8 (0x00007f913932c000)
So I installed rake for the ruby 1.8 and compiled with rake make
renshaw#renshaw-TravelMate-5740G:~/.vim/bundle/command-t$ sudo rake make
/usr/bin/ruby1.8 extconf.rb
checking for ruby.h... yes
and off it goes and compiles.
however start gvim and run \t for command-t and
Vim: Caught deadly signal SEGV
Vim: Finished.
Segmentation fault
How can I get command-t going on ubuntu 11.10?
Update.
Built Gvim from sources using
hg clone https://vim.googlecode.com/hg/ vim
cd vim
sudo ./configure --enable-rubyinterp=yes --enable-pythoninterp=yes --enable-gui=gtk2
make
make install
vim --version | grep ruby
The vim version command returns correct that ruby support is built against my installed system 1.8 but it still SEGV when using command T.
So found and tried this
cd ~/.vim/ruby/command-t
/usr/bin/ruby extconf.rb
make
This failed as well.
I then add this to bashrc from a previous support ticket.
vim() {
(unset GEM_PATH GEM_HOME; command vim "$#")
}
I had similar problems when using the rake task. I solved it by compiling the extension myself.
From the command-t plugin directory:
rvm use system
cd ruby/command-t
ruby extconf.rb
make
sudo make install
Ubuntu 13.04 has the very same issue. After trying different combinations, here is what worked for me.
I don't like building from the source, so I used vim-nox package:
sudo apt-get install vim-nox
Now, when compiling command-t with Ruby 1.8.7 or Ruby 2.0.0 SEGV signals were caught. In order to experiment with different Ruby versions, I installed rvm:
curl -L https://get.rvm.io | bash
Then I used Ruby 1.9.1 to compile the command-t extension:
rvm install 1.9.1
rvm use 1.9.1
cd ~/.vim/bundle/command-t/ruby/command-t
ruby extconf.rb
make
To sum up: vim-nox + ruby 1.9.1 = vim command-t works well on Ubuntu 13.04.
I got it to work on Ubuntu 11.10 following these instructions and building Vim and Command-T with Ruby 1.9.2p290 -
sudo apt-get install python-dev ruby-dev mercurial ncurses-dev liblua5.1-0-dev lua5.1
rvm use 1.9.2
hg clone https://vim.googlecode.com/hg/ ~/vim
cd ~/vim
hg update -C v7-3-154
./configure --with-features=huge --disable-largefile \
--enable-perlinterp --enable-pythoninterp \
--enable-rubyinterp --enable-gui=gtk2 \
make
sudo make install
And then following the Command-T installation instructions for Pathogen, in my case.
This is how I fixed this problem (I believe it's caused by version missmatch):
I had an old version of vim installed (from apt using debian). The old version of vim was using old 1.9.x version of Ruby libraries. I compiled command-t according to the guide in https://github.com/wincent/Command-T. I used ruby 2.1.x during the compilation process. I got SEGV when i did t. I believe it was caused by the version missmatch between the Ruby I used when I compiled command-t and the Ruby vim is using. So the fix was to compile vim against the same Ruby libs that command-t was compiled against. When I upgraded my vim using "apt-get install vim" everything started to work. Now the new version of vim is using the same new Ruby libraries that come with the package manager.

why my ruby version is still an old version on ubuntu after I installed ruby1.9.2?

I am newbie to ubuntu and ROR. After installed latest ruby1.9.2 with apt-get, type "ruby -v" it still shows up old version ruby1.8.7. I tried to reinstall with rvm, nothing changed.
As mentioned in similar question, I tried to remove ruby, and reinstall ruby1.9.1-full... still the same thing...
What else I can do about this?
ubuntu uses a something called alternatives for chosing between two version of similar executable. Running
sudo update-alternatives --config ruby
and chosing the ruby you want should do the trick
I'm using RVM myself, but if I remember correctly, ruby1.8 and ruby1.9 can be installed side by side on Ubuntu. ruby is just a symbolic link which points to version 1.8 by default - which should be called ruby1.8 and stored in the same directory. 1.9 will be called ruby1.9.
So just find where ruby symbolic link is (whereis ruby) and change it so it points to ruby1.9.
sudo rm /path/ruby
sudo ln -s /path/ruby1.9 /path/ruby
Sounds like you are using rvm, but still referencing system ruby. To switch, you have to tell rvm what version to use.
rvm use 1.9.2
This will switch your current environment only. So ruby -v in your current shell will use the right version. (you should probably go with 1.9.3, FWIW) If you want to always use that ruby be default, you type:
rvm use 1.9.2 --default
If you want to switch back to system ruby, you can use:
rvm use system
I think it is because the package of Ruby version at apt-get repository is an old version.
I suggest use rbenv to install the latest version.
Here is a great tutorial using rbenv to install the latest Ruby version from Digital Ocean:
https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rbenv-on-ubuntu-14-04
sudo apt-get install ruby1.9
should do the trick.
You can find what libraries are available to install by
apt-cache search <your search term>
So I just did apt-cache search ruby | grep 9 to find it.
You'll probably need to invoke the new Ruby as ruby1.9, because Ubuntu will probably default to 1.8 if you just type ruby.

Installing Ruby 1.9.1 on Ubuntu?

I wonder about installing the latest version of Ruby on Ubuntu 9.04. Now I can run through the ./configure and make stuff fine, but what I wonder about: how to avoid conflicts with the packaging system? For example if some other package I install depends on Ruby, wouldn't the package manager install the (outdated) Ruby package and in the worst case overwrite my files?
So I think I need some way to tell Ubuntu that Ruby is in fact already installed?
Save yourself the headache and use RVM (Ruby Version Manager)
Keep in mind, Rails 3 works best with Ruby 1.9.2. Ruby 1.9.2 fixes up quite a few bugs in 1.9.1 and is preferable to running 1.9.1.
With RVM installing 1.9.2 is a breeze.
sudo apt-get install ruby1.9.1-full
(http://www.ruby-lang.org/en/downloads/)
After running
sudo apt-get install ruby1.9.1-full
It's solution is to run the following command:
sudo update-alternatives --config ruby
Then you will get this output:
There are 2 choices for the alternative ruby (providing /usr/bin/ruby).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/ruby1.8 50 auto mode
1 /usr/bin/ruby1.8 50 manual mode
2 /usr/bin/ruby1.9.1 10 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in manual mode.
$ ruby --version
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
Credit for this solution goes to person who answered https://askubuntu.com/questions/91693/how-do-you-uninstall-ruby-1-8-7-and-install-ruby-1-9-2 . Currently the ruby1.9.1 package is actually ruby 1.9.2.
The way I did it was to build it using checkinstall which lets you build a deb package. So I downloaded the Ruby 1.9.1 source, did a "configure" and then "make", did a "checkinstall" and made the package name ruby1.9 so it installs as if it were a new version of ruby 1.9 (as it should).
I got the Ruby specific info from this site.
You can install most software in a different directory with the --prefix=/path switch. And it is common to install in /opt/ for everyone on your pc, or in $HOME if it is only for you.
For installing in /opt:
$ ./configure –prefix=/opt/ruby
$ make install
If you want to use the /opt installed ruby, edit you ~/.bashrc and add
export PATH=/opt/ruby/bin/:$PATH
If you don't want to have the custom Ruby build as default, you can add this to your ~/.bashrc instead of the former command
function setupruby {
export PATH=/opt/ruby/bin/:$PATH
}
Here is a short and convenient way to install 1.9.1 and to make it default:
http://michalf.me/blog:make-ruby-1-9-default-on-ubuntu-9-10-karmic-koala
I created a launchpad ppa for ruby 1.9.2. Details in the links below
http://www.humbug.in/2010/launchpad-ppa-for-ruby-1-9-2-and-some-ruby-bindings/
sudo add-apt-repository ppa:pratikmsinha/ruby192+bindings
cd /etc/apt/sources.list.d/; sudo mv pratikmsinha-ruby192+bindings-lucid.list pratikmsinha-ruby192bindings-lucid.list
sudo aptitude update
sudo aptitude install ruby1.9.2
Looking through Synaptic it seems like you don't even have to deal with the Multiverse or third-party repositories. But since sudo apt-get install ruby currently installs an alias to ruby1.8, you should install ruby1.9 explicitly – manually or via the repositories – and create the alias ruby yourself.
You may want to put the binary in /usr/bin since that's where the distribution would put it anyway. Anywhere on your PATH is fine, though.

Resources