Install NVM, Yarn, Postgres, Nginx, PM2 on Centos 8

RMAG news

These are the quick commands to install NVM, Nodejs, Yarn, Nginx on Centos 7

1. NVM

sudo yum install curl nano -y
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.bashrc
nvm install 16

2. Yarn

curl –silent –location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo
sudo rpm –import https://dl.yarnpkg.com/rpm/pubkey.gpg
sudo yum install yarn -y

5. Nginx

sudo yum install -y epel-release
sudo yum install -y nginx
sudo systemctl start nginx

Config firewall

sudo yum install firewalld -y
sudo systemctl enable firewalld
sudo reboot
sudo firewall-cmd –state // check the firewall state
firewall-cmd –get-active-zones //check active zones

sudo firewall-cmd –permanent –zone=public –add-service=http
sudo firewall-cmd –permanent –zone=public –add-service=https
sudo firewall-cmd –reload
sudo systemctl enable nginx

6. PostgreSQL

Download:

sudo dnf module enable postgresql:13
sudo dnf install postgresql-server
sudo systemctl start postgresql
sudo systemctl enable postgresql

Setup password for user postgres

sudo -u postgres psql
ALTER USER postgres with password ‘yourpassword’;

Open port 5432 to connect database from remote:
nano /var/lib/pgsql/data/postgresql.conf

listen_addresses = ‘*’
port = 5432

Open firewall port:

firewall-cmd –zone=public –add-port=5432/tcp –permanent
firewall-cmd –reload
systemctl restart firewalld

Open this file: nano /var/lib/pgsql/data/pg_hba.conf and add this line to end of file:

host all all 0.0.0.0/0 md5
host all all ::/0 md5

Restart postgres

sudo systemctl restart postgresql

7. Unzip, git, pm2

yum install -y unzip git
npm i -g pm2

Leave a Reply

Your email address will not be published. Required fields are marked *