Eric Guo's

Hoping writing JS, Ruby & Rails and Go article, but fallback to DevOps note

Deploy New Rails App Using Ruby 3.2 on CentOS 7 Server


Ruby 3.2 introduce JIT which need Rust compiler, it also need higher version of GCC, I choose install pre-build Rust Toolset 7

sudo yum install centos-release-scl
sudo yum install rust-toolset-7

Enable Rust and new C++:

scl enable devtoolset-7 bash
scl enable rust-toolset-7 bash

Create new user largly following 2019 posts

Setup second user account

adduser pagila
gpasswd -a pagila wheel
cd /etc/sudoers.d
echo "pagila ALL=(ALL) NOPASSWD:ALL" > 95-pagila-user
sudo su - pagila
mkdir .ssh
chmod 700 .ssh
vi .ssh/authorized_keys
chmod 600 .ssh/authorized_keys

Install rbenv and ruby-build

cd # as a pagila
git clone .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
~/.rbenv/bin/rbenv init # also edit ~/.bash_profile
# As an rbenv plugin
mkdir -p "$(rbenv root)"/plugins
git clone "$(rbenv root)"/plugins/ruby-build
git clone "$(rbenv root)"/plugins/rbenv-china-mirror

Install Ruby 3.2.0

scl enable devtoolset-7 bash
rbenv install -l
rbenv install 3.2.0
rbenv global 3.2.0
rbenv shell 3.2.0
echo "gem: --no-document" > ~/.gemrc

Install some hard to install gems

brew install freetds
brew list freetds
gem install tiny_tds -- --with-freetds-dir=/opt/homebrew/Cellar/freetds/1.3.16