一臺連上外網的機器
1.下載對應的 node 安裝包
2.下載 Elasticsearch-head 安裝包(順便解壓)
3.cmd 輸入下面命名安裝taobao提供的鏡像(原因你懂的)
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
4.cmd cd 到你解壓的 elasticsearch-head 目錄下$ cnpm install這時你會發現多了一個 node_modules 目錄
5.install 后,head 目錄下會自動生成一個 node_modules 目錄,里面為相關的依賴
到此,本地的準備工作都已完成。
可以把兩個安裝包上傳到服務器。
建議:elasticsearch-head 重新壓縮后上傳
在 /etc/profile 添加(改成你的路徑)
export NODE_HOME=/usr/local/elastic/node/node-v6.9.2-linux-x64export PATH=$NODE_HOME/bin:$PATH
記得 $ source /etc/profile
在 elastic/config/elasticsearch.yml 添加(否則完成后網頁中會顯示未連接)
http.cors.enabled: true http.cors.allow-origin: "*"
之后(后臺啟動加 &)
./grunt server
在網頁中輸入你的
http://localhost:9100