RVM forgets settings across reboot (ubuntu 20.04) - ruby

Stuck.
I thought I installed RVM on this fresh ubuntu 20.04 box using the same commands I used on my old 19.10 box:
(from https://github.com/rvm/ubuntu_rvm)
sudo apt-add-repository -y ppa:rael-gc/rvm
sudo apt update
sudo apt install rvm
rvm install ruby
sudo apt install ruby-bundler
echo 'source "/etc/profile.d/rvm.sh"' >> ~/.bashrc
source ~/.bashrc
rvm use 2.7.0
rvm gemset create FOO
rvm gemset use FOO
gem install jekyll
gem install bundler
bundle install
However, my gemsets and ruby installs seem to disappear each time I reboot now. (This was not a problem before.)
My current workaround:
When bundle exec jekyll serve fails, I run these commands to get it working again:
rvm use --default 2.7.0
rvm gemset create FOO
rvm gemset use FOO
gem install jekyll
gem install bundler
bundle install
I thought I have read the relevant docs at rvm.io, but clearly I am missing something...

Related

I want to run wpscan on Ubuntu vps server, but getting ruby errors

Firstly i installed wpscan on ubuntu by following these methods
apt-get install git
sudo apt-get install libcurl4-openssl-dev libxml2 libxml2-dev libxslt1-dev ruby-dev build-essential libgmp-dev zlib1g-dev
git clone https://github.com/wpscanteam/wpscan.git
cd wpscan
sudo gem install bundler && bundle install --without test development
Then when i run it by typing ruby wpscan.rb
it said
Could not find ffi-1.9.18 in any of the sources
Run `bundle install` to install missing gems.
when i run bundle install i got that output
extconf failed, exit code 1
Gem files will remain installed in /var/lib/gems/2.4.0/gems/ffi-1.9.18 for
inspection.
Results logged to
/var/lib/gems/2.4.0/extensions/x86_64-linux/2.4.0/ffi-1.9.18/gem_make.out
An error occurred while installing ffi (1.9.18), and Bundler cannot
continue.
Make sure that `gem install ffi -v '1.9.18'` succeeds before bundling.
In Gemfile:
typhoeus was resolved to 1.3.0, which depends on
ethon was resolved to 0.10.1, which depends on
Help will be appreciated , thanks
INSTALL RMV
Pre-requisites
sudo apt-get install software-properties-common
Add the PPA and install the package
sudo apt-add-repository -y ppa:rael-gc/rvm
sudo apt-get update
sudo apt-get install rvm
sudo usermod -a -G rvm $USER
Change your terminal window
At terminal window, click Edit > Profile Preferences, click on Title and Command tab and check Run command as login shell.
Edit Profile
3.Reboot
A lot of changes were made (scripts that needs to be reloaded, you're now member of rvm group) and in order to properly get all them working, you need to reboot (in most cases a logout/login is enough, but in some Ubuntu derivatives or some terminal emulators, a shell login is not performed, so we advise to reboot).
Enable local gemsets
Now enable local gemsets. Open a terminal (Ctrl+Alt+T) and run:
rvm user gemsets
Install a ruby
Now you're ready to install rubies. Open a terminal (Ctrl+Alt+T) and run:
rvm install ruby
RVM Usage
man rvm
INSTALL - WPSCAN
From RubyGems
gem install wpscan
You can update the local database by using
wpscan --update
Enumerating usernames
wpscan --url https://target.tld/ --enumerate u
Enumerating a range of usernames
wpscan --url https://target.tld/ --enumerate u1-100
Doc>> https://github.com/wpscanteam/wpscan/wiki/WPScan-User-Documentation

Ruby Gems : sudo gems not showing with gems

I have a sudo rights on my ssh user. I can not run sudo bundle install command but can run bundle install without sudo.
Once I run the bundle install, Few gems get install but those who need gcc and c++ compiler I have to install in sudo permissions like sudo gem install json -v '1.8.0'.
Now if I try to run bundle that gem is not available due to installed with sudo permission.
Is there any other way to install such compiler gems without sudo?
I was not getting the right environement for installing ruby and gemsets . But
rvmsudo worked for me
I tried installing those gems which required compiler like
rvmsudo gem install json -v '1.8.0'
And it worked for me.
I am having only local user access which does not have any rights to run commands like yum

Installing Compass & Susy on Ubuntu 12.04

I'm trying to install Compass and Susy on my Ubuntu 12.04.
What I have tried are the following steps on the console:
sudo apt-get install rubygems1.8
sudo gem install rubygems-update # Instead of sudo gem update --system
sudo update_rubygems
sudo gem install compass # Installing Compass & Sass
sudo gem install susy
So the gems are installed and will be listed when I do the following command:
gem list
But now, when I try to create a new compass project with
compass create project
I get the following error:
/usr/local/bin/compass: /usr/bin/ruby1.9.1: bad interpreter: No such file or directory
My current ruby version is 1.8.7. So I installed ruby 1.9.1 and get it working.
The console still says the current ruby version is 1.8.7
My question: Do I have to run with both ruby versions to get that working? Is there another way under ubuntu? It's working, I know, but it's a bit confusing.
Using Ubuntu's package manager for multiple ruby versions is a bit of a lost cause.
Most people use rvm, which allows you to install and switch between multiple rubies very easily.
Other popular options are rbenv and chruby. It's just a question of personal preference, but I'd say that rvm has the slight edge for beginners.
Also, I wouldn't recommend installing ruby 1.9.1 - it's best to use 1.9.3 as there are some compatibility issues with other 1.9.x versions.
You can then install compass and sass via ruby gems (rather than aptitude):
$ gem install compass
$ gem install sass
This simple command works on ubuntu 14.10
sudo apt-get install ruby-compass
RVM is awesome and really easy to install. I managed to install rvm, compass, and sass with these commands in my terminal:
Firstly:
curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled --ruby=1.9.3
This will instal rvm, it will put a command in ~/.bash_profile to load rvm automatically, except this isn't what Ubuntu uses so put this line into your ~/.bashrc file:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
Then simply run:
gem install compass
gem install susy #(or sass)
Install build-essentials and ruby-dev packages to install compass without errors.
sudo apt-get install build-essential
sudo apt-get install ruby
sudo apt-get install ruby-dev
sudo gem install compass
Masterchief's answer is close, but didn't work for me. This web page provided a clear and reliably working way to install rvm on my ubuntu server instance: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

Failed to build gem native extension when install RedCloth-4.2.9 install Linux

I want to install Octopress in my computer.
I try to do it like
Octopress document.
When I run
bundle install
I got error message
An error occured while installing RedCloth (4.2.9), and Bundler cannot continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
So, I run
sudo gem install RedCloth -v '4.2.9'
then, I got a error message again:
ERROR: Error installing RedCloth:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
I hadn't learn any knowledge about ruby.
My ubuntu 12.04 solution is install the ruby1.9.1-full version, that can resolve this issue.
sudo apt-get install ruby1.9.1-full
you can execute command:
sudo update-alternatives --config ruby
to select the altiernative ruby which you have installed.
and then, execute below commands to finish the octopress deploy:
git clone https://github.com/erizhang/octopress.git octopress
cd octopress/
sudo gem install bundler
sudo gem install RedCloth -v '4.2.9'
bundle install
rake install
below commands you can find from octopress deploy guideline page:
rake setup_github_pages
sudo rake setup_github_pages
sudo rake generate
sudo rake deploy
Hope it's helpful for you, thanks
I was installing Octopress too and got the same problem as yours. After checking the mkmf.log file I figured out that gcc-4.2 had not been found. I Even installed xcode with the command line tools. It worked when I made a symlink like this:
$ sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
$ bundle install
I fixed this issue by running
sudo apt-get install ruby-dev
as described in this blog post.
You've probably upgraded to Mountain Lion and have not rebuilt your ruby-1.9.2 install yet with the new development packages.
rvm --force install 1.9.2
gem install bundle --no-ri --no-rdoc
bundle install
If you don't have the Mountain Lion dev packages installed correctly, use the ThoughtBot instructions.
For Ubuntu 14.04 simply do this:
sudo apt-get install ruby1.9.3
Should work for 13.10 and 13.04 too. (Not tested)
it apears you are not using rvm for managing your ruby installation. I think best would be to try rvm, here's a very good guide, you can stop without installing rails: ruby with rvm
Then simply
$gem install RedCloth
Unmanaged ruby gems are a pain, I try to avoid them.
None of the answers worked on my Ubuntu 14.04.1 LTS. Upgrade to ruby 2.0 fixed the problem for me:
sudo apt-get install ruby2.0 ruby2.0-dev
sudo ln -s /usr/bin/ruby2.0 /usr/bin/ruby
sudo ln -s /usr/bin/gem2.0 /usr/bin/gem
sudo gem install bundler
Make sure you also have the build-essential package installed. You can check using
dpkg -l | grep build-essential
or simply install it without checking
sudo apt-get install build-essential
For me on Ubuntu 14.04.1 LTS, after making sure build-essential is installed, the bundle install command works/builds fine also with Ruby 1.9.3.

cannot load such file -- zlib even after using rvm pkg install zlib

I installed zlib package and ruby 1.9.3 using rvm, but whenever I try to install
gems it says
cannot load such file -- zlib
The commands I used to install are
$ rvm install 1.9.3
$ rvm pkg install zlib
$ rvm reinstall 1.9.3 --with-readline-dir=/home/username/.rvm/usr \
--with-iconv-dir=/home/username/.rvm/usr \
--with-zlib-dir=/home/username/.rvm/usr \
--with-openssl-dir=/home/username/.rvm/usr
$ rvm use 1.9.3
$ gem install heroku
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
All the help on this subject tells me to just do rvm pkg install zlib, and
then reinstall the ruby with --with-zlib-dir=/home/username/.rvm/usr, but this
didn't work.
I ended up installing zlib from apt-get and then reinstalling ruby to not use the rvm directory for zlib.
Here's how do:
$ sudo apt-get install zlib1g-dev
$ rvm reinstall 1.9.3
[Edit] As commenter #chrisfinne mentions, on CentOS/RedHat based systems:
$ sudo yum install zlib-devel
$ rvm reinstall 1.9.3
The both other responses were almost right...
The rvm site for zlib provides a quick fix!
On the top off the page is a "Quick fix" follow it's instructions, it will:
fix your installation,
provide you instructions what to do to install zlib from your system
and show how to reinstall ruby
Use autolibs to install dependencies:
rvm autolibs enable
rvm reinstall 1.9.3
RVM will automatically install missing dependencies and use them for compiling ruby.
More details on autolibs => http://rvm.io/rvm/autolibs
The solution that worked for me is described in rvm github repo, issue #3389.
Run
rvm install 2.3.0 --with-zlib-dir=/usr/local/Cellar/zlib/1.2.8
for ruby 2.3.0 version.
Ruby has a bunch of package dependencies like the one on zlib-devel. They're nasty because there's nothing to indicate you need the library until get some obscure error message while trying to do something routine.
The solution is to use rvm. Use it even if you only need one version of ruby. Why? Because then you can do
rvm requirements
This will probe your particular OS and produce a set of commands you can copy back to the command line to install those missing packages.
rvm pkg install openssl && rvm pkg install zlib && rvm pkg install libyaml &&
rvm pkg install iconv
rvm install 1.9.3-p0 --with-opt-dir=$HOME/.rvm/usr \
--with-libxml2-dir=/usr/local/Cellar/libxml2/2.7.8 \
--with-readline-dir=/usr/local/Cellar/readline/6.2.1

Resources