CentOS 7 下 Ruby 环境搭建
安装前提
需提前安装依赖包
[root@redmine ~]
编译安装 Ruby
安装包准备
https://www.ruby-lang.org/en/news/2017/03/22/ruby-2-4-1-released/
https://www.ruby-lang.org/en/news/2018/10/18/ruby-2-5-3-released/
解压安装包
[root@redmine ~]
[root@redmine ~]
编译 && 安装
[root@redmine ruby-2.4.1]
[root@redmine ruby-2.4.1]
Ruby 环境变量配置
[root@redmine ruby-2.4.1]
RUBY_HOME=/usr/local/ruby-2.4.1
export PATH=$PATH:$RUBY_HOME/bin
[root@redmine ruby-2.4.1]
查看安装结果
[root@redmine ~]
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]
gem 环境配置
更改 gem 源
[root@redmine ~]
更新 gem 库
[root@redmine ~]
gem 安装 rails
[root@redmine ~]
[root@redmine ~]
Fetching: nokogiri-1.13.8-x86_64-linux.gem (100%)
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Forbidden 403 (https://gems.ruby-china.com/quick/Marshal.4.8/nokogiri-1.13.8-x64-unknown.gemspec.rz)
[root@redmine ~]
rails 版本查看
[root@redmine ~]
Rails 5.2.5
Bundle 安装
gem 安装 bundle
[root@redmine ~]
Fetching: bundler-2.3.19.gem (100%)
bundler's executable "bundle" conflicts with /usr/local/ruby-2.4.1/bin/bundle
Overwrite the executable? [yN] y
Successfully installed bundler-2.3.19
Parsing documentation for bundler-2.3.19
Installing ri documentation for bundler-2.3.19
Done installing documentation for bundler after 0 seconds
1 gem installed
参考