為 Ubuntu 和 Debian 安裝最新版本的 Node.js

吳青強 8年前發布 | 40K 次閱讀 Node.js Node.js擴展

運行 Ghost 必須要安裝 Node.js。但是 Ubuntu 或 Debian 的軟件倉庫中的 Node.js 更新較慢,甚至只能等到新版本發布才能有最新的 Node.js 用。下面我們說一下從 NodeSource 提供的倉庫中安裝最新版本的 Node.js。

支持的操作系統版本

被支持的 Ubuntu 版本:

  • Ubuntu 12.04 LTS (Precise Pangolin)
  • Ubuntu 14.04 LTS (Trusty Tahr)
  • Ubuntu 15.04 (Vivid Vervet)
  • Ubuntu 15.10 (Wily Werewolf) [For Node >= 4.2.x]

被支持的 Debian 版本:

  • Debian 7 (wheezy)
  • Debian 8 / stable (jessie)
  • Debian testing (stretch, aliased to jessie)
  • Debian unstable (sid)

安裝步驟

Ghost 目前支持 0.10.*0.12.*>=4.2 <5.* (LTS) 版本的 Node.js,推薦的是 >0.10.40 (最新版本)。詳細說明請看這里:http://support.ghost.org/supported-node-versions/

根據我們的安裝經驗,推薦安裝 4.x(LTS)版本的 Node.js。

安裝 Node.js v4.x

Ubuntu 系統

curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -  
sudo apt-get install -y nodejs  

Debian 系統。以 root 權限執行下列指令

curl -sL https://deb.nodesource.com/setup_4.x | bash -  
apt-get install -y nodejs  

安裝 Node.js v0.10

Ubuntu 系統

curl -sL https://deb.nodesource.com/setup_0.10 | sudo -E bash -  
sudo apt-get install -y nodejs  

Debian 系統。以 root 權限執行下列指令

curl -sL https://deb.nodesource.com/setup_0.10 | bash -  
apt-get install -y nodejs  

安裝 Node.js v0.12

Ubuntu 系統

curl -sL https://deb.nodesource.com/setup_0.12 | sudo -E bash -  
sudo apt-get install -y nodejs  

Debian 系統。以 root 權限執行下列指令

curl -sL https://deb.nodesource.com/setup_0.12 | bash -  
apt-get install -y nodejs  

安裝 Node.js v5.x

注意:v5.x 的 Node.js 不被 Ghost 支持,以下安裝介紹只為了完整介紹 Node.js 各個版本的安裝!

Ubuntu 系統

curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -  
sudo apt-get install -y nodejs  

Debian 系統。以 root 權限執行下列指令

curl -sL https://deb.nodesource.com/setup_5.x | bash -  
apt-get install -y nodejs  

 

來自:http://www.ghostchina.com/install-nodejs-of-latest-version-in-ubuntu-and-debian/

 本文由用戶 吳青強 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!