rvm installation on Ubuntu for managing different rails applications - ruby-on-rails

I need to install rvm on a new Ubuntu machine.
I would use rvm to switch to different ruby versions and gemsets required by different Ruby on Rails applications.
rvm suggests to use the Ubuntu package.
However Internet documentation on Rails on Ubuntu, such as at RailsApp, suggests to install rvm using instead the curl command with the --ruby or --rails options and the --autolibs=enable option for avoiding missing libraries:
$ \curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enable
I could not find information specific to the --rails option, so I do not understand what it does, install only the rails gem or install rails plus other gems useful for the rails environment, like bundler and json for instance. There is a bug however: RVM does not install Rails when invoked with curl.
Considering that I do not need the rails gem in the global gemset, supposing that the above bug will soon be fixed, what is in the end the best choice for installing rvm in Ubuntu: the Ubuntu package or the curl command with the (hopefully explained) --rails option plus the --autolibs=enable option?

It depends on your Ubuntu Version.
lsb_release -a
Then you can search for the instructions based on your Ubuntu Release.
For example I am using Linux Mint based on Ubuntu Xenial 16.
Ubuntu uses the apt package manager to install packages
To find packages type in your terminal
apt search rvm
it will return a list of packages. To learn more about apt use:
apt --help
apt <command> --help
man apt
To install RVM you need to always reference their official webpage or github page
For ubuntu RVM has an official Ubuntu Page which give you the following instructions:
https://github.com/rvm/ubuntu_rvm
Follow those instructions

Related

How to uninstall RVM in Ubuntu 18.04 completely?

I tried uninstalling rvm in Ubuntu LTS 18.04 using the following command:
rvm implode
After uninstalling, I tried installing it again using the following command:
sudo apt-get install rvm
But re-installation was unsuccessful and when I run rvm I get the following:
rvm: command not found
What are the steps to correctly remove rvm?
After the command rvm implode you should run gem uninstall rvm to make sure there's nothing left in your Ruby system install pointing to your rvm folder.
Usually, in order to remove what you have, sudo apt-get remove rvm should suffice, else try adding the --purge flag like in sudo apt-get remove rvm --purge. I understand you wanted to use the built-in command though. I don't know where you found the instructions you have followed, but it's weird that they didn't insist on the next step (uninstalling the gem).
For reinstalling, RVM has a dedicated Ubuntu package.
My advice is to do what I did to install it on my work computer, which was running Ubuntu. It's all listed here, but to take you through it:
Add the offical repository, update and install
sudo apt-add-repository -y ppa:rael-gc/rvm
sudo apt-get update
sudo apt-get install rvm
You'll have a group 'rvm' among your user groups. Add your user to it
sudo usermod -a -G rvm <yourusername>
In the link I included you'll find the instructions to have your terminal (assuming you're using Gnome as your Desktop Environment) login every time you reboot, enable local gems, install and change versions of Ruby and more.
According to the official information it souldn't work with just apt-get.
Visit this page and follow the steps.

What is appropriate way to install ruby on Ubuntu 14.04

I have a computer serves as a server. I have bitnami-gitlab stack on it. And now I want to install my rails app to this server. The thing confuses me, bitnami-gitlab has ruby interpreter and other apps (rails , gem, bundler etc.). Gitlab application uses git user on ubuntu. When I type;
sudo su git
which ruby
It gives me the directory of ruby which is inside of bitnami installation directory. Now, I want to install ruby, rails, apache and passenger to deploy my rails app. What is the appropriate way to do? I want to start my rails app as boot time. Should I install ruby to root user or my own user?
When I install ruby, will my gitlab application crahs?
Here is how I do it >
First, update apt-get:
sudo apt-get update
Then if you do not have it install Curl, for installing RVM
sudo apt-get install curl
Then run the appropriate RVM install there are multiple options like added rails, puma JRuby etc. check RVM website for more info. For just ruby run >
\curl -L https://get.rvm.io | bash -s stable
Now exit the shell session and start a new one
source ~/.rvm/scripts/rvm
RVM has its own requirements that can be auto installed by running >
rvm requirements
Now managing you ruby environments is easy and you can have multiple versions without making a mess.
To install any ruby version you need just run (x.x.x) version of the ruby>
rvm install x.x.x
To list versions you have installed run >
rvm list
Note also that now you can specify in your GEMFILE what version to use. Simply add ruby 'x.x.x' and rvm uses the version you specified as long as its already installed. Not having it raises error.

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.

Installing Ruby on Rails on Linux mint?

When I used "sudo apt-get install ruby-full build-essential" in the terminal I got this:
$ sudo apt-get install ruby-full build-essential
Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/packages.medibuntu.org_dists_quantal_non-free_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.
Can anybody tell me how can I install Ruby on Rails in my Linux Mint machine?
I think you don't need features of rvm. You just want to install ruby easy, fast and without troubles, right? Good news to you. We got an alternative to rvm. It's called rbenv. You can find an installation guide here.(don't skip ruby-build, it is necessary!).
And yes, follow ubuntu instructions since Mint is build on it (though there's debian-based version but I suppose you use ubuntu-based one).
I installed yesterday Mint 16 and rbenv on it. Works fine.
PS: don't forget to sudo apt-get install build-essential first.
I actually use Mint on my main development system. I'd also recommend using RVM to manage all your Ruby and Rails installation/versions. The command to install it is:
\curl -L https://get.rvm.io | bash -s stable
You can also append --ruby and --rails to get (I believe) the most recent versions of the two of them. I'd recommend not using apt-get for installing Ruby, as I've noticed that it can be out of date and/or lead to strange errors like those that you're seeing. You can get more information from the RVM website. I really enjoy using Mint, so I hope that helps.
Use rvm to install Ruby then simply install rails gem , but before that fix your repository related problem.
sudo rm -rf /var/log/apt/list
sudo apt-get update
sudo apt-get upgrade
Then install rvm see rvm.io for installation info
If you are new want to setup everything from start then see this blog post
https://www.computersnyou.com/4235
Use rbenv
instead, use this link DigitalOcean since mint is an ubuntu based distro, it will work.

Install RoR on debian Squeeze

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.

Resources