CentOS7 安装Node服务环境

安装mongodb

  1. 更新源

    yun -y update
    
  2. 创建mongodb的repo文件

    vi /etc/yum.repos.d/mongodb-org.repo
    
  3. 粘贴以下内容,保存。

    [mongodb-org]
    name=MongoDB Repository
    baseurl=http://mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-org/3.2/x86_64/
    gpgcheck=0
    enabled=1
    
  4. 安装

    yum install -y mongodb-org
    
  5. 启动

    sudo service mongod start
    
  6. 设置开机启动

    sudo chkconfig mongod on
    

安装nginx:

  1. 添加nginx到yum 源
sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
  1. 安装nginx
sudo yum install -y nginx
  1. 启动Nginx

    sudo systemctl start nginx.service
    
  2. 开机启动

    sudo systemctl enable nginx.service
    

安装git

yum install git-core

安装nvm

curl https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash

通过nvm 安装node

nvm install stable

全局安装yarn,pm2

npm install -g yarn pm2

reference:

  • http://www.cnblogs.com/LongJiangXie/p/6080791.html
  • https://blog.csdn.net/u012486840/article/details/52610320

你可能感兴趣的:(CentOS7 安装Node服务环境)