CentOS6.6 安装 Nodejs 环境

yum install -y vim wget curl git lsof
yum update -y nss curl libcurl
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
source ~/.nvm/nvm.sh
nvm install v8.12.0 && nvm use 8.9.1 && nvm alias default 8.12.0
npm i pm2 yarn -g
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum install -y nginx
sudo service nginx start
sudo service iptables stop
sudo chkconfig iptables off
echo "命令执行结束"

# mongodb
vim /etc/yum.repos.d/mongodb-org-4.0.repo

[mongodb-org-4.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.0.asc

sudo yum install -y mongodb-org
sudo service mongod start


# 备份和还原 
# 使用默认的命令行而不是mongo shell
mongodump -h 127.0.0.1:27017 -d essay -o Documents/essay-backup
mongorestore -h 127.0.0.1:27017 -d essay /root/essay-backup/essay
mongo && use essay

# pm2 
ssh-keygen -t rsa # 拷贝服务器 id_rsa.pub 到github
chmod 600 authorized_keys
chmod 700 -R .ssh
echo "[your public key]" > ~/.ssh/authorized_keys # 拷贝本地的 id_rsa.pub 到服务器

# mac下执行 直接拷贝本地的 id_rsa.pub 到服务器
ssh-copy-id -i ~/.ssh/id_rsa.pub root@116.196.17.78

# 一定要先添加key到git,再clone
git clone https://github.com/wmui/essay.git
pm2 deploy ecosystem.config.js production setup
pm2 deploy ecosystem.config.js production # 本地部署
posted @ 2021-10-07 13:50  wmui  阅读(54)  评论(0编辑  收藏  举报