Ruby on Railsのインストール
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[Ruby]]
*環境 [#ebf20a46]
CentOS release 6.7 (Final)
*Rubyのインストール [#i54fbf82]
***パッケージのインストール [#ic3d84a7]
# yum install gcc gcc-c++ make autoconf openssl-devel re...
# yum install zlib zlib-devel openssl-devel sqlite-devel...
***rbenvのインストール [#a9001bee]
# yum install openssl-devel readline-devel zlib-devel li...
# cd /usr/local
# git clone git://github.com/sstephenson/rbenv.git rbenv
Initialized empty Git repository in /usr/local/rbenv/.git/
remote: Counting objects: 2325, done.
remote: Total 2325 (delta 0), reused 0 (delta 0), pack-r...
Receiving objects: 100% (2325/2325), 411.02 KiB | 260 Ki...
Resolving deltas: 100% (1453/1453), done.
# mkdir rbenv/shims rbenv/versions rbenv/plugins
# groupadd rbenv
# chgrp -R rbenv rbenv
# chmod -R g+rwxXs rbenv
***rbenv-buildのインストール [#e6d68ee4]
# cd /usr/local/rbenv/plugins
# git clone git://github.com/sstephenson/ruby-build.git ...
Initialized empty Git repository in /usr/local/rbenv/plu...
remote: Counting objects: 5249, done.
remote: Total 5249 (delta 0), reused 0 (delta 0), pack-r...
Receiving objects: 100% (5249/5249), 985.32 KiB | 930 Ki...
Resolving deltas: 100% (2893/2893), done.
# chgrp -R rbenv ruby-build
# chmod -R g+rwxs ruby-build
***rbenv-default-gemsのインストール [#qe356b86]
# cd /usr/local/rbenv/plugins
# git clone git://github.com/sstephenson/rbenv-default-g...
Initialized empty Git repository in /usr/local/rbenv/rbe...
remote: Counting objects: 18, done.
remote: Total 18 (delta 0), reused 0 (delta 0), pack-reu...
Receiving objects: 100% (18/18), done.
Resolving deltas: 100% (4/4), done.
# chgrp -R rbenv rbenv-default-gems
# chmod -R g+rwxs rbenv-default-gems
***環境変数の設定 [#a947295f]
# vi /etc/profile.d/rbenv.sh
export RBENV_ROOT="/usr/local/rbenv"
export PATH="$RBENV_ROOT/bin:$PATH"
eval "$(rbenv init -)"
# source /etc/profile.d/rbenv.sh
# rbenv -v
rbenv 0.4.0-215-g90373d7
***デフォルトでインストールするgemの指定 [#s7a6155f]
# vi /usr/local/rbenv/default-gems
bundler
rbenv-rehash
***インストールするrubyのバージョンを確認 [#t1a9a2c5]
# rbenv install -l
***rubyのインストール [#f169145f]
# rbev install 2.2.4
Downloading ruby-2.2.4.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.t...
Installing ruby-2.2.4...
Installed ruby-2.2.4 to /usr/local/rbenv/versions/2.2.4
Fetching: bundler-1.11.2.gem (100%)
Successfully installed bundler-1.11.2
Parsing documentation for bundler-1.11.2
Installing ri documentation for bundler-1.11.2
Done installing documentation for bundler after 7 seconds
1 gem installed
Fetching: rbenv-rehash-0.3.gem (100%)
Successfully installed rbenv-rehash-0.3
Parsing documentation for rbenv-rehash-0.3
Installing ri documentation for rbenv-rehash-0.3
Done installing documentation for rbenv-rehash after 0 s...
# rbenv global 2.2.4
# ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
# bundle -v
Bundler version 1.11.2
*Railsのインストール [#z56c08b5]
# gem search -r rails
# gem install rails
# rails -v
Rails 4.2.5
参考URL:http://www.ken10.com/ruby/ruby_install.html
*Passengerのインストール [#p7d00daa]
# gem install passenger --no-ri --no-rdoc -V
# passenger -v
Phusion Passenger 5.0.22
# rbenv rehash
# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module install...
This installer will guide you through the entire install...
shouldn't take more than 3 minutes in total.
Here's what you can expect from the installation process:
1. The Apache 2 module will be installed for you.
2. You'll learn how to configure Apache.
3. You'll learn how to deploy a Ruby on Rails applicati...
Don't worry if anything goes wrong. This installer will ...
solve any problems.
Press Enter to continue, or Ctrl-C to abort.
--------------------------------------------
Which languages are you interested in?
Use <space> to select.
If the menu doesn't display correctly, press '!'
‣ ⬢ Ruby
⬢ Python
⬡ Node.js
⬡ Meteor
--------------------------------------------
~
インストーラーが走ります
~
Enjoy Phusion Passenger, a product of Phusion (www.phusi...
https://www.phusionpassenger.com
Phusion Passenger is a registered trademark of Hongli La...
# passenger-install-apache2-module --snippet >> /etc/htt...
LoadModule passenger_module /usr/local/rbenv/versions/2....
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rbenv/versions/2.2.4/lib/ruby...
PassengerDefaultRuby /usr/local/rbenv/versions/2.2.4/b...
</IfModule>
# cd /etc/httpd/conf.d
# vim ◯◯.conf
---
[パターン1:Rails以外でAlias使いたい場合]
Alias /test-rails /var/www/vhosts/test-rails/app/public
<Location /test-rails>
PassengerEnabled on
RailsEnv development
PassengerBaseURI /test-rails
PassengerAppRoot /var/www/vhosts/test-rails/app/
</Location>
<Directory " /var/www/vhosts/test-rails/app/public">
AllowOverride All
Options -MultiViews
</Directory>
参考URL:http://qiita.com/61503891/items/732d9c123c39e35...
---
[パターン2:Railsだけの場合]
DocumentRoot /var/www/vhosts/test-rails/app/public
RailsEnv development
<Directory " /var/www/vhosts/test-rails/app/public">
AllowOverride All
Options -MultiViews
</Directory>
---
# service httpd configtest
# service httpd graceful
# gem install sqlite3
# mkdir -p /var/www/vhosts/test-rails
# cd /var/www/vhosts/test-rails
# rails new app
Bundle complete! 12 Gemfile dependencies, 54 gems now in...
Use `bundle show [gemname]` to see where a bundled gem i...
run bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted
# cd app
# vi Gemfile
- #gem 'therubyracer', platforms: :ruby
+ gem 'therubyracer', platforms: :ruby
# chown -R 一般ユーザー:一般ユーザー /var/www/vhosts/te...
# su - 一般ユーザー
# bundle install
参考URL:http://qiita.com/merrill/items/87bf1ecfac8aa49f...
終了行:
[[Ruby]]
*環境 [#ebf20a46]
CentOS release 6.7 (Final)
*Rubyのインストール [#i54fbf82]
***パッケージのインストール [#ic3d84a7]
# yum install gcc gcc-c++ make autoconf openssl-devel re...
# yum install zlib zlib-devel openssl-devel sqlite-devel...
***rbenvのインストール [#a9001bee]
# yum install openssl-devel readline-devel zlib-devel li...
# cd /usr/local
# git clone git://github.com/sstephenson/rbenv.git rbenv
Initialized empty Git repository in /usr/local/rbenv/.git/
remote: Counting objects: 2325, done.
remote: Total 2325 (delta 0), reused 0 (delta 0), pack-r...
Receiving objects: 100% (2325/2325), 411.02 KiB | 260 Ki...
Resolving deltas: 100% (1453/1453), done.
# mkdir rbenv/shims rbenv/versions rbenv/plugins
# groupadd rbenv
# chgrp -R rbenv rbenv
# chmod -R g+rwxXs rbenv
***rbenv-buildのインストール [#e6d68ee4]
# cd /usr/local/rbenv/plugins
# git clone git://github.com/sstephenson/ruby-build.git ...
Initialized empty Git repository in /usr/local/rbenv/plu...
remote: Counting objects: 5249, done.
remote: Total 5249 (delta 0), reused 0 (delta 0), pack-r...
Receiving objects: 100% (5249/5249), 985.32 KiB | 930 Ki...
Resolving deltas: 100% (2893/2893), done.
# chgrp -R rbenv ruby-build
# chmod -R g+rwxs ruby-build
***rbenv-default-gemsのインストール [#qe356b86]
# cd /usr/local/rbenv/plugins
# git clone git://github.com/sstephenson/rbenv-default-g...
Initialized empty Git repository in /usr/local/rbenv/rbe...
remote: Counting objects: 18, done.
remote: Total 18 (delta 0), reused 0 (delta 0), pack-reu...
Receiving objects: 100% (18/18), done.
Resolving deltas: 100% (4/4), done.
# chgrp -R rbenv rbenv-default-gems
# chmod -R g+rwxs rbenv-default-gems
***環境変数の設定 [#a947295f]
# vi /etc/profile.d/rbenv.sh
export RBENV_ROOT="/usr/local/rbenv"
export PATH="$RBENV_ROOT/bin:$PATH"
eval "$(rbenv init -)"
# source /etc/profile.d/rbenv.sh
# rbenv -v
rbenv 0.4.0-215-g90373d7
***デフォルトでインストールするgemの指定 [#s7a6155f]
# vi /usr/local/rbenv/default-gems
bundler
rbenv-rehash
***インストールするrubyのバージョンを確認 [#t1a9a2c5]
# rbenv install -l
***rubyのインストール [#f169145f]
# rbev install 2.2.4
Downloading ruby-2.2.4.tar.gz...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.t...
Installing ruby-2.2.4...
Installed ruby-2.2.4 to /usr/local/rbenv/versions/2.2.4
Fetching: bundler-1.11.2.gem (100%)
Successfully installed bundler-1.11.2
Parsing documentation for bundler-1.11.2
Installing ri documentation for bundler-1.11.2
Done installing documentation for bundler after 7 seconds
1 gem installed
Fetching: rbenv-rehash-0.3.gem (100%)
Successfully installed rbenv-rehash-0.3
Parsing documentation for rbenv-rehash-0.3
Installing ri documentation for rbenv-rehash-0.3
Done installing documentation for rbenv-rehash after 0 s...
# rbenv global 2.2.4
# ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
# bundle -v
Bundler version 1.11.2
*Railsのインストール [#z56c08b5]
# gem search -r rails
# gem install rails
# rails -v
Rails 4.2.5
参考URL:http://www.ken10.com/ruby/ruby_install.html
*Passengerのインストール [#p7d00daa]
# gem install passenger --no-ri --no-rdoc -V
# passenger -v
Phusion Passenger 5.0.22
# rbenv rehash
# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module install...
This installer will guide you through the entire install...
shouldn't take more than 3 minutes in total.
Here's what you can expect from the installation process:
1. The Apache 2 module will be installed for you.
2. You'll learn how to configure Apache.
3. You'll learn how to deploy a Ruby on Rails applicati...
Don't worry if anything goes wrong. This installer will ...
solve any problems.
Press Enter to continue, or Ctrl-C to abort.
--------------------------------------------
Which languages are you interested in?
Use <space> to select.
If the menu doesn't display correctly, press '!'
‣ ⬢ Ruby
⬢ Python
⬡ Node.js
⬡ Meteor
--------------------------------------------
~
インストーラーが走ります
~
Enjoy Phusion Passenger, a product of Phusion (www.phusi...
https://www.phusionpassenger.com
Phusion Passenger is a registered trademark of Hongli La...
# passenger-install-apache2-module --snippet >> /etc/htt...
LoadModule passenger_module /usr/local/rbenv/versions/2....
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rbenv/versions/2.2.4/lib/ruby...
PassengerDefaultRuby /usr/local/rbenv/versions/2.2.4/b...
</IfModule>
# cd /etc/httpd/conf.d
# vim ◯◯.conf
---
[パターン1:Rails以外でAlias使いたい場合]
Alias /test-rails /var/www/vhosts/test-rails/app/public
<Location /test-rails>
PassengerEnabled on
RailsEnv development
PassengerBaseURI /test-rails
PassengerAppRoot /var/www/vhosts/test-rails/app/
</Location>
<Directory " /var/www/vhosts/test-rails/app/public">
AllowOverride All
Options -MultiViews
</Directory>
参考URL:http://qiita.com/61503891/items/732d9c123c39e35...
---
[パターン2:Railsだけの場合]
DocumentRoot /var/www/vhosts/test-rails/app/public
RailsEnv development
<Directory " /var/www/vhosts/test-rails/app/public">
AllowOverride All
Options -MultiViews
</Directory>
---
# service httpd configtest
# service httpd graceful
# gem install sqlite3
# mkdir -p /var/www/vhosts/test-rails
# cd /var/www/vhosts/test-rails
# rails new app
Bundle complete! 12 Gemfile dependencies, 54 gems now in...
Use `bundle show [gemname]` to see where a bundled gem i...
run bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted
# cd app
# vi Gemfile
- #gem 'therubyracer', platforms: :ruby
+ gem 'therubyracer', platforms: :ruby
# chown -R 一般ユーザー:一般ユーザー /var/www/vhosts/te...
# su - 一般ユーザー
# bundle install
参考URL:http://qiita.com/merrill/items/87bf1ecfac8aa49f...
ページ名: