Error while installing Ruby on Centos 7 (centos_libs_install)

Trying to install Ruby for a Mastodon installation. But I get this message:

Anyone any ideas?

Thx!

[mastodon@localhost ~]$ rvm install 2.6

Searching for binary rubies, this might take some time.
No binary rubies available for: centos/7/x86_64/ruby-2.6.3.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Installing requirements for centos.
Installing required packages: ruby..mastodon password required for 'yum install -y ruby': 
.
Error running 'requirements_centos_libs_install ruby',
please read /opt/mastodon/.rvm/log/1582485939_ruby-2.6.3/package_install_ruby.log
Requirements installation failed with status: 1.

When tying to install the referenced package I see it is already installed:

Package libyaml-devel-0.1.4-11.el7_0.x86_64 already installed and latest version

Opening the suggested log give me this:

[2020-02-23 20:25:39] requirements_centos_libs_install
requirements_centos_libs_install ()
{
    __rvm_try_sudo yum install -y "$@" || return $?
}
current path: /opt/mastodon
PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/mastodon/.rvm/bin:/opt/mastodon/.local/bin:/opt/mastodon/bin
command(2): requirements_centos_libs_install ruby
++ __rvm_try_sudo yum install -y ruby
++ typeset -a command_to_run
++ typeset sudo_path sbin_path missing_paths
++ command_to_run=("$@")
++ ((  UID == 0  ))
++ case "$rvm_autolibs_flag_number" in
++ is_a_function __rvm_sudo
++ typeset -f __rvm_sudo
++ missing_paths=
++ for sbin_path in /sbin /usr/sbin /usr/local/sbin
++ [[ -d /sbin ]]
++ [[ :/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/mastodon/.rvm/bin:/opt/mastodon/.local/bin:/opt/mastodon/bi$
++ missing_paths+=:/sbin
++ for sbin_path in /sbin /usr/sbin /usr/local/sbin
++ [[ -d /usr/sbin ]]
++ [[ :/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/mastodon/.rvm/bin:/opt/mastodon/.local/bin:/opt/mastodon/bi$
++ for sbin_path in /sbin /usr/sbin /usr/local/sbin
++ [[ -d /usr/local/sbin ]]
++ [[ :/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/mastodon/.rvm/bin:/opt/mastodon/.local/bin:/opt/mastodon/bi$
++ [[ -n :/sbin ]]
++ command_to_run=(/usr/bin/env PATH="${PATH}${missing_paths}" "${command_to_run[@]}")
++ command_to_run=(__rvm_sudo -p "%p password required for '$*': " "${command_to_run[@]}")
++ __rvm_sudo -p '%p password required for '\''yum install -y ruby'\'': ' /usr/bin/env PATH=/usr/local/bin:/bin:/usr/bin:/usr/$
++ command sudo -p '%p password required for '\''yum install -y ruby'\'': ' /usr/bin/env PATH=/usr/local/bin:/bin:/usr/bin:/us$
++ sudo -p '%p password required for '\''yum install -y ruby'\'': ' /usr/bin/env PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/$
mastodon is not in the sudoers file.  This incident will be reported.
++ return 1
++ return 1

Which guide exactly are you following? Installing from source - Mastodon documentation does not mention using rvm install.

The problem is here:

You need to switch to user root to install ruby but sudo does not let you to switch from mastodon to root user without entering a password.

Hi, yes not using that guide because I’m on centos.

Following this:

They mention to use rvm to have better control over versioning?

Thx!
K.

Did you follow the sudo setup guide? How to Use Sudo on Debian, CentOS, and FreeBSD - Vultr.com

What happens if you do sudo -l ?

No I didn’t follow that guide.

What happens if you do sudo -l ?

Matching Defaults entries for root on localhost:
!visiblepw, always_set_home, match_group_by_gid, always_query_group_plugin, env_reset,
env_keep=“COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS”, env_keep+=“MAIL PS1 PS2
QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE”, env_keep+=“LC_COLLATE LC_IDENTIFICATION
LC_MEASUREMENT LC_MESSAGES”, env_keep+=“LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER
LC_TELEPHONE”, env_keep+=“LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY”,
secure_path=/sbin:/bin:/usr/sbin:/usr/bin

User root may run the following commands on localhost:
(ALL) ALL

Can you try this as the “mastodon” user, not root?

You need to setup sudo to let you switch from the mastodon user to root without a password properly. Please follow the guide and understand security repercussions of this.

Don’t seem to have to privilages?

[root@localhost ~]# su mastodon
[mastodon@localhost root]$ sudo -l
[sudo] password for mastodon: 
Sorry, user mastodon may not run sudo on localhost.

So how did the commands like sudo yum -y install redis work from your guide?

You need to setup sudo to let you switch from the mastodon user to root without a password properly. Please follow the guide and understand security repercussions of this.

I’m using an SSH key to login over SSH. Would this be interfering? I’m running a webserver as well next to this.

No, that’s how everybody is doing this. You need to setup sudo properly. I think you did not follow the guide precisely and therefore you might run into trouble like this.

But installing ruby over with rvm on the root user is ok? Or will this give issues? I’ll check the other guide as well in detail.

It is okay but you need to be consistent. The guide is written for a normal user (in your case “mastodon”) which has sudo privileges to switch to root when necessary. Please fix this and your rvm will run fine. Use the sudo guide mentioned already How to Use Sudo on Debian, CentOS, and FreeBSD - Vultr.com .

If your run into trouble with this, check sudo -l as the mastodon user again.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.