Eric Guo's blog.cloud-mes.com

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

Deploy next.js App to a Dedicateed Rocky Linux V8

Permalink

Create a new user

adduser changelog
sudo su - changelog
mkdir .ssh
chmod 700 .ssh
vi .ssh/authorized_keys # and paste your public key
chmod 600 .ssh/authorized_keys

Install Node.js 18 and Yarn

curl -sL https://rpm.nodesource.com/setup_18.x -o nodesource_setup.sh
sudo bash nodesource_setup.sh
sudo dnf install -y nodejs
sudo yum install gcc-c++ make
curl -sL https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo yum install yarn

From DigitalOcean blog

Fix permissions for the deploy folder

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

Install other tools

sudo yum install git
sudo dnf update
sudo dnf install epel-release
sudo dnf install htop
echo 'machine git.thape.com.cn login Eric-Guo password personal_token_here' >> ~/.netrc

Install PM2 & Nginx

sudo dnf install nginx
sudo npm install pm2@latest -g

Or alternatively install PM2 as system daemon

Copy Nginx configuration and disable firewall

cp /var/www/changelog/current/config/nginx/changelog.conf /etc/nginx/conf.d/
systemctl restart nginx
firewall-cmd --zone=public --add-service=https
firewall-cmd --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
systemctl restart firewalld

Comments