星期日, 4月 01, 2018

Digital Ocean 申請小記

Digital Ocean 申請小記


之前分享完 Ansible in Azure, 接下來就是 Ansible in Digital Ocean 了


參考網路上面的文章, 來申請帳號( 這樣可以拿到 US$ 10 的免費額度 )


申請的過程我是參考 https://cyku.tw/digital-ocean/
這樣就可以得到 US$ 10 的額度


我是使用 PayPal 的方式
  • PayPal 要先預存 US$ 5 , 但是因為 PayPal 付款要經由使用者同意, 所以我覺得比信用卡請款多一到機制. :)




驗證完畢之後
到 Settings 裡面的 Referrals 也會看到自己的推薦碼
我的推薦碼就是 https://m.do.co/c/10c9834672d6
也就是別人用這個推薦碼, 也可以得到 US$ 10 的額度 :)

接下來看 Dashboard


目前還沒有建立任何機器, 就來建立機器吧 ( Droplet 水滴 )
點選 Create Droplet



接下來就是選擇相關設定


例如 作業系統,
這邊 ……… 沒有 openSUSE …...Orz
只能先選 Ubuntu 16.04.4 x64
Size 先選最小

我只有 地區改成新加坡, 其他地方先按照預設值



點選 Create



接下來在 Dashboard 就會出現 Droplet




然後因為沒有加入 SSH Key, 所以相關資訊都是透過信箱來傳遞的


所以在很短的時間內
就會收到 IP / 帳號 / 密碼的相關資訊




接下來就是使用 ssh 連線到主機


例如


# ssh  -l   root   SERVER_IP


以下在 Digital Ocean 的主機操作


先進行 apt-get  update
root@ubuntu-s-1vcpu-1gb-sgp1-01:~# apt-get  update


安裝 apache2 套件來測試一下吧 :)


root@ubuntu-s-1vcpu-1gb-sgp1-01:~# apt-get   install apache2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
 grub-pc-bin
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 ssl-cert
Suggested packages:
 www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom openssl-blacklist
The following NEW packages will be installed:
 apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 ssl-cert
0 upgraded, 10 newly installed, 0 to remove and 6 not upgraded.
Need to get 1,557 kB of archives.
After this operation, 6,432 kB of additional disk space will be used.
Do you want to continue? [Y/n] y


觀察 apache2 的狀況


# systemctl  status apache2
● apache2.service - LSB: Apache2 web server
  Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
 Drop-In: /lib/systemd/system/apache2.service.d
          └─apache2-systemd.conf
  Active: active (running) since Sun 2018-04-01 06:23:25 UTC; 2min 0s ago
    Docs: man:systemd-sysv-generator(8)
   Tasks: 55
  Memory: 6.4M
     CPU: 130ms
  CGroup: /system.slice/apache2.service
          ├─2832 /usr/sbin/apache2 -k start
          ├─2835 /usr/sbin/apache2 -k start
          └─2836 /usr/sbin/apache2 -k start

然後連結到該 Public IP 測試
網頁出現了......
這樣的使用經驗, 其實跟 Azure 的使用經驗很不一樣
  • 使用者帳號:  
    • Azure 都要 sudo
    • Digital Ocean 直接就是 root
  • Firewall:  
    • Azure 要另外透過 Security Group 來開
    • Digital Ocean 是不是預設就開?



不過至少也是跨出 Digital Ocean 一小步


~ enjoy it


Reference



沒有留言: