Install node. JS NPM and OurJS blogs on Amazon's one year free server

  • 2020-03-30 03:42:04
  • OfStack

The operating system used here is the community version of Debian, Debian and Ubuntu operating instructions are in the same line, plus played a period of time before the Raspberry PI, I am familiar with, the following installation process is also applicable to the Raspberry pie (install node.js and NPM part).

1) registration and selection

You can use amazon's free EC2 host for one year once you register with aws and bind your signal card, but the configuration is usually low, typically 0.612mb (Linux) and 1gb (Win) of memory.

(link: http://aws.amazon.com/)

This is the community version of Debian which is debian-squeezing-amd64-pvm-2014-07-21-ebs)

Type t1. Micro
The Memory (GiB) 0.613

2) log on to the cloud host

Instead of using a password to log in, Amazon USES a cryptographic authorization (pem format key certificate generated by openssl) certificate to log in.

A copy is automatically downloaded when the host instance is created. Windows messages are converted to PPK format (in detail) first, which can take a long time.

The second thing to note is that Debian implicitly identifies the login username as admin, not root or ec2:

After logging in, switch the user to root


sudo -i

3) install node. js and NPM

The latest versions of NodeJS and NPM require a manual download of the source code and a local installation.

The node version installed here is 0.10.30.

Before installation, you need to install some dependencies (compiler tools, listing), such as curl, GCC (4.2+), GNU make (3.81+). Python (2.6 or 2.7) or build-essential(including g++ and make).


apt-get update 
apt-get install curl
apt-get install python
apt-get install gcc
apt-get install make
apt-get install build-essential   #(g++ and make included in it, detail)
apt-get install libssl-dev [optional]

Then run the following setup script


echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh

Check the version when the run is complete


$node --version
v0.10.30

4) install OurJS

Select a suitable directory to run the following script (e.g. under /var/www)


npm install ourjs
cp -r node_modules/ourjs ./
chmod 755 ./ourjs/ourjs.sh && ./ourjs/ourjs.sh

Presumably, the process is to download ourjs from the NPM, then copy it out of the node_modules directory, and make ourjs.sh executable and run the service.

5) test it out at (link: http://localhost:8054)

If you want to access the service from a public network, you need to add port 8054 to the security group.

NodeJS, NPM and ourjs blog systems are already basically available, but node.js works better with nginx, which is responsible for static files (CSS, js, images), g-zip, and cache(301 cache), which can improve your server performance and save traffic.


Related articles: