0

I'm trying to install Ruby 2.6.1 on Ubuntu but keep coming across this error.

Have tried uninstalling Ubuntu, googling the problem, running in administrator mode, downloading a different version.

This is the error:

:~$ rvm install 2.6.1
Searching for binary rubies, this might take some time.
Found remote file    https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/20.04/x86_64/ruby-2.6.1.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
mkdir: cannot create directory ‘/usr/share/rvm/log/1625135668_ruby-2.6.1’: Permission denied
tee: /usr/share/rvm/log/1625135668_ruby-2.6.1/update_system.log: No such file or directory
Updating system..jaydene password required for 'apt-get --quiet --yes update':
Sorry, try again.
jaydene password required for 'apt-get --quiet --yes update':
..
Error running 'requirements_debian_update_system ruby-2.6.1',
please read /usr/share/rvm/log/1625135668_ruby-2.6.1/update_system.log
Requirements installation failed with status: 1.
:~$
spickermann
  • 100,941
  • 9
  • 101
  • 131
Jaydene
  • 11
  • 1
    I'd suggest that it looks like `rvm` might have been `sudo` installed ... `mkdir: cannot create directory ‘/usr/share/rvm/log/1625135668_ruby-2.6.1’: Permission denied` ... you will have better luck if you de-install rvm and then install it for the user, rather than for the system. – Jad Jul 01 '21 at 10:45
  • Thank you! I have uninstalled rvm and now I am having trouble re-installing during the last step. Any ideas? $ source /etc/profile.d/rvm.sh -bash: /etc/profile.d/rvm.sh: No such file or directory – Jaydene Jul 02 '21 at 03:51
  • you'll need to remove that file from the disk, and make sure that rvm is configured in your local .bashrc file – Jad Jul 02 '21 at 13:58

2 Answers2

0

you can use a gorails website to checkout ruby on rails installation. And ruby installs version as per dependencies on your system. If it's not founding 2.6.1 it will install next supported version for ex. 2.6.7. check this website: https://gorails.com/setup/ubuntu/21.04

0

Check this: How do I install Ruby 1.9.3 on Ubuntu without RVM? but SO says to avoid link answers so here is the script:

#!/usr/bin/env bash
# -- this really is the only solution that worked for me on snap :/

ruby -v
if ! command -v ruby &> /dev/null
then
    echo "Going to try to install ruby (ideally 3.1.2)"
    # - install rebenv (following ruby-build really is needed eventhough it doesn't look like it)
    mkdir -p ~/.rbenv
    cd ~/.rbenv
    git clone https://github.com/rbenv/rbenv.git .
    # if $HOME/.rbenv/bin not in path append it, otherwise don't change it
    echo $PATH | tr ':' '\n' | awk '{print "  " $0}';
    if [[ ":$PATH:" != *":$HOME/.rbenv/bin:"* ]]; then
      echo "might want to put $HOME/.rbenv/bin in your path"
      export PATH="$HOME/.rbenv/bin:$PATH"
#      echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc.lfs
    fi
    eval "$(rbenv init -)"
    rbenv -v

    # - install ruby-build, odd, this really is needed for ruby to install despite it not looking like ruby build is need at the bottom
    mkdir -p ~/.ruby-build
    cd ~/.ruby-build
    git clone https://github.com/rbenv/ruby-build.git .
    # if $HOME/.ruby-build/bin not in path append it, otherwise don't change it
    echo $PATH | tr ':' '\n' | awk '{print "  " $0}';
    if [[ $PATH != *"$HOME/.ruby-build/bin"* ]]; then
      echo "might want to put $HOME/.ruby-build/bin in your path"
      export PATH="$HOME/.ruby-build/bin:$PATH"
#      echo 'export PATH="$HOME/.ruby-build/bin:$PATH"' >> ~/.bashrc.lfs
    fi
    ruby-build --version

    # - install ruby without sudo -- using rbenv
    mkdir -p ~/.local
    #    ruby-build 3.1.2 ~/.local/
    rbenv install 3.1.2
    rbenv global 3.1.2
fi
ruby -v

# - Original Prover doesn't work on SNAP
# Proverbot's way to install ruby
#    # First, install Ruby, as that is for some reason required to build the "system" project
#    git clone https://github.com/rbenv/ruby-build.git ~/ruby-build
#    mkdir -p ~/.local
#    PREFIX=~/.local ./ruby-build/install.sh
#    ~/.local/ruby-build 3.1.2 ~/.local/
# ref: https://superuser.com/questions/340490/how-to-install-and-use-different-versions-of-ruby/1756372#1756372

Charlie Parker
  • 5,884
  • 57
  • 198
  • 323