LoginSignup
1
0

More than 3 years have passed since last update.

root権限がない所でrubyを使えるようにする

Posted at

root権限がない所でrbenvを使ってrubyをインストールしようとしたら、以下の事象が発生した。

...
The Ruby openssl extension was not compiled.
The Ruby readline extension was not compiled.
The Ruby zlib extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Try running `yum install -y openssl-devel readline-devel zlib-devel` to fetch missing dependencies.
...

どうやらopenssl, readline, zlibが不足しているらしい。言われた通りにyum installしたいのだが、まぁroot権限がないので。

TMPDIR=/path/to/tmp/dir
INSTALLDIR=/path/to/install/dir

# readline
cd $TMPDIR
wget http://ftp.gnu.org/gnu/readline/readline-4.3.tar.gz
tar xzvf readline-4.3.tar.gz
cd readline-4.3
./configure --prefix=$INSTALLDIR/readline
make -j 
make install

# openssl
cd $TMPDIR
wget www.openssl.org/source/openssl-1.1.1c.tar.gz
tar xf openssl-1.1.1c.tar.gz
cd openssl-1.1.1c
./config --prefix=$INSTALLDIR/openssl
make -j build_libs
make install_sw

# zlib
cd $TMPDIR
wget http://zlib.net/zlib-1.2.11.tar.gz
tar xzvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=$INSTALLDIR/zlib
make -j
make install

さて、全てを入手したが、それをどうやって教えてあげればよいのだろうか。
答えは以下の通り。

RUBY_CONFIGURE_OPTS='--with-openssl-dir=$INSTALLDIR/openssl --with-zlib-dir=$INSTALLDIR/zlib --with-readline-dir=$INSTALLDIR/readline' rbenv install 2.6.3

--with-HOGE-dir を使うことで場所を教えることができる。これでインストールでーきた。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0