Home > Web Front-end > JS Tutorial > body text

[Going Free to the End] Installing Node.JS, NPM and OurJS on Amazon's One-Year Free Server Blog_node.js

WBOY
Release: 2016-05-16 16:39:13
Original
1636 people have browsed it

The operating system chosen here is the community version of Debian. The operating instructions of Debian and Ubuntu are of the same origin. In addition, I have played with Raspberry PI for a period of time before, so I am familiar with it. The following installation process is also applicable to the tree mold pie. (The part about installing node.js and NPM).

1) Register and select

After registering on AWS and binding the signal card, you can use Amazon's one-year free EC2 host, but the configuration is usually relatively low, usually 0.612Mb (linux) and 1G (Win) memory.

http://aws.amazon.com/

The community version of Debian selected here is Debian-squeeze-amd64-pvm-2014-07-21-ebs)

Type t1.micro
Memory (GiB) 0.613

2) Log in to the cloud host

Unlike Guofeng hosts, which usually use passwords to log in, Amazon uses encryption authorization (pem format key certificate generated by openssl) certificate to log in by default,

A copy will be automatically downloaded when creating a host instance. Windows users must first convert it to PPK format (details), which may take a long time.

The second thing to note is that Debian’s default login username is admin, not root or ec2:

After logging in, switch the user to become root

sudo -i
Copy after login

3) Install Node.js and NPM

The latest versions of NodeJS and NPM require manual downloading of source code and local compilation and installation.

The node version installed here is 0.10.30.

Before installation, you need to install some dependencies (compilation tools, manifest), such as curl, GCC (4.2), GNU make (3.81). python (2.6 or 2.7) or build-essential (including g and make), etc.

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]
Copy after login

Then run the following installation script, details

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
Copy after login

Check the version after completion

$node --version
v0.10.30
Copy after login

4) Install OurJS

Choose a suitable directory to run the following script (for example, in the /var/www directory)

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

The approximate process is to download ourjs from npm, then copy it out from the node_modules directory, make ourjs.sh executable and run the service.

5) Test it at http://localhost:8054

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

Sincerely, NodeJS, NPM and ourjs blogging system are basically ready for use, but node.js is more effective when used with nginx. nginx is responsible for static files (CSS, JS, pictures), G-zip, cache (301 cache) ), which can improve performance and save traffic for your server.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!