CentOS 7 install nodejs
1879 ワード
How To Install Latest Nodejs and NPM on CentOS/RHEL 7/6/5
Node.js s is a plotform built on Chrome’s JavaScript runtime for eaeasumimimimimimimimimimimimimimimimimimimimimimimimiding fast、scalablle networkaplications.Latest version node.js yum repositotomimimimimimintainining byitits oits oofififififififififififififififificial aatttttweweweaaatttttttttttttttttttttttttttttttttttttttttttttttttt...
Step 1–Add Node.js Yum Repository
First we will add node.js yum repository in our system provided by nodejs oficial website.You also need development tools to build addons to be installed on on your system.噜Œhttps://rpm.nodesource.com/setup_6.x|sudo-E bash-
Step 2–Install Node.js and NPM
After adding yum repository in your system、lets install Nodejs package.NPM will also be installed with node.js.This command Wiso install many other dependent package.on your system.
After installing node.js verify and check the installed version.You can find more details about current version node.js oficial website.$node-v 6.2.Also check the version of npm.npm.npm-3.9
Step 4–Create Demo Web Server(Optional)
This is an optional step.If you want to test your node.js install.Lets create a web server with「Welcome Node.js」text.Create a file demoserver.js$vim demo userver.js and add follwing content var http=require('http')http.create Server.{req,res){res.writeHead(200,''Content-Type':''text/plin');es.end('Welcome Node.js'))).listen(3001,127..0.1);consone.log('Server running athttp://127.0.0.1:3001/')Now start the web server using below command.$node--debug demoserver.js debuggar listening on 588 Server running athttp://127.0.0.1:3001/Web server has been started on 3001.Now accesshttp://127.0.0.1:3001/url in browser.
Node.js s is a plotform built on Chrome’s JavaScript runtime for eaeasumimimimimimimimimimimimimimimimimimimimimimimimiding fast、scalablle networkaplications.Latest version node.js yum repositotomimimimimimintainining byitits oits oofififififififififififififififificial aatttttweweweaaatttttttttttttttttttttttttttttttttttttttttttttttttt...
Step 1–Add Node.js Yum Repository
First we will add node.js yum repository in our system provided by nodejs oficial website.You also need development tools to build addons to be installed on on your system.噜Œhttps://rpm.nodesource.com/setup_6.x|sudo-E bash-
Step 2–Install Node.js and NPM
After adding yum repository in your system、lets install Nodejs package.NPM will also be installed with node.js.This command Wiso install many other dependent package.on your system.
# **yum install nodejs**
Step 3–Check Node.js and NPM VersionAfter installing node.js verify and check the installed version.You can find more details about current version node.js oficial website.$node-v 6.2.Also check the version of npm.npm.npm-3.9
Step 4–Create Demo Web Server(Optional)
This is an optional step.If you want to test your node.js install.Lets create a web server with「Welcome Node.js」text.Create a file demoserver.js$vim demo userver.js and add follwing content var http=require('http')http.create Server.{req,res){res.writeHead(200,''Content-Type':''text/plin');es.end('Welcome Node.js'))).listen(3001,127..0.1);consone.log('Server running athttp://127.0.0.1:3001/')Now start the web server using below command.$node--debug demoserver.js debuggar listening on 588 Server running athttp://127.0.0.1:3001/Web server has been started on 3001.Now accesshttp://127.0.0.1:3001/url in browser.