東山n条より

京都在住情報系学生のメモ。

Windows Azure 仮想マシン(CentOS 6.3) で gcc RVM Rails をインストール

Windows Azure 上の仮想マシン CentOS 6.3 で gcc RVM Rails の環境設定をしたのでメモ。

必要なライブラリのインストール

$ sudo yum install -y git zlib-devel perl-ExtUtils-MakeMaker httpd httpd-devel openssl-devel libyaml-devel libxml2-devel libxslt-devel libffi-devel readline-devel pcre-devel iconv-devel sqlite-devel mysql mysql-server mysql-devel postgresql postgresql-server postgresql-devel curl-devel nkf

後々,これをしないと gem を行った時に

It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.

と lib-yaml がないよ,と怒られるので lib-yaml をインストールする.
デフォルトのレポジトリには libyaml がないので追加してインストールする.

$ rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
$ yum install libyaml-devel

gcc のインストール

Windows Azure仮想マシン CentOS 6.3 では,デフォルトで gcc が入っていない. このままでは rvm で ruby をインストールする際に c-compiler が無いよ,と怒られるので,gcc をインストールする.

しかし,そのまま yum でインストールするしようとすると,

$ yum install gcc
-------略-------
Error: Package: glibc-headers-2.12-1.80.el6_3.7.x86_64 (updates)
           Requires: kernel-headers
Error: Package: glibc-headers-2.12-1.80.el6_3.7.x86_64 (updates)
           Requires: kernel-headers >= 2.2.1
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

kernel-header がないと怒られるので,kernel-header をインストールしてから gcc をインストールする.

$ sudo yum --disableexcludes=main install kernel-headers-2.6.32-279.14.1.el6.openlogic.x86_64
$ sudo yum install gcc

RVM のインストール

ホームディレクトリで RVM のインストールする.

$ cd ~
$ bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
$ source ~/.bash_profile

Rails のインストール

後は,rvm と gem を使って rails をインストールするだけ.

$ rvm install 1.9.3
$ rvm use 1.9.3 
$ gem install rake
$ gem intsll rails

以上!

マイクロソフトエバンジェリストの方に教えてもらいながら作業しました.
gcc のインストールでハマるようです.

・参考にさせて頂いたサイト
CentOSにRVMと最新版Ruby&Railsをインストールする
Windows Azure 仮想マシンで Redis をビルドして動かす
Ruby 1.9.3で "missing psych"