ruby-2.4.1をソースからビルド(RHEL4)

ruby-2.4.1をソースからビルド(RHEL4)

zlibが入ってない場合は、zlibのサイト
https://zlib.net/
から、zlibをダウンロードする。

# tar -zxvf zlib-1.2.11.tar.gz
# cd zlib-1.2.11
# ./configure
# make
# make install

rubyのダウンロードサイト
https://www.ruby-lang.org/ja/downloads/
から、rubyをダウンロードする。

解凍
# tar -zxvf ruby-2.4.1.tar.gz

コンパイル
# cd ruby-2.4.1
#./configure –prefix=/usr/local/ruby
# make

インストール
# sudo make install

rubyのパスを通す
$ export PATH=/usr/local/ruby/bin:$PATH
$ ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [i686-linux]

rubygemsをインストールします。

rubygemsのサイト
https://rubygems.org/
から、ソースをダウンロード
# tar -zxvf rubygems-2.6.13.tgz

# cd rubygems-2.6.13
# ruby setup.rb
——————————————————————————

RubyGems installed the following executables:
/usr/local/ruby/bin/gem

Ruby Interactive (ri) documentation was installed. ri is kind of like man
pages for ruby libraries. You may access it like this:
ri Classname
ri Classname.class_method
ri Classname#instance_method
If you do not wish to install this documentation in the future, use the
–no-document flag, or set it as the default in your ~/.gemrc file. See
‘gem help env’ for details.

続いて、rakeのインストール

# gem install rake
ERROR: While executing gem … (Gem::Exception)
Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

エラー発生。

# cd /usr/local/src/ruby-2.4.1/ext/openssl

Makefileのtopdirの下に下記1行を追加する。
top_srcdir = /usr/local/src/ruby-2.4.1

# ruby extconf.rb
checking for t_open() in -lnsl… no
checking for socket() in -lsocket… no
checking for openssl/ssl.h… yes
checking for OpenSSL version is 0.9.8 or later… no
extconf.rb:60:in `

‘: OpenSSL 0.9.8 or later required. (RuntimeError)

バージョンを確認すると、
# openssl version
OpenSSL 0.9.7a Feb 19 2003

opensslのサイト
https://www.openssl.org/source/
から、ソースをダウンロードする。

解凍
# tar -zxvf openssl-1.0.2l.tar.gz

コンパイル
# cd openssl-1.0.2l
# ./config -fPIC shared
# make

インストール
# make install

openssl-1.0.2lをライブラリパスに追加する。
/etc/ld.so.confにライブラリを追加する。

/usr/local/ssl/lib ←追加
include ld.so.conf.d/*.conf

設定反映
# ldconfig

反映確認
# ldconfig -p | grep ssl
libssl3.so (libc6) => /usr/lib/libssl3.so
libssl.so.4 (libc6) => /lib/libssl.so.4
libssl.so.1.0.0 (libc6) => /usr/local/ssl/lib/libssl.so.1.0.0
libssl.so (libc6) => /usr/local/ssl/lib/libssl.so
libssl.so (libc6) => /usr/lib/libssl.so
libcrypto.so.1.0.0 (libc6) => /usr/local/ssl/lib/libcrypto.so.1.0.0
libcrypto.so (libc6) => /usr/local/ssl/lib/libcrypto.so

バージョン確認
# /usr/local/ssl/bin/openssl version
OpenSSL 1.0.2l 25 May 2017

パスを通す
# export PATH=/usr/local/ssl/bin:$PATH

rubyをリコンパイル&インストール
# cd /usr/local/src/ruby-2.4.1
# ./configure –prefix=/usr/local/ruby –with-opt-dir=/usr/local/ssl –enable-shared
# make
# make install

改めて、rakeをインストール
# gem install rake
Successfully installed rake-12.0.0
Parsing documentation for rake-12.0.0
Installing ri documentation for rake-12.0.0
Done installing documentation for rake after 1 seconds
1 gem installed

# gem install reils
・・・
Parsing documentation for sprockets-rails-3.2.1
Installing ri documentation for sprockets-rails-3.2.1
Parsing documentation for rails-5.1.4
Installing ri documentation for rails-5.1.4
Done installing documentation for i18n, thread_safe, tzinfo, concurrent-ruby, activesupport, rack, rack-test, mini_portile2, nokogiri, loofah, rails-html-sanitizer, rails-dom-testing, builder, erubi, actionview, actionpack, activemodel, arel, activerecord, globalid, activejob, mime-types-data, mime-types, mail, actionmailer, nio4r, websocket-extensions, websocket-driver, actioncable, thor, method_source, railties, bundler, sprockets, sprockets-rails, rails after 205 seconds
36 gems installed

$ cd redmine
$ rake config/

Could not find gem ‘rails (= 4.2.8)’ in any of the gem sources listed in your Gemfile.

# bundle install
・・・
Bundler::SudoNotPermittedError: Bundler requires sudo access to install at the
moment. Try installing again, granting Bundler sudo access when prompted, or
installing into a different path.
An error occurred while installing i18n (0.7.0), and Bundler cannot
continue.
Make sure that `gem install i18n -v ‘0.7.0’` succeeds before bundling.

In Gemfile:
rails was resolved to 4.2.8, which depends on
actionmailer was resolved to 4.2.8, which depends on
actionpack was resolved to 4.2.8, which depends on
actionview was resolved to 4.2.8, which depends on
rails-dom-testing was resolved to 1.0.8, which depends on
rails-deprecated_sanitizer was resolved to 1.0.3, which depends on
activesupport was resolved to 4.2.8, which depends on
i18n

管理者