Install RoR on debian Squeeze - ruby-on-rails

is there any way to install Ruby 1.9.2 or 1.8.7 + Rails 3 on my debian squeeze?

You probably don't want to use RVM on a production machine. Its $PATH magic will break in non-obvious places (e.g. cron jobs), and you'll be up a creek.
You could simply build from sources and use checkinstall to create a .deb for yourself. Here's a tutorial for Ubuntu that should translate pretty well into debian.

First install rubygems, I think it's the only Debian package. Then (as Ruby gems):
rvm (install with it ruby 1.9.2, or Ruby version you want)
bundler
rails
And then you can manage application gems with Bundler.

Have you looked at railsready-debian-lenny (it is claimed to work on Squeeze too)? Don't forget to install dependencies pointed in readme.md

The steps below outlines installing Ruby On Rails as a normal user.
Check first if the user has sudo rights. To do this try executing a simple command
$sudo ls -a
[sudo] password for unlimit:
unlimit is not in the sudoers file. This incident will be reported.
If you see a message like above, you will need to add the user to the sudoer file, this can be done by
$echo 'unlimit ALL=(ALL) ALL' >> /etc/sudoers
Check if you have ruby installed. Execute the command below
$ruby -v
-[bash]: ruby:command not found
If you see something like this, this means ruby is not installed. Install it
$sudo apt-get install ruby
Install additional libraries
$sudo apt-get install build-essential
$sudo apt-get install curl
$sudo apt-get install libssl-dev
Install rvm
$curl -L get.rvm.io | bash -s stable
Set the rvm path
$source $HOME/.rvm/scripts/rvm
You should add this to the .bashrc file.
Fetch the latest rvm and reload it
$rvm get head && rvm reload
Install ruby 1.9.3
$rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm.usr
I needed to install the readline lib
$sudo apt-get install libreadline-dev
Get the rails gem
$gem install rails -v 3.2.3
Check if you have rails
$rails -v
Rails 3.2.3
Get the readline package
$rvm pkg install readline
Get sqlite3
$sudo apt-get install sqlite3 libsqlite3-dev
You are all set to create your first rails app
$rails new app HelloWorld
You can find more info http://unlimit.in/installing-ruby-on-rails-on-debian.html

The best way to install Ruby and any Gems you like is with RVM. It will compile the latest version of Ruby for you and give you tools to manage gemsets.
Relying on the distribution's packages is usually a bad idea, because they are typically out-of-date.

Related

rails new <app-name> requires password for gems installation in ./vendor/bundle

Your user account isn't allowed to install to the system RubyGems.
You can cancel this installation and run:
bundle install --path vendor/bundle
to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to RubyGems using sudo.
Password:
If it says that you don't have the priviliges, then you just need to run it with sudo
sudo gem install bundler --no-rdoc --no-ri
but I really recommend installing rbenv or rvm, to have a better control of the ruby versions and with that you don't need password or sudo command to install the gems.
I will guide you to install rvm here, this is for personal preference, but you con install rvenb too with the same result.
before anything else, you have to remove completely the ruby version that you have installed on this moment and all the gems
gem uninstall --all # maybe you will need sudo here
sudo apt-get purge ruby
first install mpapis public key
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
then install rvm
\curl -sSL https://get.rvm.io | bash
then add to .bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
add to .bash_profile
source ~/.profile
then you can install the ruby version that you want (i am using 2.3.0 here as an example, change for the version that you were working before on the app)
rvm install 2.3.0
with this you have installed ruby, I recommend to run this command if you would not use the documentation of gems in local
echo 'gem: --no-document' >> ~/.gemrc
then you can set the ruby version that you want to use, you have different options, select it manually everyime you open the terminal with
rvm use 2.3.0 # or the version that you want to use in that moment
or add to the gemfile the ruby version and rvm will select if for you everytime you make a cd to the path of the app adding this to your gemfile
source 'https://rubygems.org' # this is by default on your gemfile
ruby '2.3.0' # this is the line you need to add, change for the version that you want on he app
when you have the selected version of ruby, you have to install bundler gem, you need to run this just once by ruby version that you install
gem install bundle
then you can run bundle install on your app and will work like a charm.
With rvm you can have different versions of ruby on rails installed on your machine, an as I said, per version that you install you need to install the bundler gem once.
if you have differents version of ruby installed, I recommend that you add a default so if you haven't set the ruby version on the terminal in that session, it will take one by default, you can do it like this
rvm --default use 2.3.0
hope that this helps you to be clear.

ruby install rvm not working

I want to install rvm and geting problem. Here is my command which i run in ubnto 2.10 How can i do this?
root#jaskaran-Vostro-1550:/home/jaskaran# rvm install 2.1.0
The program 'rvm' is currently not installed. You can install it by typing:
apt-get install ruby-rvm
root#jaskaran-Vostro-1550:/home/jaskaran# apt-get install ruby-rvm
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ruby-rvm
Use this instead to install RVM:
curl -sSL https://get.rvm.io | bash
You can refer to official RVM Installation Page.
Once RVM is successfully installed, make it available in the current shell:
source /etc/profile.d/rvm.sh
Then you can install the Ruby version you want:
rvm install 2.1.0 to install Ruby version 2.1.0.
You probably want to clean up your environment first just like this post tells you to: Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v
You can also do this:
sudo apt-get install rvm
next you will have to source the
source /home/username/.rvm/scripts/rvm
after then you can go ahead and install by running
rvm install version
Hope this help another person.

Install Ruby on Rails using rvm on Ubuntu 12.04

I am trying to install Ruby on Rails using rvm on ubuntu 12.04. I am following the steps given in https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm , but I am unable to install Rails successfully. When I run gem install rails, it does nothing.
Previously, by using the above link, I have successfully installed it several times. But this time, i couldn't.
Output of
gem install rails -V:
HEAD https //rubygems.org/specs.4.8.gz 302 Moved Temporarily
HEAD https //s3.amazonaws.com/production.s3.rubygems.org/specs.4.8.gz
200 OK
GET https //rubygems.org/specs.4.8.gz
302 Moved Temporarily ...
GET https //rubygems.org/quick/Marshal.4.8/rack-1.4.5.gemspec.rz
302 Moved Temporarily
It always stops at this point. Need some guidance to successfully install it.
Step One — Install Ruby with RVM
Before we do anything else, we should run a quick update to make sure that all of the packages we download to our VPS are up to date:
sudo apt-get update
Once that's done, we can start installin
g RVM, Ruby Version Manager. This is a great program that lets you use several versions of Ruby on one server; however, in this case, we will just use it to install the latest version of Ruby on the droplet.
If you do not have curl on your system, you can start by installing it:
sudo apt-get install curl
To install RVM, open terminal and type in this command:
\curl -L https://get.rvm.io | bash -s stable
After it is done installing, load RVM. You may first need to exit out of your shell session and start up a new one.
source ~/.rvm/scripts/rvm
In order to work, RVM has some of its own dependancies that need to be installed. To automatically install them:
rvm requirements
You may need to enter your root password to allow the installation of these dependencies.
On occasion the zlib package may be reported as missing. The RVM page describes the issue and the solution in greater detail here.
Step Two — Install Ruby
Once you are using RVM, installing Ruby is easy.
rvm install ruby
The latest ruby is now installed. However, since we accessed it through a program that has a variety of Ruby versions, we need to tell the system to use the version we just installed by default.
rvm use ruby --default
Step Three — Install RubyGems
The next step makes sure that we have all the required components of Ruby on Rails. We can continue to use RVM to install gems; type this line into terminal.
rvm rubygems current
Step Four — Install Rails
Once everything is set up, it is time to install Rails. To start, open terminal and type in:
gem install rails
This process may take a while, be patient with it. Once it finishes you will have Ruby on Rails installed on your droplet.
i did this:
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
Hope, it helps.
Refer Installing rvm wih stable ruby, use this command
\curl -L https://get.rvm.io | bash -s stable --ruby
After successful installation of ruby, install rails as a gem.
gem install rails
The most basic Vagrant box you can find to get Rails on Ubuntu. (This uses Ubuntu 14, but you can just change the box, should work roughly the same).
https://github.com/joelgerard/rails-vagrant
Also, checkout the bootstrap.sh if you want straight forward BASH.

Installed Ruby, but installing RubyGems does not work

I just installed ruby on Ubuntu by running this command:
sudo apt-get install ruby1.9.1-full
Then I downloaded RubyGems, extracted it, and navigated to that directory. When I typed this command:
ruby setup.rb or sudo ruby setup.rb
I got this error:
The program 'ruby' is currently not installed. You can install it by typing:
sudo apt-get install ruby
How should I invoke my Ruby installation? Should I reboot? Any ideas what the problem is?
I think your problem is twofold:
Ruby1.9 bundles rubygems by default so there is no need to install manually.
Ruby will proabably be installed as ruby1.9.1-full and you might need to rename manually to ruby. A good solution is to use rvm.
Use:
sudo ruby1.9.1 setup.rb
or
sudo ruby1.9.1-full setup.rb

Can I install gems with apt-get on Ubuntu?

I am new to Ruby and just diving in. The Ruby tutorial says I should get the packaging system from here: http://rubyforge.org/frs/?group_id=126
I am on Ubuntu Linux. The page has a .tar and a .gem option for downloading. Which should I download?
Also, are gems exactly analogous to Java jars? And why do I need the gem packaging system if I can just download gems one by one as they are needed?
Ubuntu now have rubygems as a package
For Ubuntu 12:
sudo apt-get install rubygems
For Ubuntu 14.04:
sudo apt-get install rubygems-integration
On Ubuntu 16.04 and Ubuntu 18.04, both sudo apt-get install rubygems and sudo apt-get install rubygems-integration failed for me. Instead, I had to do this:
sudo apt-get install ruby-dev
If on Ubuntu 14.04 try below
sudo apt-get install rubygems-integration
First, download *.tar file, unpack this file, then go to rubygems directory in your console, and type
ruby setup.rb
That's it :)
If you install the full ruby application set with
sudo apt-get install ruby-full
You will get gems and much more by default. Tested on Ubuntu 16, it could also work on other version.
For me in Ubuntu 20.04 I did 3 things to create a new Ruby and Rails app.
Install Ruby development version
sudo apt install ruby-dev
Install rails from gem
sudo gem install rails
Create new application
rails new blog
I got error while installing rails(sudo apt install rails) only, So I installed devlopment version. I got permission related error while not using Sudo as well while installing gems and rails.
For Ubuntu
First install ruby:
sudo apt install ruby
Note that : sudo snap install ruby will throw this error :
error: This revision of snap "ruby" was published using classic
confinement and
thus may perform arbitrary system changes outside of the security
sandbox that snaps are usually confined to, which may put your system at
risk.
If you understand and want to proceed repeat the command including
--classic.
Finally, download latest tar version of ruby gems here:
https://rubygems.org/pages/download
Unzip and cd to the folder and finally type in terminal:
sudo ruby setup.rb

Resources