RVM installed ruby not found after restart of shell Ubuntu 16 - ruby-on-rails

I've installed RVM and ruby and at first it seemed to work, but whenever I open a new shell tab or window only rvm can be found, not ruby.
Running rvm -v gives me a nice little output:
rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
but running ruby -v, gem -v or rails -v gives me an error telling me to apt-get install ruby/rails.
I've installed rvm through the following commands:
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
I installed ruby like so:
rvm install 2.3.1
rvm use 2.3.1 --default
Rails was installed with the command:
gem install rails
What I've tried:
I've checked my .bashrc .bash_profile and my .profile and it's set up nicely with the following:
.bashrc and .profile :
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
.bash_profile:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
What kinda works:
Running the line source ~/.rvm/scripts/rvm allows ruby, gem, and rails to be found again, but you have to repeat this is every new tab or window.
How can I fix so that rvm installed modules will work automatically?

Turns out everything is set up nicely and correct. If you have this issue it's an issue with your shell settings. You need to set your profile to login shell.
How to set this in the standard terminal on Ubuntu's standard GUI
(GNOME terminal Unity)
Access your settings by going to the menu and pic Terminal > Preferences.
In the window that pops up, select Profiles in the tab menu. Pick if you want to create a new profile or edit the existing default one. In the window that comes up (it's the same regardless of your pic) go to the tab Command and enable Run command as a login shell.
Restart your terminal and you should find that your rvm commands are now working.

What about adding to your .profile or .bashrc
echo "source $HOME/.rvm/scripts/rvm" >> ~/.profile
EDIT
You need to call source from either .profile or .bashrc NOT .bash_profile
jperez#asus-kubuntu16:~$ grep bash_profile .profile
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
jperez#asus-kubuntu16:~$

In Deepin Terminal run:
sudo nano ~/.config/deepin/deepin-terminal/config.conf
and change run_as_login_shell=false to true

> sudo apt-get update
> sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev
> sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
> gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
> \curl -sSL https://get.rvm.io | bash -s stable
> source ~/.rvm/scripts/rvm
> rvm install 2.3.1
> rvm use 2.3.1 --default
> ruby -v

Related

How to install a specific version of ruby-dev on termux

I'm trying to setup ruby on rails environment on termux on android. I want to use 2.1.10 ruby. All I found was apt install ruby-dev or pkg install ruby-dev which installs the latest version of ruby. any suggestions?
You can install rvm.
0. Recomendation: install tmux and zsh, and change zsh as default shell. Oh my Zsh worked. Powerline fonts too (by install termux-style script)
Let's install rvm:
1. Install gawk, curl and tar packages:
apt install curl gawk tar
2. Go to rvm.io site and just copy 'Install RVM' command, look' like:
curl -sSL https://get.rvm.io | bash -s stable
3. Add this line [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" to your ~/.bashrc or ~/.zshrc file
4. Now your shell must writing a syntax PS problem, just open rvm script and edit it:
vi ~/.rvm/scripts/rvm
Now you must found a block like:
case "`uname` in
(CYGWIN*|MINGW*)
... etc ...
Just replace the 3 initialization variable __shell_name strings with this:
__shell_name="gawk 'BEGIN{RS=\"\"}; NR==1{print; exit
}' /proc/$$/cmdline | tr - '\0'" ;;
Restart shell
Now you can install ruby from rvm. Usage at rvm.io
P.s.: jruby not supported while you don't found solution for install jdk and jre from Termux).
P.s.: sorry for bad English.
apt install ruby-dev installs ruby 2.5.1-1
And that's the latest version, I think.

I have run command rvm intall and get error

I want to install rvm, but I get this error. How do I remove this error?
root#jaskaran:/# ruby -v
The program 'ruby' can be found in the following packages:
* ruby1.8
* ruby1.9.1
Try: apt-get install <selected package>
//--------------------------------------------------------------
here#jaskaran:/$ rvm install 2.1.0
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/12.10/i386/ruby-2.1.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system................
Error running 'requirements_debian_update_system ruby-2.1.0',
showing last 15 lines of /home/zapbuild/.rvm/log/1396242152_ruby-2.1.0/update_system.log
++ case "${TERM:-dumb}" in
++ case "$1" in
++ [[ -t 2 ]]
++ return 1
++ printf %b 'There has been error while updating '\''apt-get'\'', please give it some time and try again later.
For 404 errors check your sources configured in:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list
\n'
There has been error while updating 'apt-get', please give it some time and try again later.
For 404 errors check your sources configured in:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list
++ return 100
Requirements installation failed with status: 100.
Thanks
To install rvm run this.
$ \curl -sSL https://get.rvm.io | bash
Or in case you just want to update your rvm with the available ruby list, use rvm get stable. Now install ruby using rvm install ruby-2.1.0 or rvm install 2.1.0. This should fix the issue
I ran into the same issue on ubuntu 14.04 today.And I removed broken source in source.list and source.list.d/*.And it just worked fine for me.
After that you can run
sudo apt-get update
rvm requirements
Hope that is helpful.
Remove PPA sources from software setting and run these commands in your terminal:
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.1.3
rvm use 2.1.3 --default
ruby -v
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
gem install rails
rails -v

rails install - ERROR ... executing gem ... (OpenSSL::SSL::SSLError) SSL_connect ... read server hello A: wrong version number

I am very new to Linux (been living in MS world for many years). I thought I'd try something different, like ruby on rails under linux. Been trying to get a dev machine set up, and I must say, it's been quite overwhelming! Here is what I have done so far, and my current problem that I cannot figure out:
Installed Linux Mint 15 (was this a bad choice? the only reason I ask is all the difficulties I've had so far)
Ran the update manager and installed all updates.
Install git
sudo apt-get install git
Install rbenv
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
Install ruby-build as a rbenv plugin
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
Install opensssl (the ruby install fails if I don't do this)
sudo apt-get install libssl-dev
Install ruby
rbenv install 2.0.0-p247
Set my ruby version
rbenv global 2.0.0-p247
Install rails
gem install rails
This fails with
Fetching: i18n-0.6.5.gem (100%)
Successfully installed i18n-0.6.5
ERROR: While executing gem ... (OpenSSL::SSL::SSLError)
SSL_connect returned=1 errno=0 state=SSLv3 read server hello A: wrong version number
So apparently, there's still something not quite right with the ssl lib? Either that or I've taken a wrong step somewhere? Please help, thanks!
I am pretty new in linux world.
I was having exactly the same problem after following the same steps.
In my case it got solve just doing:
gem update --system
After that the rails installation gave me no prob.
Hope is just that!
I'm running rails 4 with ruby 2.0 on Linux Mint 15.
I did:
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
and it worked for me. Maybe this helps

Installation error with RVM stable version

I want to install RVM along with Ruby 1.9.3 and Rails 3.2.9. I have tried to install rvm using the following command,
\curl -L https://get.rvm.io | bash -s stable --rails
--autolibs=enabled # Or, --ruby=1.9.3
But, I am getting the following error.
Upgrade Notes:
* WARNING: You're using ~/.profile, make sure you load it,
add the following line to ~/.bash_profile if it exists
otherwise add it to ~/.bash_login:
source ~/.profile
* No new notes to display.
# RVM: Shell scripts enabling management of multiple ruby environments.
# RTFM: https://rvm.io/
# HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)
# Cheatsheet: http://cheat.errtheblog.com/s/rvm
# Screencast: http://screencasts.org/episodes/how-to-use-rvm
# In case of any issues run 'rvm requirements' or read 'rvm notes'
Upgrade of RVM in /home/local/.rvm/ is complete.
ajesh.co,TION
#
# Thank you for using RVM!
# I sincerely hope that RVM helps to make your life easier and
# more enjoyable!!!
#
# ~Wayne
rvm 1.19.6 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
Searching for binary rubies, this might take some time.
Installing requirements for ubuntu, might require sudo password.
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
Please help. Thanks. :)-
The packages were not installed as apt-get was halted while executing, leaving apt in a locked state.
You can delete the lock file with
sudo rm /var/lib/apt/lists/lock
you may also need to delete the lock file in the cache directory
sudo rm /var/cache/apt/archives/lock
after that try the installation command again
I had the same problem. I followed this tutorial, now I'm up and running:
http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/
use following steps you will get solution:
1)sudo apt-get -y install curl
2)curl -L get.rvm.io | bash -s stable
3)source ~/.rvm/scripts/rvm
4)sudo apt-get -y install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion
5)rvm install 1.9.3-p374
6)gem install rails -v 3.2.9

Can't install Ruby on Rails with RVM on Ubuntu 13.04

I am trying to install RVM on my Ubuntu machine.
I have used curl to get RVM, but some RVM commands (install, requirements) throw this apt-get error:
There has been error while updating 'apt-get', please give it some time and try again later.
For 404 errors check your sources configured in:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list
type rvm | head -1 returns
rvm is a function
-bash: type: write error: Broken pipe
which gem
/usr/bin/gem
I have checked the "Run command as a login shell" option
Steps followed from this tutorial:
sudo apt-get install curl
curl -L get.rvm.io | bash -s stable --auto
. ~/.bash_profile
rvm requirements - doesn't work properly
I have also looked at the official RVM documentation, but it seems to be very similar.
Any ideas?
UPDATE: I managed to do it. I disabled all the third party ppa URLs and it installed smoothly.
There are some important packages your system needs before install rvm. Run at the terminal:
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 nodejs
Then install rvm with:
curl -L https://get.rvm.io | bash -s stable --ruby
Now you need to put a setting in your .bashrc to add rvm to PATH for scripting. Run:
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
Open a new terminal and test rvm.
run
sudo apt-get update
sudo apt-get install build-essential
and then try again.
Hye Guys!!
I got the solution. Actually error is because the information we need for installation is not available at sever define for software & update. I change it to from my local "Server from India" (In my case) to "Main Server".
It's working perfectly for me now :)
I was having the same problem with my install, and then I fully read the details that terminal left once the install was finished.
Try using source /usr/local/rvm/scripts/rvm
Once I did that, the function type rvm | head -1 returned rvm is a function
In my Case i fixed the error by:
rvmsudo rvm install 1.9.3
rvm --default 1.9.3
rvmsudo rvm remove 1.9.3
rvm install 1.9.3
Source
Try disabling repository which appear at 404 sudo apt-get update or viewing logs rvm. The fact is that when you install rvm is trying to update a list of your packages and if you have 404 to go to bed =)
\curl -L https://get.rvm.io | bash -s stable --ruby .
paste this in your terminal window.I used this.It worked for me.for RVM for ruby
\curl -L https://get.rvm.io | bash -s stable --rails .
Use these to install RVM with ruby on rails
For people that know nothing about Linux or are newbies to Linux (like me) those are steps how to solve this (explanation, that was given above, was not that clear for me :) ).
Go to Package Manager, tab Settings, Preferences
In the opened window you'll see Other Software tab or something like that with links to servers. In my case one of these (it's mentioned in the error log that was produced by rvm) was causing errors and was not available (404 errors). I just unchecked it.
run rmv dependencies only when you closed Package Manager, or you'll get error saying that something is locked at the moment.
And everything now is installed successfully! :)
The most common symptom of this problem occurs (as seth2810 hinted at) with non-zero exit codes from an apt-get update command, which rvm requirements expects. You should run this command yourself (with sudo) and check for any problems.
If you have 404s in the output, check that the package sources for the bad URLs are still correct/current. You can remove package sources more easily with sudo apt-get install software-properties-common, followed by sudo add-apt-repository --remove {URL_OF_PROBLEM_PACKAGE_SOURCE} for each failed url.
If you have something hinting at packages with 'unmet dependencies', try sudo apt-get -f install. This command attempts to fix incomplete installs by fetching missing packages and works most of the time. Otherwise... by this point you probably have a more specific error to google for anyway!

Resources