Cloud server linux (CentOS) environment installed node environment

1, the cloud server I want to install is to configure the environment in Tencent bought the following

2, I login directly through Tencent provide examples> rightmost logged in, click Login Now

Now click Log will let you enter a password, if you forgot your password, instance> More Actions> Modify password just fine

And then link the remote server

3, the median view server information

Command: uname -a

 Obviously I am a 64-bit

4, the new installation directory

First switch to the root directory

cd /

In lose

ll

See all the files in that directory

 

 

 Excuting an order

cd app app && mkdir // create the app directory and enter

5, download node archive

Select the appropriate environment according to their own version of the official website at the node, for example, I choose https://npm.taobao.org/mirrors/node/v8.9.3/node-v8.9.3-linux-x64.tar.xz , because I linux64 bit is, I was able to meet this

Entry

wget  https://npm.taobao.org/mirrors/node/v8.9.3/node-v8.9.3-linux-x64.tar.xz (download link)

Once downloaded we enter

ll

 

 

Obviously, we have compressed package,

6, unzip and rename

the Node-v8.9.3--xvf tar Linux-x64.tar.xz (To unzip the file name)

Then find the file name is too long, we have to change the name of the folder after extracting under

the Node-v8.9.3-Linux mv-x64 (modified former name) nodejs (the modified name)

 

 

 We have found that there is a folder nodejs

7, establish global links

For each place can have access to node, we have established a global connection

先退出到根目录 cd ..

然后依次执行

ln -s /app/nodejs/bin/npm /usr/local/bin/

ln -s /app/nodejs/bin/node /usr/local/bin/

执行后

node -v

 

 看到已经成功!

 

 

当然有些人会卡在最后一步全局绑定,会发现绑定不了,这时你就要看路径对不,

进入到usr目录下看有没有local目录(百度试了没有,腾讯的有),如果没有直接删掉local那层目录,直接绑定在bin上就好了

ln -s /app/nodejs/bin/npm /usr/bin/

ln -s /app/nodejs/bin/node /usr/bin/

如果还不成功,要检查前面的路径是否正确。

 

Guess you like

Origin www.cnblogs.com/yuanzhiguo/p/11448074.html