centos ruby

本文详细介绍了如何在CentOS操作系统中安装高于默认版本的Ruby,包括步骤和注意事项,帮助用户顺利进行Ruby开发环境的搭建。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

[root@bogon LiDeploy-master]# rake secret
rake aborted!
cannot load such file -- bundler/setup
/var/www/html/LiDeploy-master/config/boot.rb:3:in `<top (required)>'
/var/www/html/LiDeploy-master/config/application.rb:1:in `<top (required)>'
/var/www/html/LiDeploy-master/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)

[root@bogon LiDeploy-master]# yum install bundler
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * atomic: www5.atomicorp.com
 * base: mirrors.163.com
 * centos-sclo-rh: mirrors.bfsu.edu.cn
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.huaweicloud.com
没有可用软件包 bundler。
错误:无须任何处理

[root@bogon LiDeploy-master]# gem install bundler
ERROR:  Error installing bundler:
	bundler requires Ruby version >= 2.3.0.

https://www.cnblogs.com/ding2016/p/7903147.html
CentOs安装高版本ruby

~]# wget http://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.5.tar.gz
~]# tar zxvf  ruby-2.3.5.tar.gz
~]# cd ruby-2.3.5
ruby-2.3.5]# ./configure  --prefix=/opt/ruby
ruby-2.3.5]# make && make install
ruby-2.3.5]# ln -s /opt/ruby/bin/ruby /usr/bin/ruby
ruby-2.3.5]# ln -s /opt/ruby/bin/gem /usr/bin/gem

ln -s /opt/ruby/bin/bundle /usr/bin/bundle
bundle install
...
Installing pg 0.21.0 with native extensions
Your lockfile doesn't include a valid resolution.
You can fix this by regenerating your lockfile or trying to manually editing the bad locked gems to a version that satisfies all dependencies.
The unmet dependencies are:
* bundler (< 2.0, >= 1.3.0), depended upon rails-4.2.8, unsatisfied by bundler-2.2.32
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /opt/ruby/lib/ruby/gems/2.3.0/gems/pg-0.21.0/ext
/opt/ruby/bin/ruby -r ./siteconf20211129-2048-1d63pti.rb extconf.rb
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

gem install bundler -v 1.17.1
bundle install
Fetching pg 0.21.0
Installing pg 0.21.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

yum -y install postgresql-server postgresql-devel postgresql-contrib
gem install pg -v '1.2.1' 


bundle install
Gem files will remain installed in /opt/ruby/lib/ruby/gems/2.3.0/gems/therubyracer-0.12.3 for inspection.
Results logged to /opt/ruby/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/therubyracer-0.12.3/gem_make.out

An error occurred while installing therubyracer (0.12.3), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.3' --source 'https://rubygems.org/'` succeeds before bundling.

yum install gcc-c++
bundle install

rake secret
...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值