Installing Ruby on Rails on Linux mint? - ruby-on-rails

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.

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.

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.

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

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