Setting up Nodejs+express Web development framework under Ubuntu 2012-12-27 15:06 Author: nodejsnet Source: Site view: 2,966 readsI want to comment no comment font size: Big small
Abstract : This article summarizes the articles written by predecessors, including the problems they encountered during the installation of node. JS and Express. For later use, while allowing people who are learning node. js to take fewer detours. 1. Installation environment, because the Linux is rookie level, so on the virtual machine installed a ubuntu11.10 casual play, virtual ...
This article summarizes the articles written by predecessors, including the problems they encountered during the installation of node. JS and Express. For later use, while allowing people who are learning node. js to take fewer detours.
1. Installation environment, because the Linux is rookie level, so on the virtual machine installed on a ubuntu11.10 casual play, virtual machine installation here is not much to say.
2.node.js installation: The first step, install the dependency package,
- sudo apt-get install g++ Curl Libssl-dev apache2-utils
- sudo apt-get install Git-core
Step two, get node source
- git clone git://github.com/joyent/node.git
After the download is complete, go to CD node and enter the node folder
Step three: Specify the move out version: Git checkout v0.4.10, Git is a version management tool, this we use Git to move out of 0.4.10 version, if you do not move out of the words directly compiled installation will install node the latest version of the 0.5.5-pre. The latest version is not supported for many commonly used packages. Like Express, so this place must be noticed.
Fourth step: Develop the path, perform the compilation
- $ mkdir ~/local The current user's home directory to create a folder
- $ enter into the unpacked configure folder to execute./configure–prefix= $HOME/local/node to develop a compilation path
- $ make compilation.
- $ sudo make install installed.
- $ Echo ' Export path= $HOME/local/node/bin: $PATH ' >> ~/.profile setting environment variables
- $ Echo ' Export node_path= $HOME/local/node: $HOME/local/node/lib/node_modules ' >> ~/.profile settings Node_path
- $ source ~/.profile
By now we can run node-v to see if the installation was successful. Note that the settings for environment variables here are only temporary.
Fifth step: Set the persistent environment variable,
Setting a persistent environment variable can use the node command even if the machine is restarted. Enter/etc VI profile to append two lines to the last face:
- Export path= "$HOME/local/node/bin: $PATH"
- Export node_path= "$HOME/local/node: $HOME/local/node/lib/node_modules"
Ok. The node. JS installation is complete.
3.express Installation
Install NPM: Execute command:
- Curl Http://npmjs.org/install.sh | Sh
Install Express:
- NPM Install EXPRESS-GD
-G represents the installation to the Lib in Nodepath, and the-D represents the installation of the dependency kit. If there is no-G, the current directory will be installed (a Nodemodules folder will be created)
Perform express-v to see if the installation was successful. To this express has been installed completed.
Executing express XXX In any directory will create a node. js +express Project.
Original: http://club.cnodejs.org/topic/4f28f02b40b803737e018502
Build nodejs+express Web development framework under Ubuntu