Install and configure npm for vpsmate and nodejs in centos6

Source: Internet
Author: User
Tags install php file permissions


1. Install vpsmate

Run the following code in sequence:

Cd/usr/src/
Wget http://www.vpsmate.org/tools/install.py
Python install. py

You need the username and password to log on to the vpsmate administrator background.

The reason for choosing vpsmate is that it does not automatically install PHP, apache, and mysql, although it supports one-click installation of these server programs. Currently, vpsmate is mainly used to edit files and modify file permissions. These operations are visualized and easy to use.

After installation, you can use http: // your IP address: 8888 to open the vpsmate background.

2. Install nodejs

Download and install nodejs in the directory just now, and execute the following code in sequence:

Wget http://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz
Yum install gcc openssl-devel gcc-c ++ compat-gcc-34 ++
Tar-xf node-v0.10.25.tar.gz
Cd node-v0.10.25
./Configure -- prefix =/usr/local/node
Make & make install
Ln-s/usr/local/node/bin/*/usr/sbin/

It takes a little longer to install nodejs v0.10.25.

After the installation is complete, npm is automatically installed.

Run the following command to test whether nodejs and npm are successfully installed:

Node-v
Npm-v
Use npm to install the global module cnpm (reference:/post/nodejs-learning-10-cnpm-supervisor.html ):

Npm install-g cnpm

After the installation is complete, enter the following command in the console:

Cnpm-v
>-Bash: cnpm: command not found

Apparently, the global module fails to be installed. Delete the global module and configure npm.

3. Configure npm

Run the following commands in sequence to configure npm:

Npm set prefix/usr/local
Echo-e '\ nexport PATH =/usr/local/lib/node_modules: $ PATH'> ~ /. Bashrc
Source ~ /. Bashrc

After installing the global module cnpm, complete the installation:

Cnpm-v
> 0.0.26

After the global module is successfully installed, you can use cnpm to install various global or local modules.

Now, the installation and configuration of npm in vpsmate and nodejs are very simple, and there are no problems in the installation process.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.