This article describes how to install Node. JS on Amazon's one-year free plan, NPM, and OurJS Blog system ., For more information, see Debian for the Community edition. The operation commands of Debian and Ubuntu are in the same line, I am familiar with it. The following installation process is also applicable to the installation of node. js and NPM ).
1) Register and select
After registering and binding a signal card on aws, you can use Amazon's one-year free EC2 host. However, the configuration is usually low, usually 0.612 Mb (linux) and 1G (Win) memory.
Here we use the Community version of Debian is the Debian-squeeze-amd64-pvm-2014-07-21-ebs)
Memory (GiB) 0.613
2) log on to the VM instance
Unlike the password used to log on to a Guofeng host, Amazon uses the encrypted authorization (pem format key certificate generated by openssl) Certificate by default to log on,
A copy is automatically downloaded when you create a host instance. For Windows, you must first convert it to the PPK format (detailed), which may take a long time.
Note that the default logon username of Debian is admin rather than root or ec2:
After logging on, switch the user to the root user.
3) install Node. js and NPM
Currently, the latest node. js and NPM versions need to be manually downloaded and installed locally.
The installed node version is 0.10.30.
Before installation, you need to install some dependencies (compiler tool and configuration), such as curl, GCC (4.2 +), and GNU make (3.81 + ). python (2.6 or 2.7) or build-essential (including g ++ and make.
apt-get update apt-get install curlapt-get install pythonapt-get install gccapt-get install makeapt-get install build-essential #(g++ and make included in it, detail)apt-get install libssl-dev [optional]
Run the following installation script.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc. ~/.bashrcmkdir ~/localmkdir ~/node-latest-installcd ~/node-latest-installcurl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1./configure --prefix=~/localmake install # ok, fine, this step probably takes more than 30 seconds...curl https://www.npmjs.org/install.sh | sh
Check the version after running.
4) install OurJS
Select a suitable directory to run the following script (for example, under the/var/www directory)
npm install ourjscp -r node_modules/ourjs ./chmod 755 ./ourjs/ourjs.sh && ./ourjs/ourjs.sh
The general process is to download ourjs from npm, then copy it from the node_modules directory, and change ourjs. sh to executable and run the service.
5) test http: // localhost: 8054.
If you want to access this service from the public network, you need to add Port 8054 to the security group ).
As a result, NodeJS, NPM, and ourjs blog systems are basically ready to use, but node. js works better with nginx. nginx is responsible for static files (CSS, JS, images), G-zip, cache (301 cache ), it can improve the performance of your server and save traffic.