因为要下载代码但是VPN不稳定(我下的是Chromium,gclient每次断了就重来),所以曲线救国使用AWS虚拟机下载,再从虚拟机上用FTP传回本地。
总结一下希望能帮到其他朋友和以后的自己:
注册AWS之类的就不说了,现在是一年免费,只收1刀就行了。
启动虚拟机后注意保存你的pem文件,这个东西File Zilla客户端登录的时候也同样需要。
过程中基本按照两篇文章的指导在做:
Server端:
http://www.codeproject.com/Tips/404132/Amazon-AWS-Setting-up-FTP-on-EC-Windows-Instances
First, create a windows instance in Amazon AWS ManagementConsole. Once the instance is accessible, we will need to change some settings:
- In AWS, select “SecurityGroups” from the left-hand menu.
- Select the name ofthe security group for the instance you just created
- In the window at thebottom of the screen select the “Inbound” tab from the small frame.
- Pick “Custom TCP Rule”from the “Create a new rule” dropdown.
- Enter 50000-51000 inthe port range field.
- In the source field,use discretion. Leaving the field at 0.0.0.0/0 will allow all. That may be okdepending on your intended use, I’m using it as a disposable server, so I’m notgoing to get into security in this article.
- Select “Add Rule” andthe “Apply Rule Changes” (Make sure you do both!!!).
- Now repeat the steps4-7 for port 21.
We are now done setting up the security groups in AWS, let’ssetup FileZilla Server. (You can setup any type of FTP server you want, Iprefer FileZilla because it is free, rock-solid, and highly configurable. Ifyou want to use something else, just apply the same settings.
- Install FileZilla Serveron the Amazon Instance (after remoting in) and log into the server interface. (Youwill have to enable downloads in IE to download FileZilla from their website. )
- Click the settingsicon on the interface.
- On the generalsettings tab, “Listen on these ports:” will be defaulted to 21. Just leave it.
- Select the “Passivemode settings” from the tree on the left.
- Place a check marknext to “Use custom port range” and set the port range to “50000-51000”.
- Now get your “PublicDNS Name” from the Amazon AWS console. Your IP address will be in the PublicDNS Name, or you can ping the DNS name to have it resolved for you. (you may beable to use the Public DNS Name, I don’t see why it wouldn’t work, but I personallyuse the IP instead.
- Enter the IP into the“Use the Following IP” field on FileZilla’s “Passive mode settings” screen.
- Now follow theinstructions that come with FileZilla to setup a group and a user.
Now we are at the final step. You will now need to adjustthe Windows Firewall settings to allow the ports we allowed in the AWS SecurityGroup.
- On the instance open “WindowsFirewall with Advanced Security”.
- Now click on “InboundRules” on the left-hand pane.
- Click on “New Rule”in the right-hand pane.
- You should really usethe “Program” option***, but I’m going to use the port option and then clicknext.
***As I said before, I’m not going tocover the topic of security, I’m sure someone will tell you to never do it thisway, but this is the way I need it for the testing I’m doing.
- Select TCP and the “Specificlocal ports” option and enter 50000-51000 and press next.
- Select “Allow theconnection” and press next.
- Leave all threeoptions checked and press next.
- Type a name for yourrule and hit finish. Then repeat these steps for port 21.
Andyou are done! Go ahead and connect with your favorite FTP client.
安装File Zilla,然后开端口,要开两部分:
1 AWS console里安全管理组的inBound端口;
2 你的虚拟机里的防火墙,我选的系统是winserver2008,在服务管理器里还挺好设的;
3 设置被动模式,地址就是你虚拟机的公网地址,你登录EC2虚拟机时候有个远程桌面,就是那个地址;
Client端:
http://www.codestore.net/store.nsf/unid/BLOG-20111012-0812
As soon as you've setup a Linux instance on Amazon EC2 you're likely next step is to get FTP access so you can move files about.
If, like me, your FTP tool of choice is FileZilla then this tip might save you some of the time it took me to work it out.
First of all make sure port 22 is open in your instance's Security Group in Amazon's AWS site. You can test this from a Terminal using the following command:
ssh Address-Of-EC2-Instance
If that times out then most likely port 22 isn't open. Otherwise you're ok. SFTP uses the same port so we can carry on and set it up.
If at this point you try to connect using SFTP from FileZilla you'll probably see this:
The error is "No supported authentication methods available". To get round it you need to tell FileZilla about the .PEM file that was created when you built the Amazon instance. Assuming you already downloaded it to you PC, open FileZilla and select the Edit->Settings menu.
Click the "Add key file..." button and locate your PEM file. At this point FileZilla will ask if you want to convert it to a format it can use. Say yes and tell it where to put the new .PPK file. Once this is done press ok and try to connect again. You should have more luck!
按照这个教程设置的是不安全的FTP连接,所以用完就关了吧,把File Zilla服务也关了就行了。