简体   繁体   中英

failing trying to install ruby in linux mint 19

I'm trying to install Ruby on Rails in Linux Mint 19. First of all I tried installing

$ sudo apt install ruby-full

from the Repo. Then it began to complain trying to install gems or even if trying to update gems. So I rolled back everything and tried installing Ruby from rvm. Here is what I did:

$ command curl -sSL https://rvm.io/mpapis.asc | gpg --import

and

$ \\curl -sSL https://get.rvm.io | bash -s stable --ruby

The first weird thing was this orange message:

    No binary rubies available for: mint/19/x86_64/ruby-2.5.1.
    Continuing with compilation. Please read 'rvm help mount' to get more information
on binary rubies.

Then another weird thing:

Checking requirements for mint.
Installing requirements for mint.
Updating system.........There has been an error while updating your system using `apt-get`.
It seems that there are some 404 Not Found errors for repositories listed in:

    /etc/apt/sources.list
    /etc/apt/sources.list.d/*.list

Make sure that all repositories are available from your system and verify your setup by running manually:

    sudo apt-get update

Make sure that it works correctly before proceeding with RVM.

The repository is the official one that comes with the Mint installation. And finally a red message yelling this:

Error running 'requirements_debian_update_system ruby-2.5.1',
please read /home/username/.rvm/log/1539700159_ruby-2.5.1/update_system.log
Requirements installation failed with status: 100.

How can I solve this?

Since I'm a newcomer into Ruby and into Rails and I'm still need to read and to research a lot more I found a valid solution: using rbenv.

Here is what I did:

$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ exec $SHELL
$ git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
$ echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
$ exec $SHELL
$ sudo apt-get install -y libssl-dev libreadline-dev zlib1g-dev readline-doc libssl-doc
$ rbenv install 2.5.1
$ rbenv global 2.5.1
$ gem install bundler
$ rbenv rehash
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
$ sudo apt-get install -y nodejs
$ gem install rails -v 5.2.0
$ rbenv rehash

There is a lot of command line and some of them are repeated, but I think it worth it. No errors, no complains, my terminal is crystal clear. Everything went like a charm.

Credit goes to the people in https://gorails.com . I thank them and I hope this might be helpful.

There is nothing weird about the output of RVM, the first message is just telling that it has not found a compiled version of ruby for your specific OS(Linux Mint 19), so it will download all necessary files and compile it. The second message states that when trying to update the repos there where some errors, so you should manually update the system and remove/disable any non-working repo, so that installation can continue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM