您的位置:首页 > 其它

体验DigitalOcean的VPS云服务

2015-01-10 12:28 260 查看
2015-01-10 wcdj

摘要:在文章《我为什么用DigitalOcean来测试docker容器》的介绍下,注册了一个DigitalOcean VPS(virtual
private servers droplets)云服务,初次体验了下,除了需要承担一些费用(使用$10/mo,1GB Mem/1 Core processor/30GB SSD,一天2元左右RMB,也可以向别人推荐来earn
creadits为自己减少费用),最大的好处就是不会被GFW(各种访问受限,各种网速不给力),就像DigitalOcean官方的介绍”Simple cloud hosting, built for developers. A droplet is a KVM VPS which you get full root access to so you can install anything you like”,方便程序员学习国外新的技术,并且提高工作效率。

注册DigitalOcean VPS的推荐链接(personal referral link)

https://www.digitalocean.com/?refcode=06b03cc8b6ca

说明:像官方所描述的,使用上面的链接注册完成后,注册完成的用户可以获得$10的奖励,可以用这笔费用来体验Digital VPS。同时,推荐人也可以获得一笔奖励。

Give $10, Get $25

Everyone you refer gets $10 in credit. Once they’ve accumulated $25 in billings, you get $25. There is no limit on the amount of credit you can earn through referrals.

完成下面三步,就可以创建和体验自己的VPS服务了:

1,完成注册
2,更新账单(使用DO赠送的$10)
3,创建Droplet(有多种image可以选择,本文选择Ubuntu)





创建完,就可以通过SSH的方式登陆到自己的云服务器了,DigitalOcean会把外网的IP通过邮件的方式告诉我们(更安全的方式应该使用SSH keys)。

Usually, when you spin up your DigitalOcean droplets, you get an email as soon as the process completes, letting you know the droplet’s IP address and password. Although this email is very convenient, there is a more secure (and faster) way of gaining access
to your server without the need for email. This can be done by setting up SSH keys.

说明:如果在创建droplets时没有使用SSH keys(optional),那么在创建好droplets后仍然可以为其添加SSH keys,具体的方法是:

gerryyang@mba:.ssh$ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/gerryyang/.ssh/id_rsa): id_droplet_gerry_rsa
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in id_droplet_gerry_rsa.
Your public key has been saved in id_droplet_gerry_rsa.pub.
The key fingerprint is:
82:8e:9a:33:ca:5e:f5:46:1c:00:f4:b3:11:94:fd:d6 gerryyang@mba.local
The key's randomart image is:
+--[ RSA 2048]----+
|  .oo+o          |
|    ..o.         |
|     + .. .      |
|     .= .o E     |
|    .o.oS        |
|   o. o.         |
|  ...  o         |
|+o.   .          |
|*=               |
+-----------------+
gerryyang@mba:.ssh$cat ~/.ssh/id_droplet_gerry_rsa.pub | ssh root@104.131.173.242 "cat >> ~/.ssh/authorized_keys"
root@104.131.173.242's password: 
gerryyang@mba:.ssh$


使用SSH keys的方式登陆droplet(不用每次都输入密码,比较方便,并且安全):

ssh -i ~/.ssh/id_droplet_gerry_rsa root@104.131.173.242



使用固定密码的方式登陆droplet(每次都需要输入相同的密码,密码可能被force attack):







注意:DO创建完droplet就开始收费,即使你把它power off(sudo poweroff),它也同样在计费,因为droplet使用的资源没有释放。在Billing的选项里可以查看自己的balance和usage情况。如果不希望继续付费可以把droplet删除(destroy),但是会把这个droplet上的数据全部清除(scrub up)。

Note that when you power off your droplet you are still billed for it. This is because your diskspace, CPU, RAM, and IP address are all reserved while it is powered off.



云服务创建完成后,就可以开始自己个性化的体验了(后面可以做的事情),不用再被各种GFW。最后,还要赞一下DigitalOcean,文档和社区建立的非常完善,各种问题基本都可以查到

环境:(使用DigitalOcean注册VPS服务,安装Ubuntu image)
cat /etc/issue

Ubuntu 14.04.1 LTS GNU Linux 3.13.0 37 generic x86_64

使用apt-get安装基础工具:
apt-get update

(1) 安装gcc 4.8.2
apt-get install gcc

(2) 安装docker
apt-get install -y docker.io
ln -sf /usr/bin/docker.io /usr/local/bin/docker
sed -i `$acomplete -F _docker docker` /etc/bash_completion.d/docker.io

(3) 安装go
apt-get install gccgo-go

文件管理可以使用scp命令或者使用ftp工具FileZilla来完成远程机器的文件上传和下载。



参考

http://timyang.net/container/why-digitalocean-coreos/
https://www.digitalocean.com/community/tutorials/how-to-create-your-first-digitalocean-droplet-virtual-server
https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-14-04
https://www.digitalocean.com/community/tags/docker?primary_filter=tutorials

https://www.digitalocean.com/community/tutorials/how-to-connect-to-your-droplet-with-ssh
https://www.digitalocean.com/community/tutorials/where-to-go-from-here?
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: