ruby
Ruby,一种简单快捷的面向对象(面向对象程序设计)脚本语言,在20世纪90年代由日本人松本行弘(Yukihiro Matsumoto)开发,遵守GPL协议和Ruby License。它的灵感与特性来自于 Perl、Smalltalk、Eiffel、Ada以及 Lisp 语言。由 Ruby 语言本身还发展出了JRuby(Java平台)、IronRuby(.NET平台)等其他平台的 Ruby 语言替代品。
download ruby
ruby Linux | ruby Windows | 环境依赖缺失的rpm可以在此处搜索下载 | libyaml-devel | ruby文档 |
CN EN | CN EN | 下载 | rpm 源码 | cn en |
Linux 各系统下载使用参考
Red Hat | Rocky Linux | Oracle Linux | AlmaLinux | ubuntu | suselinux | esxi | RHEL标准安装 | 系统安装参考 | YUM参考 | MobaXterm 远程连接工具 | Red Hat Enterprise 9.0 文档 | Kickstart 生成器 | |||||
download | download | download | download | download | download | download | 参考 | 参考 | 配置参考 | download | 参考 | Kickstart | |||||
版本兼容性 |
ruby 一键部署脚本
- 实现在线下载ruby,编译安装ruby,ruby环境依赖安装,环境变量配置,镜像源更改,安装完成删除下载包。
- /opt/ruby #安装目录
- ruby依赖libyaml-devel,以下两种方式实现
yum --enablerepo=powertools install libyaml-devel -y
或
yum install -y https://yum.oracle.com/repo/OracleLinux/OL8/codeready/builder/x86_64/getPackage/libyaml-devel-0.1.7-5.el8.x86_64.rpm
vi /ruby3_install.sh
#!/bin/bash
# -*- coding: utf-8 -*-
# Author: CIASM
# update 2023/05/31
# install source ruby 3
<<!
#linux ruby
https://www.ruby-lang.org/zh_cn/downloads/
https://www.ruby-lang.org/en/downloads/
# windwos ruby
https://rubyinstaller.cn/
https://rubyinstaller.org/
#yaml libyaml-devel tar gz
https://pyyaml.org/download
yaml rpm check libyaml-devel
https://pkgs.org/
!
install_ruby (){
if ! command -v ruby &> /dev/null
then
if [ $? -eq 0 ];then
#ruby variable
ruby_url=https://cache.ruby-lang.org/pub/ruby/3.2/
ruby_gz=ruby-3.2.2.tar.gz
ruby_directory=ruby-3.2.2
ruby_installation_directory=/opt/ruby
root_directory=/root
echo "Dependent installation"
yum install -y http://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
yum install -y git bzip2 curl wget net-tools cmake make gcc gcc-c++ openssl-devel readline-devel zlib-devel sqlite-devel libffi-devel gdbm-devel ncurses-devel
yum install -y https://yum.oracle.com/repo/OracleLinux/OL8/codeready/builder/x86_64/getPackage/libyaml-devel-0.1.7-5.el8.x86_64.rpm
#yum --enablerepo=powertools install libyaml-devel -y
echo "download ruby"
wget -N -P $root_directory $ruby_url$ruby_gz
echo "make instll ruby"
tar -zxf $root_directory/$ruby_gz -C $root_directory
cd $root_directory/$ruby_directory && ./configure --prefix=$ruby_installation_directory && make && make install
echo "ruby environment variable"
echo 'export PATH=$PATH:/opt/ruby/bin' >> ~/.bash_profile
source ~/.bash_profile
echo "Replacement of Chinese source"
gem sources -r https://rubygems.org/ -a https://gems.ruby-china.com/
gem sources -l
echo "ruby version chek"
ruby -v | awk '{print $2}'
gem -v | awk '{print $2}'
echo "rm ruby"
rm -rf $root_directory/$ruby_directory $root_directory/$ruby_gz
echo "Plug-in installation test"
gem install bundler
echo -e "\033[32mThe ruby Install Success...\033[0m"
else
echo -e "\033[31mThe ruby Install Failed...\033[0m"
exit 1
fi
else
echo -e "\033[33mThe ruby Install already...\033[0m"
fi
}
main (){
install_ruby
}
main
执行安装ruby
sh /ruby3_install.sh
ruby 安装完成版本获取,上述自动化脚本内容已增加,以下只是单独列出
ruby -v && gem -v