つれづれなるまゝに

単なる作業メモ。主に、Linux, arduino, raspberry piとか?

Ruby on railsのインストール @root

2013-10-28 23:06:18 | linux
さっそく、システムにrvmでrubyを入れてみる。

最終的には、apache + passenger、あとDBはpostgresでredmineあたりを用意してみようと思う。

~# curl -L https://get.rvm.io | bash -s stable

・・・

Creating group 'rvm'

Installing RVM to /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete:

* First you need to add all users that will be using rvm to 'rvm' group,
and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.

* To start using RVM you need to run `source /etc/profile.d/rvm.sh`
in all your open shell windows, in rare cases you need to reopen all shell windows.

# Administrator,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.

In case of problems: http://rvm.io/help
Help RVM 2.0: https://www.bountysource.com/fundraisers/489-rvm-2-0


ふむふむ。/usr/local/rvm/にインストールされた模様。
/etc/groupを見るとrvmグループも追加されているので、ここに使用するユーザを追加するのね。

さて、この後はどうするか。。。と、先駆者の方の情報を探す。

ここを参考にさせていただこう。

これまでのアカウントではすでにrvmをローカルに入れてたので、rvmを使うとそっちを向いてしまってるみたい。
.bashrcとかから該当しそうなコードをコメントアウトしたのだが、うまくいかない。

なので新しいアカウントを作成。参考元では、.bash_profieに以下を記入しないと動かないと書いてたのですが、書かなくても動作しました。rvmが新しいからかな?

[[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/scripts/rvm" # Load RVM function


~$ rvmsudo gem install rails
Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. Run:

export rvmsudo_secure_path=1

to avoid the warning, put it in shell initialization file to make it persistent.

In case there is no `secure_path` in `/etc/sudoers`. Run:

export rvmsudo_secure_path=0

to avoid the warning, put it in shell initialization file to make it persistent

なにやらメッセージが出てきたので、対応しておく。

~$ rvmsudo gem install rails
Fetching: i18n-0.6.5.gem (100%)
Fetching: multi_json-1.8.2.gem (100%)
Fetching: tzinfo-0.3.38.gem (100%)
Fetching: minitest-4.7.5.gem (100%)
Fetching: atomic-1.1.14.gem (100%)
Building native extensions. This could take a while...
Fetching: thread_safe-0.1.3.gem (100%)
Fetching: activesupport-4.0.0.gem (100%)
Fetching: builder-3.1.4.gem (100%)
Fetching: rack-1.5.2.gem (100%)
Fetching: rack-test-0.6.2.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: actionpack-4.0.0.gem (100%)
Fetching: activemodel-4.0.0.gem (100%)
Fetching: arel-4.0.1.gem (100%)
Fetching: activerecord-deprecated_finders-1.0.3.gem (100%)
Fetching: activerecord-4.0.0.gem (100%)
Fetching: mime-types-1.25.gem (100%)
Fetching: polyglot-0.3.3.gem (100%)
Fetching: treetop-1.4.15.gem (100%)
Fetching: mail-2.5.4.gem (100%)
Fetching: actionmailer-4.0.0.gem (100%)
Fetching: thor-0.18.1.gem (100%)
Fetching: railties-4.0.0.gem (100%)
Fetching: hike-1.2.3.gem (100%)
Fetching: tilt-1.4.1.gem (100%)
Fetching: sprockets-2.10.0.gem (100%)
Fetching: sprockets-rails-2.0.1.gem (100%)
Fetching: rails-4.0.0.gem (100%)
Successfully installed i18n-0.6.5
Successfully installed multi_json-1.8.2
Successfully installed tzinfo-0.3.38
Successfully installed minitest-4.7.5
Successfully installed atomic-1.1.14
Successfully installed thread_safe-0.1.3
Successfully installed activesupport-4.0.0
Successfully installed builder-3.1.4
Successfully installed rack-1.5.2
Successfully installed rack-test-0.6.2
Successfully installed erubis-2.7.0
Successfully installed actionpack-4.0.0
Successfully installed activemodel-4.0.0
Successfully installed arel-4.0.1
Successfully installed activerecord-deprecated_finders-1.0.3
Successfully installed activerecord-4.0.0
Successfully installed mime-types-1.25
Successfully installed polyglot-0.3.3
Successfully installed treetop-1.4.15
Successfully installed mail-2.5.4
Successfully installed actionmailer-4.0.0
Successfully installed thor-0.18.1
Successfully installed railties-4.0.0
Successfully installed hike-1.2.3
Successfully installed tilt-1.4.1
Successfully installed sprockets-2.10.0
Successfully installed sprockets-rails-2.0.1
Successfully installed rails-4.0.0
28 gems installed
Installing ri documentation for i18n-0.6.5...
Installing ri documentation for multi_json-1.8.2...
Installing ri documentation for tzinfo-0.3.38...
Installing ri documentation for minitest-4.7.5...
Installing ri documentation for atomic-1.1.14...
Installing ri documentation for thread_safe-0.1.3...
Installing ri documentation for activesupport-4.0.0...
Installing ri documentation for builder-3.1.4...
Installing ri documentation for rack-1.5.2...
Installing ri documentation for rack-test-0.6.2...
Installing ri documentation for erubis-2.7.0...
Installing ri documentation for actionpack-4.0.0...
Installing ri documentation for activemodel-4.0.0...
Installing ri documentation for arel-4.0.1...
Installing ri documentation for activerecord-deprecated_finders-1.0.3...
Installing ri documentation for activerecord-4.0.0...
Installing ri documentation for mime-types-1.25...
Installing ri documentation for polyglot-0.3.3...
Installing ri documentation for treetop-1.4.15...
Installing ri documentation for mail-2.5.4...
Installing ri documentation for actionmailer-4.0.0...
Installing ri documentation for thor-0.18.1...
Installing ri documentation for railties-4.0.0...
Installing ri documentation for hike-1.2.3...
Installing ri documentation for tilt-1.4.1...
Installing ri documentation for sprockets-2.10.0...
Installing ri documentation for sprockets-rails-2.0.1...
Installing ri documentation for rails-4.0.0...
file 'lib' not found
Installing RDoc documentation for i18n-0.6.5...
Installing RDoc documentation for multi_json-1.8.2...
Installing RDoc documentation for tzinfo-0.3.38...
Installing RDoc documentation for minitest-4.7.5...
Installing RDoc documentation for atomic-1.1.14...
Installing RDoc documentation for thread_safe-0.1.3...
Installing RDoc documentation for activesupport-4.0.0...
Installing RDoc documentation for builder-3.1.4...
Installing RDoc documentation for rack-1.5.2...
Installing RDoc documentation for rack-test-0.6.2...
Installing RDoc documentation for erubis-2.7.0...
Installing RDoc documentation for actionpack-4.0.0...
Installing RDoc documentation for activemodel-4.0.0...
Installing RDoc documentation for arel-4.0.1...
Installing RDoc documentation for activerecord-deprecated_finders-1.0.3...
Installing RDoc documentation for activerecord-4.0.0...
Installing RDoc documentation for mime-types-1.25...
Installing RDoc documentation for polyglot-0.3.3...
Installing RDoc documentation for treetop-1.4.15...
Installing RDoc documentation for mail-2.5.4...
Installing RDoc documentation for actionmailer-4.0.0...
Installing RDoc documentation for thor-0.18.1...
Installing RDoc documentation for railties-4.0.0...
Installing RDoc documentation for hike-1.2.3...
Installing RDoc documentation for tilt-1.4.1...
Installing RDoc documentation for sprockets-2.10.0...
Installing RDoc documentation for sprockets-rails-2.0.1...
Installing RDoc documentation for rails-4.0.0...
file 'lib' not found

で、ふと思う。4.0.0入れちゃダメじゃん。Redmineって対応してなかったような・・・。

今夜は遅いので、対応はまた次、

Ruby on railsのインストール

2013-10-28 22:36:51 | linux
さて、今日はrubyの環境とRuby on railsを入れておこう。

ここを参考に。

ちょっと書いてある内容と差分があったのでメモ

1) rvm requirements

以下のように必要なパッケージを自動でインストールしてくれた

~$ rvm requirements
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system..........................................................................................................
Installing required packages: gawk, g++, libreadline6-dev, zlib1g-dev, libssl-dev, libyaml-dev, libsqlite3-dev, sqlite3, autoconf, libgdbm-dev, libncurses5-dev, automake, libtool, bison, libffi-dev..................................................................................................................................
Requirements installation successful.


2) rubyのインストール

rubyのサイトを見るとまだ安定版は1.9.3のようなので、1.9.3をインストール。

~$ rvm install 1.9.3

かなり時間がかかると書いてましたが、数分程度でした。

~$ ruby -v
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]


3) gemsのインストール

~$ gem -v
2.1.10


4) railsのインストール

これはちょっと時間がかかる。

~$ gem install rails
Fetching: i18n-0.6.5.gem (100%)
Successfully installed i18n-0.6.5
Fetching: multi_json-1.8.2.gem (100%)
Successfully installed multi_json-1.8.2
Fetching: tzinfo-0.3.38.gem (100%)
Successfully installed tzinfo-0.3.38
Fetching: minitest-4.7.5.gem (100%)
Successfully installed minitest-4.7.5
Fetching: atomic-1.1.14.gem (100%)
Building native extensions. This could take a while...
Successfully installed atomic-1.1.14
Fetching: thread_safe-0.1.3.gem (100%)
Successfully installed thread_safe-0.1.3
Fetching: activesupport-4.0.0.gem (100%)
Successfully installed activesupport-4.0.0
Fetching: builder-3.1.4.gem (100%)
Successfully installed builder-3.1.4
Fetching: rack-1.5.2.gem (100%)
Successfully installed rack-1.5.2
Fetching: rack-test-0.6.2.gem (100%)
Successfully installed rack-test-0.6.2
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: actionpack-4.0.0.gem (100%)
Successfully installed actionpack-4.0.0
Fetching: activemodel-4.0.0.gem (100%)
Successfully installed activemodel-4.0.0
Fetching: arel-4.0.1.gem (100%)
Successfully installed arel-4.0.1
Fetching: activerecord-deprecated_finders-1.0.3.gem (100%)
Successfully installed activerecord-deprecated_finders-1.0.3
Fetching: activerecord-4.0.0.gem (100%)
Successfully installed activerecord-4.0.0
Fetching: mime-types-1.25.gem (100%)
Successfully installed mime-types-1.25
Fetching: polyglot-0.3.3.gem (100%)
Successfully installed polyglot-0.3.3
Fetching: treetop-1.4.15.gem (100%)
Successfully installed treetop-1.4.15
Fetching: mail-2.5.4.gem (100%)
Successfully installed mail-2.5.4
Fetching: actionmailer-4.0.0.gem (100%)
Successfully installed actionmailer-4.0.0
Fetching: thor-0.18.1.gem (100%)
Successfully installed thor-0.18.1
Fetching: railties-4.0.0.gem (100%)
Successfully installed railties-4.0.0
Fetching: hike-1.2.3.gem (100%)
Successfully installed hike-1.2.3
Fetching: tilt-1.4.1.gem (100%)
Successfully installed tilt-1.4.1
Fetching: sprockets-2.10.0.gem (100%)
Successfully installed sprockets-2.10.0
Fetching: sprockets-rails-2.0.1.gem (100%)
Successfully installed sprockets-rails-2.0.1
Fetching: rails-4.0.0.gem (100%)
Successfully installed rails-4.0.0
Installing ri documentation for actionmailer-4.0.0
Installing ri documentation for actionpack-4.0.0
Installing ri documentation for activemodel-4.0.0
Installing ri documentation for activerecord-4.0.0
Installing ri documentation for activerecord-deprecated_finders-1.0.3
Installing ri documentation for activesupport-4.0.0
Installing ri documentation for arel-4.0.1
Installing ri documentation for atomic-1.1.14
unable to convert "\xF1" from ASCII-8BIT to UTF-8 for test/performance.rb, skipping
Installing ri documentation for builder-3.1.4
Installing ri documentation for erubis-2.7.0
Installing ri documentation for hike-1.2.3
Installing ri documentation for i18n-0.6.5
Installing ri documentation for mail-2.5.4
Installing ri documentation for mime-types-1.25
Installing ri documentation for minitest-4.7.5
Installing ri documentation for multi_json-1.8.2
Installing ri documentation for polyglot-0.3.3
unable to convert "\x89" from ASCII-8BIT to UTF-8 for test/multipart/binary, skipping
Installing ri documentation for rack-1.5.2
Installing ri documentation for rack-test-0.6.2
Installing ri documentation for rails-4.0.0
Installing ri documentation for railties-4.0.0
Installing ri documentation for sprockets-2.10.0
Installing ri documentation for sprockets-rails-2.0.1
Installing ri documentation for thor-0.18.1
Installing ri documentation for thread_safe-0.1.3
Installing ri documentation for tilt-1.4.1
Installing ri documentation for treetop-1.4.15
Installing ri documentation for tzinfo-0.3.38
28 gems installed


なんか、ASCII-8BIT から UTF-8 の変換ができんとかいってるけど、無視かな。

~$ rails -v
Rails 4.0.0

おっと、今だと4.0.0がインストールされるのか。

<終了>

と、ここまで20分程度。すごく簡単に完了。依存関係とかで結構はまった経験があるのだが、rvmからの手順だとあったりなのね。それともubuntuだからなのか?

先々は、apache + passengaerで動かそうと思ってる。rvmだと個人の環境にインストールされるが、システムへのインストールとかもできるのかなとおもって調べたら、rootで入れれば/usr/local/rvmにインストールされるのね。便利ねぇ。