Ruby On Rails Linux Setting Log

 이번에 학교 연구실 Linux서버에 Ruby on rails를 설치하게 되었다.

여기서는 Ruby on rails를 설치한 일대기를 기록해보기로 한다.

Linux는 Fedora Core 7을 사용하였다.

어떻게 설치를 하였나?

 황대산님이 쓰신 웹개발 2.0 루비 온 레일스 라는 책에서는 Windows와 MAC OS에서 설치하는 방법만 나와있어서 Linux에서 설치하려고 할때에는 어떻게 설치하는지 몰라서 홈페이지에서 찾아보았다.

이번에 Ruby, Ruby on rails 설치는 링크(http://www.dreamincode.net/forums/index.php?showtopic=30705&hl)를 참고로 설치를 하였다.

 

필요한 Fedora package설치

우선 설치하기 전에 httpd와 mysql은 기본적으로 깔려있어야 한다.

혹시나 모를까봐 httpd(웹서버)와 Mysql(DB-데이터베이스)가 설치가 되었는지를 확인해본다.

[root@localhost ~]# yum install httpd mysql-server mysql

깔려져있다는 것을 확인을 하였다.

[root@localhost ~]# yum install httpd mysql-server mysql
Setting up Install Process
Parsing package install arguments
Package httpd - 2.2.8-1.fc7.x86_64 is already installed.
Package mysql-server - 5.0.45-6.fc7.x86_64 is already installed.
Package mysql - 5.0.45-6.fc7.x86_64 is already installed.
Nothing to do
[root@localhost ~]#

readline 라이브러리가 이 Linux에 깔려있다는 것을 확인하였다.

[root@localhost ~]# yum install readline
Setting up Install Process
Parsing package install arguments
Package readline - 5.2-4.fc7.i386 is already installed.
Package readline - 5.2-4.fc7.x86_64 is already installed.
Nothing to do
[root@localhost ~]#

깔려 있다는 것을 확인하였다.

 

Ruby Package 설치

Ruby는 우선 Fedora core 7 배포판에 있는 것으로 사용하기로 하였다.

[root@localhost ~]# yum install ruby
fedora                    100% |=========================| 2.1 kB    00:00
macromedia                100% |=========================| 1.9 kB    00:00
updates                   100% |=========================| 2.3 kB    00:00
primary.sqlite.bz2        100% |=========================| 3.9 MB    01:59
adobe-linux-i386          100% |=========================|  951 B    00:00
Setting up Install Process
Parsing package install arguments
Package ruby - 1.8.6.114-1.fc7.x86_64 is already installed.
Nothing to do
[root@localhost ~]#

이미 설치가 되어 있다는 것을 확인하였다 -_-;; (언제 깔았는지는 나도 잘 모른다.  컴퓨터를 받은 3월초에 Ruby를 사용한답시고 설치했을듯 하다.)

 

그리고 나서 RubyGems(루비젬)을 설치해보자.

루비젬(RubyGems)은 루비의 각종 라이브러리를 자동으로 설치하고 관리해주는 패키지 관리 유틸리티로 레일즈 설치에 사용된다.

루비젬은 Fedora Core 7 배포판에서 받아 설치를 한다.

 [root@localhost rubygems-1.1.1]# yum install rubygems

설치하면 아래와 같이 다른 프로그램도 깔리게 된다. 이것도 깔아야 설치가 된다.

[root@localhost rubygems-1.1.1]# yum install rubygems
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package rubygems.noarch 0:0.9.4-1.fc7 set to be updated
--> Processing Dependency: ruby-rdoc for package: rubygems
--> Running transaction check
---> Package ruby-rdoc.x86_64 0:1.8.6.114-1.fc7 set to be updated
--> Processing Dependency: ruby-irb = 1.8.6.114-1.fc7 for package: ruby-rdoc
--> Running transaction check
---> Package ruby-irb.x86_64 0:1.8.6.114-1.fc7 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 rubygems                noarch     0.9.4-1.fc7      updates           498 k
Installing for dependencies:
 ruby-irb                x86_64     1.8.6.114-1.fc7  updates           274 k
 ruby-rdoc               x86_64     1.8.6.114-1.fc7  updates           342 k

Transaction Summary
=============================================================================
Install      3 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 1.1 M
Is this ok [y/N]:

y(yes)를 입력하고 나서 설치를 한다.

설치를 하면 아래와 같은 글자들이 나온다.

Downloading Packages:
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.fc7
Dependency Installed: ruby-irb.x86_64 0:1.8.6.114-1.fc7 ruby-rdoc.x86_64 0:1.8.6.114-1.fc7
Complete!
[root@localhost ~]#

그리고는 Complete!라 나오면서 설치가 끝난다.

그리고 나서 나머지도 설치를 한다.

[root@localhost ~]# yum install install ruby ruby-devel ruby-irb ruby-libs ruby-rdoc ruby-ri rubygems

아래와 같이 설치가 된다.

[root@localhost lib]# yum install install ruby ruby-devel ruby-irb ruby-libs ruby-rdoc ruby-ri rubygems
fedora                    100% |=========================| 2.1 kB    00:00
macromedia                100% |=========================| 1.9 kB    00:00
updates                   100% |=========================| 2.3 kB    00:00
primary.sqlite.bz2        100% |=========================| 3.1 MB    00:15
adobe-linux-i386          100% |=========================|  951 B    00:00
Setting up Install Process
Parsing package install arguments
No package install available.
Package ruby - 1.8.6.114-1.fc7.x86_64 is already installed.
Package ruby-irb - 1.8.6.114-1.fc7.x86_64 is already installed.
Package ruby-libs - 1.8.6.114-1.fc7.x86_64 is already installed.
Package ruby-rdoc - 1.8.6.114-1.fc7.x86_64 is already installed.
Package rubygems - 0.9.4-1.fc7.noarch is already installed.
Resolving Dependencies
--> Running transaction check
---> Package ruby-libs.i386 0:1.8.6.114-1.fc7 set to be updated
---> Package ruby-devel.i386 0:1.8.6.114-1.fc7 set to be updated
---> Package ruby-ri.x86_64 0:1.8.6.114-1.fc7 set to be updated
---> Package ruby-devel.x86_64 0:1.8.6.114-1.fc7 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 ruby-devel              i386       1.8.6.114-1.fc7  updates           770 k
 ruby-devel              x86_64     1.8.6.114-1.fc7  updates           778 k
 ruby-ri                 x86_64     1.8.6.114-1.fc7  updates           2.0 M
Installing for dependencies:
 ruby-libs               i386       1.8.6.114-1.fc7  updates           1.7 M

Transaction Summary
=============================================================================
Install      4 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 5.2 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): ruby-devel-1.8.6.1 100% |=========================| 778 kB    00:06
(2/4): ruby-ri-1.8.6.114- 100% |=========================| 2.0 MB    00:05
(3/4): ruby-devel-1.8.6.1 100% |=========================| 770 kB    00:03
(4/4): ruby-libs-1.8.6.11 100% |=========================| 1.7 MB    00:05
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: ruby-libs                    ######################### [1/4]
  Installing: ruby-devel                   ######################### [2/4]
  Installing: ruby-ri                      ######################### [3/4]
  Installing: ruby-devel                   ######################### [4/4]

Installed: ruby-devel.i386 0:1.8.6.114-1.fc7 ruby-devel.x86_64 0:1.8.6.114-1.fc7 ruby-ri.x86_64 0:1.8.6.114-1.fc7
Dependency Installed: ruby-libs.i386 0:1.8.6.114-1.fc7
Complete!
[root@localhost lib]#

설치를 다 하였으면 아래 명령어로 rails를 설치하자.

[root@localhost ~]# gem install rails --include-dependencies

아래와 같이 설치가 된다.

[root@localhost ~]# gem install rails --include-dependencies
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-2.0.2
Successfully installed rake-0.8.1
Successfully installed activesupport-2.0.2
Successfully installed activerecord-2.0.2
Successfully installed actionpack-2.0.2
Successfully installed actionmailer-2.0.2
Successfully installed activeresource-2.0.2
Installing ri documentation for rake-0.8.1...
Installing ri documentation for activesupport-2.0.2...
Installing ri documentation for activerecord-2.0.2...
Installing ri documentation for actionpack-2.0.2...
Installing ri documentation for actionmailer-2.0.2...
Installing ri documentation for activeresource-2.0.2...
Installing RDoc documentation for rake-0.8.1...
Installing RDoc documentation for activesupport-2.0.2...
Installing RDoc documentation for activerecord-2.0.2...
Installing RDoc documentation for actionpack-2.0.2...
Installing RDoc documentation for actionmailer-2.0.2...
Installing RDoc documentation for activeresource-2.0.2...
[root@localhost ~]#

rails를 설치를 하였으면 mongrel를 설치하기로 한다.

아래와 같이 명령어 쳐서 설치하면 된다.

[root@localhost ~]# gem install gem_plugin daemons capistrano --include-dependencies

[root@localhost ~]# gem install mongrel mongrel_cluster railsmachine --include-dependencies

아래와 같이 설치가 된다.

[root@localhost ~]# gem install gem_plugin daemons capistrano --include-dependencies
Successfully installed gem_plugin-0.2.3
Installing ri documentation for gem_plugin-0.2.3...
Installing RDoc documentation for gem_plugin-0.2.3...
Successfully installed daemons-1.0.10
Installing ri documentation for daemons-1.0.10...
While generating documentation for daemons-1.0.10
... MESSAGE:   Unhandled special: Special: type=33, text="All"
... RDOC args: --ri --op /usr/lib/ruby/gems/1.8/doc/daemons-1.0.10/ri --quiet lib README Releases TODO
(continuing with the rest of the installation)
Installing RDoc documentation for daemons-1.0.10...
Successfully installed capistrano-2.3.0
Successfully installed net-ssh-2.0.1
Successfully installed net-sftp-2.0.0
Successfully installed net-scp-1.0.0
Successfully installed net-ssh-gateway-1.0.0
Successfully installed highline-1.4.0
Installing ri documentation for capistrano-2.3.0...
While generating documentation for capistrano-2.3.0
... MESSAGE:   Unhandled special: Special: type=33, text="Notes"
... RDOC args: --ri --op /usr/lib/ruby/gems/1.8/doc/capistrano-2.3.0/ri --quiet lib
(continuing with the rest of the installation)
Installing ri documentation for net-ssh-2.0.1...
While generating documentation for net-ssh-2.0.1
... MESSAGE:   Unhandled special: Special: type=33, text="This"
... RDOC args: --ri --op /usr/lib/ruby/gems/1.8/doc/net-ssh-2.0.1/ri --quiet lib
(continuing with the rest of the installation)
Installing ri documentation for net-sftp-2.0.0...
While generating documentation for net-sftp-2.0.0
... MESSAGE:   Unhandled special: Special: type=33, text="Net::SFTP"
... RDOC args: --ri --op /usr/lib/ruby/gems/1.8/doc/net-sftp-2.0.0/ri --quiet lib
(continuing with the rest of the installation)
Installing ri documentation for net-scp-1.0.0...
While generating documentation for net-scp-1.0.0
... MESSAGE:   Unhandled special: Special: type=33, text="Provides"
... RDOC args: --ri --op /usr/lib/ruby/gems/1.8/doc/net-scp-1.0.0/ri --quiet lib
(continuing with the rest of the installation)
Installing ri documentation for net-ssh-gateway-1.0.0...
While generating documentation for net-ssh-gateway-1.0.0
... MESSAGE:   Unhandled special: Special: type=33, text="A"
... RDOC args: --ri --op /usr/lib/ruby/gems/1.8/doc/net-ssh-gateway-1.0.0/ri --quiet lib
(continuing with the rest of the installation)
Installing ri documentation for highline-1.4.0...
While generating documentation for highline-1.4.0
... MESSAGE:   Unhandled special: Special: type=33, text="A"
... RDOC args: --ri --op /usr/lib/ruby/gems/1.8/doc/highline-1.4.0/ri --title HighLine Documentation --main README --quiet lib README INSTALL TODO CHANGELOG LICENSE
(continuing with the rest of the installation)
Installing RDoc documentation for capistrano-2.3.0...
Installing RDoc documentation for net-ssh-2.0.1...
Installing RDoc documentation for net-sftp-2.0.0...
Installing RDoc documentation for net-scp-1.0.0...
Installing RDoc documentation for net-ssh-gateway-1.0.0...
Installing RDoc documentation for highline-1.4.0...
[root@localhost ~]#
[root@localhost ~]# gem install mongrel mongrel_cluster railsmachine --include-dependencies
Select which gem to install for your platform (x86_64-linux)
 1. mongrel 1.1.4 (ruby)
 2. mongrel 1.1.4 (java)
 3. mongrel 1.1.4 (x86-mswin32-60)
 4. mongrel 1.1.3 (java)
 5. mongrel 1.1.3 (i386-mswin32)
 6. mongrel 1.1.3 (ruby)
 7. Skip this gem
 8. Cancel installation
> 1
Select which gem to install for your platform (x86_64-linux)
 1. fastthread 1.0.1 (mswin32)
 2. fastthread 1.0.1 (ruby)
 3. fastthread 1.0.1 (i386-mswin32)
 4. Skip this gem
 5. Cancel installation
> 2
Building native extensions.  This could take a while...
Building native extensions.  This could take a while...
Successfully installed mongrel-1.1.4
Successfully installed fastthread-1.0.1
Successfully installed cgi_multipart_eof_fix-2.5.0
Installing ri documentation for mongrel-1.1.4...
Installing ri documentation for fastthread-1.0.1...

No definition for dummy_dump

No definition for dummy_dump

No definition for rb_queue_marshal_load

No definition for rb_queue_marshal_dump
Installing ri documentation for cgi_multipart_eof_fix-2.5.0...
Installing RDoc documentation for mongrel-1.1.4...
Installing RDoc documentation for fastthread-1.0.1...

No definition for dummy_dump

No definition for dummy_dump

No definition for rb_queue_marshal_load

No definition for rb_queue_marshal_dump
Installing RDoc documentation for cgi_multipart_eof_fix-2.5.0...
Successfully installed mongrel_cluster-1.0.5
Successfully installed railsmachine-1.0.0
[root@localhost ~]#

For the last install, it may ask which version you want, choose the latest ruby versions.

마지막 설치에서 어떤 버전을 원하는지를 물어보는데 나는 최신 Ruby 버전을 선택하였다.

Select which gem to install for your platform (x86_64-linux)
 1. mongrel 1.1.4 (ruby)
 2. mongrel 1.1.4 (java)
 3. mongrel 1.1.4 (x86-mswin32-60)
 4. mongrel 1.1.3 (java)
 5. mongrel 1.1.3 (i386-mswin32)
 6. mongrel 1.1.3 (ruby)
 7. Skip this gem
 8. Cancel installation
> 1
Select which gem to install for your platform (x86_64-linux)
 1. fastthread 1.0.1 (mswin32)
 2. fastthread 1.0.1 (ruby)
 3. fastthread 1.0.1 (i386-mswin32)
 4. Skip this gem
 5. Cancel installation
> 2

이유는 간단하다. 웹페이지에 쓰여져 있기 때문이다. 물어보는것도 Platform을 어떤 것으로 하는 가를 물어보기 때문에 선택할 것이 Ruby밖에 없었다. (Ruby 설치하는 법도 잘 모르므로 -_-;; 자세한 것은 고수님 Help~)

 

 

Mongrel 설정

root권한에서 설정을 하였다.

* Creating a mongrel user to run mongrel as: /usr/sbin/adduser -r mongrel
* Create mongrel conf directory: mkdir /etc/mongrel_cluster
* Symlink mongrel initscript
ln -s /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/resources/mongrel_cluster /etc/init.d/mongrel_cluster
* Make it executable chmod 755 /usr/lib/ruby/gems/1.8/gems/mongrel_cluster-1.0.5/resources/mongrel_cluster
* Add it to chkconfig chkconfig --add mongrel_cluster
* Enable it in chkconfig chkconfig mongrel_cluster on

여기서 중요한 점은 mongrel_cluster 버전이 뭔가에 따라 폴더이름이 다르다. 이 점을 유의해야 한다.

 

후기

설치는 링크(http://www.dreamincode.net/forums/index.php?showtopic=30705&hl)를 참고로 설치를 하였다.

나도 웹에서 보고 찾은 내용들을 한글로 정리하니까 뿌듯(?)까지는 아니지만 한글 Rails문서를 쓴다는 것에 보람을 느낀다.

말로만 듣던 Ruby on Rails를 나도 개발하게 되는 것인가? ㅎㅎ

 

이 글은 스프링노트에서 작성되었습니다.

Buy me a coffeeBuy me a coffee

+ Recent posts