DEV Community

Lê Vũ Huy
Lê Vũ Huy

Posted on • Updated on

Install NVM, Nodejs, Yarn, Python3, GCC, Nginx, Postgres on Centos 7

These are the quick commands to install NVM, Nodejs, Yarn, Python3, Gcc, 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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

3. Python 3

If you want to install sqlite on Centos7, you will need python3 and gcc

sudo yum install -y python3
Enter fullscreen mode Exit fullscreen mode

4. GCC

yum install gcc-c++ -y
yum install cmake -y
yum install centos-release-scl -y
yum install devtoolset-9 -y

scl enable devtoolset-9 bash
Enter fullscreen mode Exit fullscreen mode

If you restart the shell, it will revert to GCC 4.8.5.
You can add source /opt/rh/devtoolset-9/enable into you bashrc file to set GCC 9 as the default.

5. Nginx

sudo yum install -y epel-release
sudo yum install -y nginx
sudo systemctl start nginx
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

6. PostgreSQL

Download:

sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y postgresql15-server
sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
sudo systemctl start postgresql-15
sudo systemctl enable postgresql-15
Enter fullscreen mode Exit fullscreen mode

Setup password for user postgres

sudo passwd postgres
Enter fullscreen mode Exit fullscreen mode

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

listen_addresses = '*'
port = 5432 
Enter fullscreen mode Exit fullscreen mode

Open firewall port:

firewall-cmd --zone=public --add-port=5432/tcp --permanent
firewall-cmd --reload
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Restart postgres

sudo systemctl restart postgresql-15
Enter fullscreen mode Exit fullscreen mode

7. Unzip

yum install -y unzip
Enter fullscreen mode Exit fullscreen mode

Top comments (0)