#更新系统
yum update
#如有ruby就卸载ruby,没有则忽略
yum remove ruby ruby-devel
#下载ruby,并解压到/opt下
wget https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.4.tar.gz
yum install tar.x86_64
tar xzvf ruby-3.1.4.tar.gz -C /opt/
#安装依耐包
yum install make cmake which sqlite-devel openssl-devel libssh2-devel gcc libicu-devel gcc-c++ -y
#编译安装ruby
cd /opt/ruby-3.1.4
./configure
make
make install
#查看安装目录和版本,核验ruby安装成功否
which ruby
ruby -v
#安装ruby gem工具
yum install rubygems -y
#查看gem版本
gem -v
#安装oxidized
gem install oxidized
############报错的处理方式,没报错则忽略###############
############缺少ruby源的处理方式###############
#报错则添加源,没报错就不用添加,一个个试,不用全添加,添加后gem sources -l查看是否添加成功,没有成功就继续再试
gem sources --add Index of /rubygems/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
gem sources -a https://rubygems.org/
gem sources -a http://rubygems.org/
#或者直接在gemrc文件里直接添加源
find /* -name ‘gemrc’ #查找gemrc配置文件路径
vim /root/.gemrc
:backtrace: false
:bulk_threshold: 1000
:sources:
:update_sources: true
:verbose: true
#保存退出,再次查看就能看到添加上了
gem sources -l
#此时再尝试安装oxidized
gem install oxidized
##################### 结束符 ########################
############报错的处理方式,没报错则忽略###############
############提示CMake版本过低的处理方式################
#如果提示:CMake 3.5.1 or higher is required. You are running version 2.8.12.2,则要更新CMake
#卸载cmake
yum remove cmake -y ; yum install -y gcc gcc-c++ make automake openssl openssl-devel
#下载cmake并解压
wget https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz ; tar -zxf cmake*.tar.gz
#安装cmake
cd cmake-3.7.2 ; ./bootstrap ; gmake -j grep 'processor' /proc/cpuinfo | wc -l
; gmake install
#查看cmake版本
/usr/local/bin/cmake --version
#设置cmake软连接到/usr/bin,并测试cmake版本(目的是检测软连接是否成功)
ln -s /usr/local/bin/cmake /usr/bin/
cmake --version
#此时再尝试安装oxidized
gem install oxidized
##################### 结束符 ########################
#安装oxidized-script,oxidized-web
gem install oxidized-script oxidized-web
#查看oxidized配置文件路径
oxidized
#查看配置文件
cat ~/.config/oxidized/config