use rvm to manage Ruby versions
# Install RVM
\curl -sSL https://get.rvm.io | bash -s stable
# Reload your shell
source ~/.rvm/scripts/rvm
# Install Ruby
rvm install 3.1.4
rvm use 3.1.4 --default
use china mirror to speed up Ruby installation
# 配置 RVM 使用 Ruby China 的镜像
echo "ruby_url=https://cache.ruby-china.com/pub/ruby" >> ~/.rvmrc
# 或者使用清华大学镜像
echo "ruby_url=https://mirrors.tuna.tsinghua.edu.cn/ruby" >> ~/.rvmrc
# 然后安装
rvm install 3.1.4