centos 6.5安裝NodeJS

來源:互聯網
上載者:User

標籤:變數   .com   檔案中   ble   ret   命名   環境   regexp   inux   

centos 6.5安裝NodeJS

 

下載

可以在本地下載node.js最新版,然後通過ftp工具上傳到伺服器,或者直接在伺服器終端使用wget命令下載(我當時下載的是node-v7.5.0-linux-x86版本,其他版本請查看上面連結然後替換即可):

$ wget http://nodejs.org/dist/latest/node-v7.5.0-linux-x86.tar.gz  
解壓

進入伺服器終端,找到上傳或者下載的安裝包,解壓

$ tar -zvxf node-v7.5.0-linux-x86.tar.gz  

移動到安裝目錄並重新命名

$ mv node-v7.5.0-linux-x86 /opt/node
配置環境變數

開啟etc目錄下的 profile 檔案

$ vi /etc/profile

在檔案最後增加如下內容

export NODE_HOME=/opt/nodeexport PATH=$NODE_HOME/bin:$PATH

生效環境變數

$ source /etc/profile

也可以在使用者根目錄下的.bash_profile檔案中增加上面環境變數

$ vi ~/.bash_profile
export NODE_HOME=/opt/node export PATH=$NODE_HOME/bin:$PATH
檢查版本
$ node -vv7.5.0
$ npm -v4.1.2

如有問題歡迎指點

centos 6.5安裝NodeJS

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.