Ruby on Railsインストール
○環境
CentOS 5.2
○手順
Rubyのインストール
yum install ruby
Gemsのインストール。
Gemsは標準のCentOSのレポジトリには入ってないので、dlutterというレポジトリを追加
/etc/yum.repos.d/dlutter.repo というファイルを以下の内容で作成。
[dlutter]
name=Unsupported RHEL5 packages (dlutter)
baseurl=http://people.redhat.com/dlutter/yum/rhel/5/$basearch/
enabled=0
gpgcheck=0
name=Unsupported RHEL5 packages (dlutter)
baseurl=http://people.redhat.com/dlutter/yum/rhel/5/$basearch/
enabled=0
gpgcheck=0
いよいよGemsのインストール。
# yum –enablerepo=dlutter -y install rubygems.noarch
Loading “fastestmirror” plugin
Loading mirror speeds from cached hostfile
* dlutter: people.redhat.com
* base: dist1.800hosting.com
* updates: centos-distro.cavecreek.net
* addons: mirror.steadfast.net
* extras: mirror.unl.edu
dlutter 100% |=========================| 951 B 00:00
primary.xml.gz 100% |=========================| 5.8 kB 00:00
dlutter : ################################################## 19/19
base 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Excluding Packages in global exclude list
Finished
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package rubygems.noarch 0:0.9.4-1.el5 set to be updated
–> Processing Dependency: ruby-rdoc for package: rubygems
–> Running transaction check
—> Package ruby-rdoc.i386 0:1.8.5-5.el5_1.1 set to be updated
–> Processing Dependency: ruby-irb = 1.8.5-5.el5_1.1 for package: ruby-rdoc
–> Running transaction check
—> Package ruby-irb.i386 0:1.8.5-5.el5_1.1 set to be updated
–> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
rubygems noarch 0.9.4-1.el5 dlutter 513 k
Installing for dependencies:
ruby-irb i386 1.8.5-5.el5_1.1 base 67 k
ruby-rdoc i386 1.8.5-5.el5_1.1 base 135 k
Transaction Summary
=============================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 716 k
Downloading Packages:
(1/3): ruby-irb-1.8.5-5.e 100% |=========================| 67 kB 00:00
(2/3): ruby-rdoc-1.8.5-5. 100% |=========================| 135 kB 00:00
(3/3): rubygems-0.9.4-1.e 100% |=========================| 513 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: ruby-irb ######################### [1/3]
Installing: ruby-rdoc ######################### [2/3]
Installing: rubygems ######################### [3/3]
Installed: rubygems.noarch 0:0.9.4-1.el5
Dependency Installed: ruby-irb.i386 0:1.8.5-5.el5_1.1 ruby-rdoc.i386 0:1.8.5-5.el5_1.1
Complete!
Loading “fastestmirror” plugin
Loading mirror speeds from cached hostfile
* dlutter: people.redhat.com
* base: dist1.800hosting.com
* updates: centos-distro.cavecreek.net
* addons: mirror.steadfast.net
* extras: mirror.unl.edu
dlutter 100% |=========================| 951 B 00:00
primary.xml.gz 100% |=========================| 5.8 kB 00:00
dlutter : ################################################## 19/19
base 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Excluding Packages in global exclude list
Finished
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package rubygems.noarch 0:0.9.4-1.el5 set to be updated
–> Processing Dependency: ruby-rdoc for package: rubygems
–> Running transaction check
—> Package ruby-rdoc.i386 0:1.8.5-5.el5_1.1 set to be updated
–> Processing Dependency: ruby-irb = 1.8.5-5.el5_1.1 for package: ruby-rdoc
–> Running transaction check
—> Package ruby-irb.i386 0:1.8.5-5.el5_1.1 set to be updated
–> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
rubygems noarch 0.9.4-1.el5 dlutter 513 k
Installing for dependencies:
ruby-irb i386 1.8.5-5.el5_1.1 base 67 k
ruby-rdoc i386 1.8.5-5.el5_1.1 base 135 k
Transaction Summary
=============================================================================
Install 3 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 716 k
Downloading Packages:
(1/3): ruby-irb-1.8.5-5.e 100% |=========================| 67 kB 00:00
(2/3): ruby-rdoc-1.8.5-5. 100% |=========================| 135 kB 00:00
(3/3): rubygems-0.9.4-1.e 100% |=========================| 513 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: ruby-irb ######################### [1/3]
Installing: ruby-rdoc ######################### [2/3]
Installing: rubygems ######################### [3/3]
Installed: rubygems.noarch 0:0.9.4-1.el5
Dependency Installed: ruby-irb.i386 0:1.8.5-5.el5_1.1 ruby-rdoc.i386 0:1.8.5-5.el5_1.1
Complete!
最後に、Railsのインストール。
gem install rails
Bulk updating Gem source index for: http://gems.rubyforge.org
ERROR: While executing gem … (Gem::GemNotFoundException)
Could not find rails (> 0) in any repository
root@host [~]# gem install –remote rails –include-dependencies
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-2.1.0
Successfully installed rake-0.8.1
Successfully installed activesupport-2.1.0
Successfully installed activerecord-2.1.0
Successfully installed actionpack-2.1.0
Successfully installed actionmailer-2.1.0
Successfully installed activeresource-2.1.0
Installing ri documentation for rake-0.8.1…
Installing ri documentation for activesupport-2.1.0…
Installing ri documentation for activerecord-2.1.0…
Installing ri documentation for actionpack-2.1.0…
Installing ri documentation for actionmailer-2.1.0…
Installing ri documentation for activeresource-2.1.0…
Installing RDoc documentation for rake-0.8.1…
Installing RDoc documentation for activesupport-2.1.0…
Installing RDoc documentation for activerecord-2.1.0…
Installing RDoc documentation for actionpack-2.1.0…
Installing RDoc documentation for actionmailer-2.1.0…
Installing RDoc documentation for activeresource-2.1.0…
Bulk updating Gem source index for: http://gems.rubyforge.org
ERROR: While executing gem … (Gem::GemNotFoundException)
Could not find rails (> 0) in any repository
root@host [~]# gem install –remote rails –include-dependencies
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-2.1.0
Successfully installed rake-0.8.1
Successfully installed activesupport-2.1.0
Successfully installed activerecord-2.1.0
Successfully installed actionpack-2.1.0
Successfully installed actionmailer-2.1.0
Successfully installed activeresource-2.1.0
Installing ri documentation for rake-0.8.1…
Installing ri documentation for activesupport-2.1.0…
Installing ri documentation for activerecord-2.1.0…
Installing ri documentation for actionpack-2.1.0…
Installing ri documentation for actionmailer-2.1.0…
Installing ri documentation for activeresource-2.1.0…
Installing RDoc documentation for rake-0.8.1…
Installing RDoc documentation for activesupport-2.1.0…
Installing RDoc documentation for activerecord-2.1.0…
Installing RDoc documentation for actionpack-2.1.0…
Installing RDoc documentation for actionmailer-2.1.0…
Installing RDoc documentation for activeresource-2.1.0…
○追記
ruby-develをインストールしないと、追加のモジュール(?)のインストールとかではまる。
例↓
# gem install mysql
Select which gem to install for your platform (i386-linux)
1. mysql 2.7.3 (mswin32)
2. mysql 2.7.1 (mswin32)
3. mysql 2.7 (ruby)
4. mysql 2.6 (ruby)
5. Skip this gem
6. Cancel installation
> 3
Building native extensions. This could take a while…
ERROR: While executing gem … (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.
ruby extconf.rb install mysql
can’t find header files for ruby.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out
Select which gem to install for your platform (i386-linux)
1. mysql 2.7.3 (mswin32)
2. mysql 2.7.1 (mswin32)
3. mysql 2.7 (ruby)
4. mysql 2.6 (ruby)
5. Skip this gem
6. Cancel installation
> 3
Building native extensions. This could take a while…
ERROR: While executing gem … (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.
ruby extconf.rb install mysql
can’t find header files for ruby.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out
○参考にしたサイト
dlutterレポジトリの追加はこのページを参考に。