How to install RVM on Linux subsystem on Windows 10 - ruby

I am working on a web-scraping script, but the current gem version is not giving me the any packages to install.
I know it's for some infrastructure-change reason but now I have installed anniversary-update from Windows 10 and installed a Linux subsystem.
I installed NodeJS + npm already, which are working correctly but the problem is installing Ruby on that subsystem.
When I tried to install RVM it's giving me an error:
ins#DESKTOP-TK9ELEL:~$ sudo apt-get install rvm
sudo: unable to resolve host DESKTOP-TK9ELEL
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
rvm : Depends: libreadline6-dev but it is not installable
Depends: autoconf but it is not installable
Depends: libgdbm-dev but it is not installable
Depends: libncurses5-dev but it is not installable
Depends: automake but it is not installable
Depends: libtool but it is not installable
Depends: bison but it is not installable
Depends: pkg-config but it is not installable
E: Unable to correct problems, you have held broken packages.
How do I solve this?

Follow the install directions for RVM on their site. Nobody knows RVM better than the authors.
\curl -sSL https://get.rvm.io | bash -s stable --ruby
That will install the stable versions of RVM and Ruby.
Following that use:
rvm use [whichever Ruby was installed] --default
to tell RVM to default to that Ruby.
RVM is capable of installing the prerequisites for your *nix distribution if you use their directions. Once RVM is installed you will not need to use sudo or yum to install anything for an RVM-managed Ruby. That means do not use sudo rvm install ruby... or sudo gem install some_gem. If you do you'll only force your system to do the wrong thing.

Related

cannot install ruby using rvm as an unprivileged user with no sudo privileges

According to the rvm documentation at
https://rvm.io/rvm/install
it should be possible to install rvm, and subsequently a ruby, as a non-privileged user.
Under troubleshooting at
https://rvm.io/support/troubleshooting
it states:
Any user in the rvm group can update RVM, rubies, and gemsets. There
is never a reason to use sudo post-install.
rvm installs fine as a non-privileged user (There is no rvm group):
nosudo-user#my-site.com:~$ bash ~/downloads/rvm_installer.sh stable
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc
...
Installing RVM to /<user-home>/.rvm/
...
However, when I try to install a ruby version, it fails (I think) trying to do an apt-get because it needs sudo privileges:
nosudo-user#my-site.com:~$ rvm install 2.6.6
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.6.tar.bz2
...
Updating system... password required for 'apt-get --quiet --yes update':
.
Error running 'requirements_debian_update_system ruby-2.6.6',
please read /<user-home>/.rvm/log/1659735568_ruby-2.6.6/update_system.log
Requirements installation failed with status: 1.
From the log:
2022-08-05 21:39:28] requirements_debian_update_system
requirements_debian_update_system ()
{
__rvm_try_sudo apt-get --quiet --yes update || {
\typeset __ret=$?;
case ${__ret} in
100)
rvm_error "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
apt-get update (as a user with sudo privileges) shows no errors.
How is one supposed to install rvm so a non-privileged user can install a version of ruby?
My guess is your system is missing some basic system libraries for buiding Ruby from source. Hence RVM tries to fetch the build libraries for you. This will be a one-time update, and after your system has the proper libraries installed, RVM will not require sudo again.
However if you want you can disable apt updating completely with:
rvm autolibs disable
Note that if you have missing build requirements, then the build step of Ruby will quite likely fail. Only way to find out is to try.
In that case you can use the requirements command to help you install missing dependencies:
rvm requirements
Casper's answer above provided the missing information; there were some missing libraries. However, the steps required to be able to install as an unprivileged user were rather un-intuitive (to me, at least):
Install rvm using sudo; in that process it creates the "rvm" group.
Add the desired users to the rvm group
Note:
Attempting to install a ruby as an unprivileged user after this step still fails.
sudo to root to get the rvm magic paths installed for root, then start installing a ruby, but kill the process after the requirements installation is complete.
Log in as the desired unprivileged user and use rvm to install the desired ruby for that user.
Cmds:
sudo rvm_installer.sh stable
sudo usermod -a -G rvm the-user
sudo -i
rvm install 2.6.6
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.6.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system..
Installing required packages: g++, gcc, autoconf, automake, bison, libffi-dev, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, make, pkg-config, sqlite3, libgmp-dev, libreadline-dev......................|
Requirements installation successful.
^C
exit
sudo -i -u the-user
rvm install 2.6.6

apt-get is broken and can't install anything

My apt-get is totally broken and can't install anything. The output of 'apt-get install -f" is as follows:
# apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
gnome-icon-theme : Depends: gtk-update-icon-cache
python3-cairo : Depends: python3 (>= 3.6~) but 3.4.3-1 is installed
python3-gdbm : Depends: python3 (>= 3.6) but 3.4.3-1 is installed
python3-reportlab-accel : Depends: python3 (>= 3.6~) but 3.4.3-1 is installed
rhythmbox : Depends: rhythmbox-data (= 3.1-1ubuntu3) but 3.4.1-2ubuntu5 is installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies
The output of 'sudo apt install python3' is in the picture:https://imgur.com/a/IbGK0
I have Googled any possible questions and tried any possible solutions but NO ONE worked for it.
Go to /var/log/dist-upgrade/apt.log and identify the packages that are broken. "apt-get remove" the packages, do release upgrade and then you should be able to reinstall them.
You can find more information here: https://askubuntu.com/questions/124845/eerror-pkgproblemresolverresolve-generated-breaks-this-may-be-caused-by-hel
This command resolved my error
sudo apt -f install
In my case I was behind a proxy, so I needed to run the following command:
sudo nano /etc/apt/apt.conf
And added the following lines:
Acquire::http::proxy "http://<user>:<password>#<proxy_host>:<proxy_port>/";
Acquire::https::proxy "https://<user>:<password>#<proxy_host>:<proxy_port>/";
Acquire::ftp::proxy "ftp://<user>:<password>#<proxy_host>:<proxy_port>/";

Installing VLC on Lubuntu (Utopic Unicorn)

I am having some issues installing VLC on Lubuntu (ubuntu) 14.10:
sudo apt-get install vlc
The command returns:
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies.
vlc : Depends: vlc-nox (= 2.2.0-0ubuntu0.14.10.1) but 2.2.0+ppa3.2 is to be installed
Recommends: vlc-plugin-notify (= 2.2.0-0ubuntu0.14.10.1) but 2.2.0+ppa3.2 is to be installed
Recommends: vlc-plugin-samba (= 2.2.0-0ubuntu0.14.10.1) but 2.2.0+ppa3.2 is to be installed
E: Unable to correct problems, you have held broken packages.
I have tried to install both the packages it recommends (they are already installed apparently).
I have also followed this guide as some was having a similar problem: http://ubuntuforums.org/showthread.php?t=2250015
and installed the xorg ppa to no avail.
Can someone please shed some light on this for me?
Many thanks!
Ed
After the usual
sudo apt-get update && sudo apt-get upgrade
Do this:
sudo apt-get remove --purge vlc-nox vlc-plugin-notify vlc-plugin-samba
sudo apt-get install vlc
apt-get should install the correct dependency versions now.
Btw why not post this on https://askubuntu.com/ ?

what is osx_brew and can i install it in my ubuntu machin?

I have tried so many tries to correct the issues with ruby version. In between somewhere i have installed osx_brew in my machine. Actually i don't know why i have install this. After a short googling i can found that the osx_brew only needed for mac os. I don't know that is correct or not. Any way when i try to install rvm requirements i got the error like
Installing requirements for osx_brew, might require sudo password.
Already up-to-date.
Installing required packages: autoconf, automake, libtool, pkg-config, apple-gcc42, libyaml, readline, libxml2, libxslt, libksba, openssl, sqlite...
Error running 'requirements_brew_libs_install autoconf automake libtool pkg-config apple-gcc42 libyaml readline libxml2 libxslt libksba openssl sqlite',
please read /home/anoop/.rvm/log/package_install_autoconf_automake_libtool_pkg-config_apple-gcc42_libyaml_readline_libxml2_libxslt_libksba_openssl_sqlite.log
There were package installation errors, make sure to read the log.
Check Homebrew requirements https://github.com/mxcl/homebrew/wiki/Installation
i don't know whether this problem arises due to homebrew or not.
Also when i try the command rvm autolibs status
it shows me like
---
value: osx_brew
number: 4
runner: osx_brew
description: Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X).
It says like only for osx_homebrew. Do i need to install when i working in rvm ruby if yes can you tell me the purpose of that. If i don't need this how can i remove this in my ubuntu system?

Unable to resolve Ruby error (missing psych)

Whenever I run something with Ruby on my server, I get the following error:
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/yaml.rb:56:in `<top (required)>':
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
I installed Ruby using RVM onto my VPS.
I’ve tried installing the package libyaml as per instructed in other issues on Stack Overflow, to no avail.
I’m not sure what type of system my VPS is running, but it doesn’t have the apt-get command. It does have yum…
I have to disagree with #JunaidKirkire in that I think you are running CentOS or Redhat 5 which uses a a very old version of Ruby by default and I think using RVM is a much better way to go. I believe you will just need to compile libyaml from source with the following:
rvm pkg install libyaml
This will tell you the directory that it is compiling into, in my case, it is /Users/ehowe/.rvm/usr
You then need to recompile Ruby with the following option:
rvm reinstall 1.9.3 --with-libyaml-dir=$directory_that_rvm_installed_libyaml_to
So in my case, I would do:
rvm install 1.9.3 --with-libyaml-dir=/Users/ehowe/.rvm/usr
If you are running rvm as root, this will get installed into /usr/local/rvm/usr. If you are running it as a user, as is recommended, it would be /home/$user/.rvm/usr
I had this problem and installing libyaml didn't help. It turned out that libyaml-devel was needed by psych. I was on centos6 so I did this:
curl -O http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/atomic-release-1.0-14.el6.art.noarch.rpm
sudo rpm -Uvh atomic-release-1.0-14.el6.art.noarch.rpm
sudo yum install libyaml-devel
rvm reinstall 1.9.3-p194
On a RHEL based distro such as CentOS 6.x you need to add another yum repository such as EPEL which contain the libyaml-devel package.
Keys for EPEL or download
RPM for EPEL
More info:
CentOS - Additional Resources
Fedora Project: EPEL Howto
Would also suggest the use of yum-plugin-priorities
Add EPEL Yum Repository
rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6
rpm -Kih http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Install libyaml-devel via yum
yum -y install libyaml-devel
Packages
Dependencies Resolved
====================================================================================
Package Arch Version Repository Size
====================================================================================
Installing:
libyaml-devel x86_64 0.1.3-1.el6 epel 84 k
Installing for dependencies:
libyaml x86_64 0.1.3-1.el6 epel 52 k
Transaction Summary
====================================================================================
Install 2 Package(s)
The problem could be solved by installing libyaml. Below are the corresponding packages for the most popular distributions:
Fedora libyaml
Ubuntu and other Debian based libyaml-dev
Some other like CentOS libyaml-devel
and also you should install the following to avoid similar problems in future:
ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
In case people still hit this, I fixed it using the new autolibs feature in RVM, which automatically installs dependencies using your homebrew libraries (check out rvm help autolibs for info.)
rvm reinstall 1.9.3 --autolibs=2
You seem to be working on Fedora. Check the official Ruby website for instructions on installing on Fedora.
Try this link too http://sraji.wordpress.com/2011/01/25/how-to-install-ruby-on-fedora-14/
I had this same libyaml issue with CentOS 6.2
Doing...
rvm pkg install libyaml
rvm reinstall 1.9.3 --with-libyaml-dir=/usr/local/rvm/usr
Fixed it for me.
(thanks to #Eugene)
Make sure your Redhat machine has a valid subscription:
# subscription-manager list
+-------------------------------------------+
Installed Product Status
+-------------------------------------------+
Product Name: Red Hat Enterprise Linux Server
Product ID: 69
Version: 7.1
Arch: x86_64
Status: Subscribed
Status Details:
Starts: 06/13/2014
Ends: 06/12/2015
Status must say "Subscribed". If not, then suffer through getting a login and maybe purchasing a subscription at https://access.redhat.com/management/consumers.
When that's done, run
# subscription-manager repos --enable rhel-7-server-optional-rpms
then libyaml-devel will install OK.

Resources