谷歌云VPS入门指南 | Getting started with Google Cloud VPS
拥有用一台云服务器可以让我们做很多有趣的事情,比如创建个人博客,搭建科学上网服务,搞搞离线下载,私人云盘,内网穿透等等。VPS建在哪里好呢,本博主推荐谷歌云, 只要一张外币信用卡即可搞定,注册完毕后谷歌云提供给你一年免费的300美金赠金,可以免费试用其中的各种功能,到期后还可继续选择试用,听起来是不是赞爆。 那么这期教程就来聊聊搭建谷歌云VPS的过程及注意事项。
A cloud server allows us to do lots of interesting things, like build a website, run a personal blog, etc. It is recommended creating your VPS on Google cloud, free trial for $300 on 1 year, and fully renewable. So let’s get started.
目录 / LIST
# 前期准备 | Preparations
- 你需要一个注册好赠金的谷歌云账号。
- A Google Cloud account that is registered with a $300 bonus is required.
# 配置防火墙 | Firewall config
- 实例创建前首先需要配置防火墙,通过
VPC网络
菜单进入防火墙规则
页面,点击创建防火墙规则
。 - Firstly let’s go to filewall settings. Select
VPC Network
, thenFirewall rules
, thenAdd rule
.
- 名称随便起,流量方向选
入站
,然后对匹配项执行的操作选允许
,其他参数保持默认。 - Pickup a name u like, then choose
ingress
,permit
, other settings remain default.
- 接下来,来源IP地址范围,填入
0.0.0.0/0
,不要遗漏后面的0,协议和端口选全部允许
,其他参数保持默认,点击创建
。 - Input
0.0.0.0/0
in Source IP address, and chooseAll allowed
in Protocol and port, other settings remain default, thenCreate
.
- 创建完成后,可以回到
防火墙规则
页面,把其他默认的规则都删掉,因为这些规则都会被我们创建的这个新规则覆盖掉,而且谷歌云内置默认的全部允许出站流量,不需要再创建出站规则。 - After the creation is complete, you can go back to the
Firewall Rules
page and delete the other default rules, because these rules will be overwritten by the new rule we created, and Google Cloud has a built-in rule to allow all egress flow, so where is no need to create one.
# 创建VM示例 | New instance
- 点击
Compute Engin
,选择VM实例
,然后点击创建实例
。 - Select
Compute Engin
, thenVM Instances
, andCreate
.
- 名称随便填,区域的话选台湾最快,地区随便选,机型的话选
f1-micro
就够用了。 - Pick an instance name, and region based on your location. And a
f1-micro
is enough for use.
- 然后剩下的设置都不需要改动,保持默认即可,最后点击
创建
。 - Other settings remain default, then click
Create
.
# IP地址筛选 | Select IP address
- 创建完成的实例默认会分配一个动态IP地址,那这个IP速度怎样呢,还需要进行测试。
- 一般情况下谷歌云分配的地址都是新的,但也有二手的,而且有很大几率是被墙的或者ping很高的劣质IP。
- The instance we created will be assigned a dynamic IP address by default, and it needs to be tested.
- There are also second-handed IP address, and there is a high probability that it is a poor quality IP that is gfwalled or the ping value is very high.
- 把刚才创建的实例的外部IP地址拷贝下来,然后打开这个网站 ipip.net Ping查询 Ping一下。
- Just copy the IP address, and test it here: ipip.net Ping inquiry.
- 选中实例,点击
停止
,再启动
,即可刷新动态IP地址,可以多试几次,直到选中满意的为止。 - 选好IP地址后,需要把这个动态IP改为静态IP,以免实例重启后IP地址发生变化。
- 通过
VPC网络
菜单进入外部IP地址
页面,点击类型
列中的临时
,把它改为静态
,名字可以随便写,最后点保留
即可。 - Select the instance, click
Stop
, thenStart
, to refresh IP address, you can try several times until you find the best one. - After selecting an IP address, you need to change this dynamic IP to a static IP to prevent the IP address from changing after the instance is restarted.
- Go to the
External IP Address
page of theVPC Network
menu, clickTemporary
in theType
column, change it toStatic
, pick a name u like, and finallyReserve
.
# SSH登录 | SSH login
- 如果想在电脑上通过SSH登录刚才创建的VPS,直接在
VM实例
中点击SSH链接
即可。 - Just click
SSH link
in theVM instance
page, if u want to ssh your vps on PC.
- 如果通过手机登录,则需要提前进行密钥设置。这里以ssh神器 Termius 为例。
- If u are using mobile phone to ssh your VPS, u should config the keys in advance. Let’s take Termius for example.
- 在app store直接下载
Termius
安装,然后选择Hosts
,点击右上角+
,选择New Host
。 - Download
Termius
directly from the app store, then selectHosts
, click on the top right corner of+
and selectNew Host
.
Alias
随便填,Hostname
填写刚才生成的静态IP地址,之后打开Use SSH
。- Pick a neme in
Alias
, fill the static IP address just generated inHostname
, then openUse SSH
trigger.
- 进入
Key
页面,然后选择Generate Key
生成一对新的密钥,最后点击Save
保存。 - Go to the
Key
page and selectGenerate Key
to generate a new pair of keys, then pressSave
.
- 接下来需要将生成的新的密钥中的公钥复制下来,上传到谷歌云上。进入
Keychain
页面,点击key图标,选择上面第二个编辑按钮。 - Next, you need to copy the public key and upload it to Google Cloud. Go to the
Keychain
page, click the key icon and select the second button above.
- 往下翻,然后把
Public
里的内容全复制下来。 - Scroll down and copy the contents in
Public
.
- 回到谷歌云,
VM实例
页面中点击VPS的名字进入详情页,随后点上面的修改
。 - Go back to Google Cloud, click on the VPS name in the
VM Instances
page to go to the details page, then click onModify
above.
- 往下翻,找到
SSH密钥
,点击添加一项
,然后把刚才复制的公钥粘贴进去。 - 接下来这一步很重要:需要把
Generated by Terminus
这句删掉,替换成你谷歌账号的名字也就是[email protected]
里的XXX
,最后点更新
。 - Scroll down, find the
SSH key
, click on ‘Add one’, and paste the public key you just copied. - This next step is very important: you need to delete the
Generated by Terminus
sentence, replace it with the name of your Google account, which isXXX
in[email protected]
, and finallyUpdate
.
- 最后回到手机上,在
Hosts
中直接点击刚才添加的VPS,就可以实现SSH登录啦。 - Finally, go back to your phone and click the VPS you just added in
Hosts
to initiate SSH login.
END
• 本文作者 | Author info >> MAXH
• 来源链接 | Source link >> 谷歌云VPS入门指南 | Getting started with Google Cloud VPS
• 发表评论 | Make comments >>
MARSGRID