1, create a new directory in the root directory/down, to save the downloaded files
# Mkdir/down
Cd/down
2. Installing node. JS Related Software
First to install GCC gcc-g++ openssl-devel
# yum Install gcc gcc-g++ openssl-devel
Yum Install-y bzip2*
3. Download Python 2.7
#wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
Unzip the installation
#tar ZXVF python-2.7.3.tgz
#cd Python-2.7.3
#./configure && make && make install
Restart View version: Python–v for 2.7.3
4. Download node. JS Decompression Installation
# Cd/down
# wget http://nodejs.org/dist/v0.8.14/node-v0.8.14.tar.gz
# tar ZXVF node-v0.8.14.tar.gz
# CD node-v0.8.14
#./configure && make && make install
This could take a few minutes.
Finally see updating shebang of/usr/local/bin/npm To/usr/local/bin/node
It means the installation was successful.
To verify that the installation is successful, you can verify:
Write a script into the/down directory and file named node. js
var
http = require(
‘http‘
);
http.createServer(
function
(req,res){
res.end(
‘hello node.js‘
);
}).listen(8080,
"127.0.0.1"
);
console.log(
‘Server is running at http://127.0.0.1:8080/‘
)
Then start with the command line
#node/down/node.js
See Command line output
?
1
Server is running at http:
//127.0.0.1:8080/
Then use the CentOS-brought Firefox to open http://127.0.0.1:8080/
OK to end O (∩_∩) o haha
node. js