centos源码安装ruby

2021-05-28 10:16:06 浏览数 (1)

一.简介

Ruby,一种简单快捷的面向对象(面向对象程序设计)脚本语言。rvm是ruby的管理器,可以切换ruby版本,下载ruby。

二.程序部署

1.下载ruby wget http://shell-auto-install.oss-cn-zhangjiakou.aliyuncs.com/package/ruby-2.4.4.tar.gz

2.安装编译需要的依赖 yum -y install gcc make openssl openssl-devel zlib zlib-devel

3.解压并编译安装 tar -xvf package/ruby-2.4.4.tar.gz cd ruby-2.4.4/ ./configure --prefix=/usr/local/ruby``make && make install

4.增加环境变量 echo "RUBY_HOME=/usr/local/ruby/bin" >> /etc/profile echo 'PATH=$RUBY_HOME:$PATH' >> /etc/profile source /etc/profile

5.配置zlib cd ext/zlib``ruby extconf.rb sed -i 's,zlib.o: $(top_srcdir)/include/ruby.h,zlib.o: ../../include/ruby.h,g' Makefile make && make install

6.配置openssl cd .. cd openssl ruby extconf.rb sed -i 's,$(top_srcdir),../..,g' Makefile make && make install

7.查看版本 ruby -v | grep 2.4

0 人点赞