學習目標
- 於 AWS EC2 安裝 Node-RED
前置準備作業
一台已連上網路的電腦
一個 AWS 帳號
Step 1. 登入到 AWS
登入網址:https://aws.amazon.com/tw/
Step 2. 啟用與設定 EC2
❖ 2.1 點選上方 【 Services 】 ➙ 點選 【 EC2 】
❖ 2.2 點選 【 Launch Instance 】
❖ 2.3 點選 【 Ubuntu Server 14.04 】 旁邊的 【 Select 】
❖ 2.4 點選 【 t2.micro 】 的 Instance Type
❖ 2.5 點選 【 6.Configure Security Group 】
☆ 點選下方的 【 Add Rule 】
☆ 在 【 Type 】 欄位中選擇 【 Custom TCP 】
☆ 在 【 Port Range 】 欄位中輸入 【 1880 】
☆ 在 【 Source 】 欄位中輸入 【 0.0.0.0/0 】
☆ 點選 【 Review and Lanuch 】 按鈕
☆ 點選 【 Lanuch 】 按鈕
☆ 建立 Key
☆ 點選 【 Create a new key pair 】 按鈕
☆ 在 【 Key pair name 】 欄位輸入一個名稱,例如:ec2-node-red
☆ 點選 【 Download Key Pair 】 按鈕
☆ 點選 【 Launch Instances 】 按鈕
☆ 點選 【 View Instances 】 按鈕
☆ 建立完成畫面
Step 3. 安裝 Node-RED
❖ 3.1 登入到 EC2
❖ 3.2 在終端機執行下方指令以安裝 Node-RED
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs build-essential
sudo npm install -g node-red
node-red
❖ 3.3 執行成功畫面
Step 4. 開啟 Node-RED 編輯環境
❖ 4.1 查看 EC2 IP 位置
☆ 點選 EC2 左邊的 【 Instances 】
☆ 查看右邊 【 IPv4 Public IP 】 欄位中的 IP
❖ 4.2 開啟 Chrome 瀏覽器
☆ 在網址列輸入上一步驟的 IP ,最後在加上 【 :1880 】,例如:IP:1880