linux服务器 nodejs环境搭建

nodejs服务器环境搭建

安装nodejs

yum install gcc-c++

  1. wget https://nodejs.org/dist/v8.11.3/node-v8.11.3-linux-x64.tar.gz
  2. tar zxvf node-v8.11.3-linux-x64.tar.gz
  3. cd node-v8.11.3-linux-x64
  4. ln -s /home/node/node-v8.11.3-linux-x64/bin/node /usr/local/bin/node root权限
  5. ln -s /home/node/node-v8.11.3-linux-x64/bin/npm /usr/local/bin/npm root权限

安装pm2

  1. npm install -g pm2
  2. ln -s /home/node/node-v8.11.3-linux-x64/lib/node_modules/pm2/bin/pm2 /usr/local/bin/pm2 root权限

安装nignx root权限

  1. wget http://nginx.org/download/nginx-1.10.2.tar.gz
  2. wget http://www.openssl.org/source/openssl-fips-2.0.10.tar.gz
  3. wget http://zlib.net/zlib-1.2.11.tar.gz
  4. wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.40.tar.gz
  5. 以上4个分别解压 tar zxvf xxx (目录名)
  6. 再分别切到目录中 ./configure && make && make install

安装git

  1. yum install git

安装mongo

  1. wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.3.tgz
  2. tar zxvf mongodb-linux-x86_64-3.6.3.tgz
  3. mv mongodb-linux-x86_64-3.6.3 /usr/local/mongodb
  4. cd /usr/local/mongodb
  5. mkdir data
  6. touch mongodb.log
  7. ln -s /usr/local/mongodb/bin/mongo /usr/local/bin/mongo
  8. ln -s /usr/local/mongodb/bin/mongod /usr/local/bin/mongod
  9. mongod -dbpath=/usr/local/mongodb/data -logpath=/usr/local/mongodb/mongodb.log -logappend -port=27017 --fork

安装redis

  1. wget http://download.redis.io/releases/redis-4.0.8.tar.gz
  2. tar zxvf redis-4.0.8.tar.gz
  3. cd redis-4.0.8
  4. make
  5. 确定安装成功后进行编译make test
  6. cd src & make install
  7. redis-server redis.conf &
2018-3-22 15:14:24 浏览(168)
Copyright ©leiwei | 京ICP备18013719号