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?

Rails7.1、ruby3.34を詰まらずインストールしたい人へ

Last updated at Posted at 2024-07-09

rubyのインストール中にライブラリ不足によるコンパイルエラーが複数回発生し、解消したら次のエラー、それも解消したらまた次の・・・のように無駄に時間がかかったので、スムーズにインストールできるようにまとめてみました。

環境

WSL(Ubuntu 22.04.4 LTS)

手順

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

sudo apt update -y
sudo apt upgrade -y
sudo apt install build-essential -y
sudo apt install -y libssl-dev libreadline-dev zlib1g-dev libyaml-dev libz-dev libffi-dev

rbenvとrubyをインストール

# rbenvをインストール
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL -l

# rubyをインストール
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
rbenv install 3.34
rbenv global 3.34

railsをインストール

# バージョン指定しなければ最新版に
gem install rails
# 動作確認
rails -v

参考

https://qiita.com/Gushi_maru/items/f3b5cc43e135e678085f
https://qiita.com/lionooil/items/a21fab7950517e48ed10

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?