CentOS8安装Ruby错误

问题

安装完ruby后使用gem install时候报错:Unable to require openssl

查看安装时的log,发现安装时未能安装openssl

1
2
3
4
5
6
openssl:
Could not be configured. It will not be installed.
/root/ruby/ruby-2.5.0/ext/openssl/extconf.rb:94: OpenSSL library could not be found. You might want to use --with-openssl-dir=<dir> option to specify the prefix where OpenSSL is installed.
Check ext/openssl/mkmf.log for more details.
*** Fix the problems, then remove these directories and try again if you want.

解决方法

重新下载openssl,配置configure都无效,最后make uninstall卸载手动构建源码的版本。

用yum/dnf安装,解决。