How to install ruby 1.9.2 on debian lenny? [closed] - ruby

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I would like to install the newest ruby and rails on my debian lenny server.
I found the package http://packages.debian.org/lenny-backports/ruby1.9.1-full but when I try to install it with I just get:
atlas:~# apt-get install ruby1.9.1-full
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package ruby1.9.1-full
My sources.list looks like this:
atlas:~# cat /etc/apt/sources.list
deb http://ftp.se.debian.org/debian/ lenny main non-free contrib
deb-src http://ftp.se.debian.org/debian/ lenny main non-free contrib
deb http://security.debian.org/ lenny/updates main contrib non-free
deb-src http://security.debian.org/ lenny/updates main contrib non-free
deb http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
deb-src http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
What do I have to do to get it installed?

Stop. Go back. Install whatever version of Ruby Debian has, probably 1.8.7 or 1.8.7. Then install RVM. I have some directions for using RVM with Ubuntu (sorry, not Debian, but it's close). Seriously, RVM makes installing any version of Ruby easy. Then, use RVM to install Ruby 1.9.2, you don't want 1.9.1.
This will work depending on what you want to use Ruby for. For development purposes, using RVM works really well. For server purposes, I suppose it can be used, but you might have some problems. I think RVM gives you some scripts you can use to run Ruby scripts with init scripts and cron jobs.
Or, you can just install from source. It's not hard, and it's not the debian way, but it'll get the job done. This may be preferable to installing some third party packages, where you may have no idea what they did during compile time, and how to get speedy updates in the case of a security vulnerability. Using RVM or installing manually from source, you can update whenever it's needed.

First run this:
apt-get update
Then install Ruby
apt-get install ruby
Then you need rubygems
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
Untar rubygems...
tar xvf rubygems-1.3.5.tgz
cd rubygems-1.3.5
ruby setup.rb
ln -s /usr/bin/gem1.8 /usr/bin/gem
Now update rubygems
gem update --system
And now we can install rails
gem install rails
You can check if the install was succesfull with the following commands:
ruby -v
rails -v
gem -v
If you need more help let me know!
If you want Ruby 1.9.2 replace the following commands:
apt-get install ruby
with
apt-get install ruby1.9
If you need the dev headers you can just install ruby1.9-dev.
apt-get install ruby1.9-dev
If you cant install them this way you need to look at your apt-get sources.
apt-cache search ruby1.9
libhtree-ruby1.9 - HTML/XML tree library for Ruby 1.9
....
libinotify-ruby1.9 - Ruby interface to Linux's inotify system
....
libdbm-ruby1.9 - DBM interface for Ruby 1.9
libgdbm-ruby1.9 - GDBM interface for Ruby 1.9
....
**ruby1.9-dev** - Header files for compiling extension modules for the Ruby 1.9
ruby1.9-elisp - ruby-mode for Emacsen
ruby1.9-examples - Examples for Ruby 1.9
**ruby1.9** - Interpreter of object-oriented scripting language Ruby 1.9
libstfl-ruby1.9 - Ruby bindings for the structured terminal forms language/library
I hope this helps.And i would suggest using RVM (but i didn't cover that here..)

RVM is a great solution, but not for production environments. Its $PATH magic is too finicky and breaks too often.
I'd suggest building a .deb for yourself. You compile Ruby from source, and then install it using checkinstall. Then you can distribute the .deb it creates to any machine, and install/uninstall it using dpkg like you would with any package.
Here's a tutorial that does this in Ubuntu; it should translate very easily to Debian.

Don't install any rubies by Debian, recently one of the main maintainer gives up on them: http://www.lucas-nussbaum.net/blog/?p=617
Debian's rubies used to be ugly and often broken, so the best way to install it is by now using rvm, a little program that manages gemset and different versions of rubies in the same machine.

If you want to install a package from the Lenny backports repository, you obviously need to have it in your sources.list:
deb http://Backports.Debian.Org/debian-backports lenny-backports main contrib non-free
deb-src http://Backports.Debian.Org/debian-backports lenny-backports main contrib non-free
Since the backports are not subject to the normal strict quality review that other packages are, they are disabled by default. If you want to install a package from the backports repository, you have to explicitly pass the distribution to apt-get or aptitude, just like with the experimental repository:
apt-get -t lenny-backports install ruby191-full # or
aptitude -t lenny-backports install ruby191-full
Since the backported packages are disabled by default, you won't even get security updates for them, unless you add a pinning in /etc/apt/preferences:
Package: *
Pin: release a=lenny-backports
Pin-Priority: 200
All of this is clearly spelled out on the Debian Backports website.
Note that you should be careful not to mix package management systems. You should either install all Ruby libraries via APT or via RubyGems, but it's generally not a good idea to mix them.
Also, if you use Debian's RubyGems package, you should only update it via APT, not via RubyGems's builtin update mechanism (gem update --system). Actually, I believe that in current versions, Debian has removed the update mechanism to prevent this, but it wasn't always the case.
Personally, I use the Debian Ruby packages without problems on a production server, and I don't use RubyGems at all, I only use the Ruby libraries provided by Debian.

was just going to add a comment to the original question, but I guess I haven't earned that priviledge yet...
Anyways, I found this helpful link and thought I would share it:
http://blog.binarybalance.com.au/2010/08/28/compiling-ruby-1-9-2-on-debian-lenny

Related

What's the best way to install ruby 2.4 on (K)Ubuntu 17.10?

I run Kubuntu, and would like to install the latest stable Ruby version, which as of writing is 2.4.2. Unfortunately, the Ubuntus are a bit behind: 17.10 has this:
$ ruby --version
ruby 2.3.3p222 (2016-11-21) [x86_64-linux-gnu]
$
I've googled, and seen lots of suggestions none of which are elegant. I don't want to use rvm (nothing wrong with it - I just want my "base" ruby updated). Building from source is OK, except that it will default at least, to installing under /usr/local somewhere, and will leave the old version in place. I'd like to upgrade to 2.4.2 - possibly using rvm to install 2.5.
I've have already tried using the suggestion in the comment below.
The ppa doesn't seem to have 2.4. When I use apt install ruby 2.4*, the * is a regex, so matches 2.{anything_or_nothing}, so tries to pull in 2.3, which is not what I want - eg
$ sudo apt install ruby2.4*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'ruby2.3' for regex 'ruby2.4*'
Note, selecting 'uwsgi-plugin-rack-ruby2.3' for regex 'ruby2.4*'
Note, selecting 'ruby2.3-dev' for regex 'ruby2.4*'
Note, selecting 'ruby2.3-doc' for regex 'ruby2.4*'
Note, selecting 'libruby2.3' for regex 'ruby2.4*'
Note, selecting 'ruby-ruby2ruby' for regex 'ruby2.4*'
Note, selecting 'ruby2.3-tcltk' for regex 'ruby2.4*'
libruby2.3 is already the newest version (2.3.3-1ubuntu1).
ruby2.3 is already the newest version (2.3.3-1ubuntu1).
ruby2.3-dev is already the newest version (2.3.3-1ubuntu1).
ruby2.3-dev set to manually installed.
The following additional packages will be installed:
libmatheval1 ruby-parser ruby-sexp-processor uwsgi-core
Suggested packages:
nginx-full | cherokee | libapache2-mod-proxy-uwsgi | libapache2-mod-uwsgi | libapache2-mod-ruwsgi uwsgi-plugins-all uwsgi-extra
The following NEW packages will be installed
libmatheval1 ruby-parser ruby-ruby2ruby ruby-sexp-processor ruby2.3-doc ruby2.3-tcltk uwsgi-core uwsgi-plugin-rack-ruby2.3
0 to upgrade, 8 to newly install, 0 to remove and 44 not to upgrade.
Need to get 4,444 kB of archives.
After this operation, 34.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] n
Abort.
Thank you.
Just add our repository, if you haven’t already:
$ sudo apt-add-repository ppa:brightbox/ruby-ng
$ sudo apt-get update
Install the packages:
$ sudo apt-get install ruby2.4 ruby2.4-dev
And you’re up and running:
$ ruby2.4 -v
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux-gnu]
Please do yourself a favor and install Ruby using RVM or rbenv.
Both solutions allow multiple Ruby versions to be installed alongside each other and offer an easy way out (rvm implode for example removed all traces of RVM without messing up your system) in case you mess something up.
If you REALLY want to install Ruby not using any version managers then your best bet would be: sudo apt-get build-dep ruby2.3 and compiling Ruby from source.

Ubuntu: How do I install ruby 1.8.7 specifically?

I can't use RVM, this is a server not just for me, so I can't have RVM attached only to my user. Is there a way to install RVM universally? or is there a command where I can specify the version of ruby I want?
The RVM Installation Guide covers a "Multi-User Install". It will walk you through installing RVM in /usr/local/rvm.
But... you may not need RVM...
If I recall correctly, Ubuntu's default Ruby is version 1.8.7. You can look in the Software Center or use Synaptic Package Manager for which Ruby version is available for install. If you want to see available Ruby packages from the command line then use sudo apt-cache search ruby. Once you determine the Ruby version is 1.8.7 then you can install it using your method of choice.
Usually only a very limited set of versions is available. You can see them with apt-cache policy <package>. If you see one you want, you can specify it with apt-cache install <package>=<version>.
More often, you would just build from source precisely the version you want. Downloading the deb file for a particular version and installing it with dpkg is also a possibility, but keep in mind that dpkg won't be able to download and install dependent packages.

How do I package a Ruby application for Ubuntu, including its gem dependencies?

I have a command-line utility called Maid that I currently distribute as a RubyGem. I'd also like to distribute it as a .deb package to make it easier for Ubuntu users to install.
Right now, Ubuntu users have to do quite a bit manually, especially for someone unfamiliar with Ruby:
sudo apt-get install ruby
sudo apt-get install rubygems
# Make sure `ruby` and `gem` are in `$PATH`
sudo gem install maid
maid version # example command
Ideally, I want a single command to install on a fresh Ubuntu installation:
sudo apt-get install maid
maid version # example command
The suite of gem2deb tools (gem2tgz, dh-make-ruby, etc.) are almost what I'm looking for. But by default gem2deb doesn't package any of the gem dependencies that are required. Maid is really simple and only depends on thor at runtime. (Edit: as Maid has evolved, and now has more dependencies.) But without that dependency, nothing works.
So, how do I package this Ruby application for Ubuntu and also include its gem dependencies? Are there any other tools I could use or tutorials/examples I could follow?
Because apt-get and gem are both dependency resolving, you can just make a meta package that depends on ruby1.9.1 (which itself brings in Rubygems and everything else). Then in the post-install script, just do a sudo gem1.9.1 install maid.
I can't lay out the whole process of making a package here, but there are a lot of good tutorials on it around the web.
Using fpm you can (among others) directly create debs from gems. The wiki has an extensive example. The gist of it is to call
cd /tmp
fpm -s gem -t deb maid

Prerequisites required for compiling Ruby 1.9.2 on Linux?

I am new to Ruby and RoR. I have a clean Linode instance with an Ubuntu image, and I want to compile Ruby from source instead of using apt-get. I have googled for instructions of doing this, but after some tries I keep on getting errors regarding missing zlib and some other packages when I try to run some tutorials samples.
Can anyone please give me detailed instructions (or a link) that would teach me how to get the necessary prerequisite packages installed before I compile Ruby from source?
My intent is to compile latest stable release of Ruby, then install Rubygems and Rails. Thanks for any help in advance!!!
This blog post covers the necessary packages and install process to compile ruby from source; it references Ruby 1.9.1 but it should work just fine with Ruby 1.9.2 as well. The real useful bit from this post is:
sudo apt-get -y install libc6-dev libssl-dev libmysql++-dev libsqlite3-dev make build-essential libssl-dev libreadline6-dev zlib1g-dev libyaml-dev
It looks like to me that a few of these are not essential unless you want to go on to use MySQL or SQLite, but otherwise this list of packages will get what you need to compile Ruby.
After that, I wouldn't recommend actually installing Ruby from source manually; I would use RVM (Ruby Version Manager) so you can install any version of Ruby you wish, now and later. RVM compiles the different versions of Ruby by downloading and compiling the source code, and will also install Rubygems for you.
Once you have installed rvm, you can use rvm requirements to get the current list of required packages.
You can use apt-get install all the build dependencies for any package. Enable your source repository and then run.
sudo apt-get build-dep ruby1.9 rails
This will install all the packages you will need to compile the source for these two packages. Then you can go get the latest source, and follow the instructions.
N.B.: Packages names may be wrong, depends on which version of Ubuntu you're using.
I HIGHLY recommend using 'RVM' to install all your rubies, especially if you're doing it just for your own use. RVM will do all the compilation for you, puts everything in ~/.rvm including the gems, and makes it easy to install multiple versions of Ruby and gems for testing.
Installation and using gems will get you running. RVM's Gemsets are powerful, and RVM's ruby command makes it nice for performing some action across all the installed Rubies RVM manages.
RVM also supports system-wide installations offering RVM's flexibility if you need it, but it's a bit more complicated and is unnecessary if you're on a single-user machine.
Why not install zlib? sudo aptitude install libz-dev
I've compiled from source, and it's pretty good at warning you when you are missing a dependency.

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