Eric Guo's blog.cloud-mes.com

in HTML5, JavaScript, Ruby & Rails, Python, and Cloud MES!

Deploy Rails 7 Master With Webpacker 6 and Tailwind CSS JIT App in CentOS 8

Permalink

Got the newest CentOS 8 (4.18.0-305.12.1.el8_4.x86_64) and ready to install newest Rails 7 and here is the steps.

Disable SELinux

vi /etc/selinux/config

Install locale

dnf install langpacks-en glibc-all-langpacks -y
localectl set-locale LANG=en_US.UTF-8

Turn on EPEL and install htop

yum -y install epel-release
yum install htop

Install node.js 16 & yarn

curl --silent --location https://rpm.nodesource.com/setup_16.x | bash -
yum install -y gcc-c++ make
yum install -y nodejs
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
yum install yarn

Install dependencies required by rbenv and Ruby

yum install openssl-devel readline-devel zlib-devel gdbm-devel git

Setup second user account

adduser matlib
cd /etc/sudoers.d/
echo "matlib ALL=(ALL) NOPASSWD:ALL" > 20-matlib-user
sudo su - matlib
mkdir .ssh
chmod 700 .ssh
vi .ssh/authorized_keys # and paste your public key
chmod 600 .ssh/authorized_keys

Install rbenv and ruby-build

cd # as a matlib
git clone https://github.com/rbenv/rbenv.git .rbenv
cd ~/.rbenv && src/configure && make -C src
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
~/.rbenv/bin/rbenv init
# As an rbenv plugin
mkdir -p "$(rbenv root)"/plugins
git clone https://github.com/rbenv/ruby-build.git "$(rbenv root)"/plugins/ruby-build
git clone https://github.com/andorchen/rbenv-china-mirror.git "$(rbenv root)"/plugins/rbenv-china-mirror

Install Ruby 3.0.2

rbenv install -l
rbenv install 3.0.2
rbenv global 3.0.2
rbenv shell 3.0.2
eval "$(rbenv init -)" >> ~/.bash_profile
echo "gem: --no-document" > ~/.gemrc
gem update --system

Fix permission for CentOS

sudo mkdir /var/www
cd /var/www
sudo mkdir matlib
sudo chown matlib:matlib matlib/

Install nginx

yum install nginx
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --reload

Comments