0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AWS EC2 ruby on rails 環境構築

Posted at

AWSのEC2で、ruby on railsをダウンロードするだけでは使えない。その前に、rbenv とruby-buildのインストールを行う。
以下手順です。

EC2でruby on railsを使う前にrbenvとruby-buildのインストールを行う。

# ①rbenvのインストール
[ec2-user@ip-172-31-25-189 ~]$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv 

# ②パスを通す
[ec2-user@ip-172-31-25-189 ~]$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile 

# ③rbenvを呼び出すための記述
[ec2-user@ip-172-31-25-189 ~]$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

# ④.bash_profileの読み込み
[ec2-user@ip-172-31-25-189 ~]$ source .bash_profile

# ⑤ruby-buildのインストール
[ec2-user@ip-172-31-25-189 ~]$ git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build

# ⑥rehashを行う
[ec2-user@ip-172-31-25-189 ~]$ rbenv rehash  

EC2にrubyをインストールする

# Ruby 3.2.0のバージョンをインストール
[ec2-user@ip-172-31-25-189 ~]$ rbenv install 3.2.0

# EC2インスタンス内で使用するRubyのバージョンを決める
[ec2-user@ip-172-31-25-189 ~]$ rbenv global 3.2.0

# rehashを行う
[ec2-user@ip-172-31-25-189 ~]$ rbenv rehash  

# Rubyのバージョンを確認
[ec2-user@ip-172-31-25-189 ~]$ ruby -v 
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?