How to install node. js and express in CentOS Linux, centosnode. js

Source: Internet
Author: User

How to install node. js and express in CentOS Linux, centosnode. js

Preface

Recently, we need to install and use node. js and express because of work requirements. However, I have found many steps and various problems on the Internet, so I 'd like to summarize them myself.

1. Download

wget --no-check-certificate https://nodejs.org/dist/v6.10.1/node-v6.10.1-linux-x64.tar.xz

2. Decompress

tar xvf node-v6.10.1-linux-x64.tar.xz

Node and npm already exist in the bin folder and are set to global.

 sudo ln -s /data/node-v6.10.1-linux-x64/bin/node /usr/local/bin/node sudo ln -s /data/node-v6.10.1-linux-x64/bin/npm /usr/local/bin/npm

3. Install express

npm install express -gd npm install -g express-generator

Set express to global:sudo ln -s /data/node-v6.10.1-linux-x64/bin/express/usr/local/bin/express

4. Successful

express --version

5. npm start in the project

Enter 127.0.0.1: 3000 in the browser

Welcome to express!

If not, check the Firewall:

Modify/etc/sysconfig/iptables File to add the following content:

In-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPTAdd

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT

Open the firewall to port 3000.

6. Successful again!

Summary

The above is all the content of this article. I hope the content of this article will help you in your study or work. If you have any questions, please leave a message, thank you for your support.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.