SSH management of Google's free cloud server

Google's free cloud server

First register a gmail account as your Google account, then go to cloud.google.com to apply for a free cloud server. The so-called free means that Google will give you 300 US dollars in your account to pay for the server rent, the trial period is one year. A Visa credit card is required to apply. Specific methods Many introduction articles on the Internet, go to Google for specific articles.

This cloud server can be Windows or Linux, but Windows can only be opened with a paid account. Let's open a Linux server. I opened an Ubuntu server. And when opening, a common IP address that can be accessed externally is required. With a public IP address, I can access it directly from my computer. I tested it, although it is a Google home cloud service, the IP address can still be accessed without having to overturn the wall.

After the server is installed, you can go in and manage it. In the console page of Google Cloud, you can see the virtual machine server instance. You can click SSH above to pop up a browser window. In the browser window, you can directly manage the Linux server by entering commands.

How to SSH directly to manage this server on Windows 10 computer

Checked Google's official documentation and said it was a bit messy. I guessed it, and then did not follow the official documentation, and did it according to my own understanding, and it succeeded. The specific practices are as follows:

1. From its management console:

https://console.cloud.google.com/compute/instances?project=txxxxxxxxxxxxxxx

Inside the page, on the left menu, Computer Engineer, you can see the virtual machine instance on the right. As shown below:

2. After selecting Computer Engine, enter the Computer Engine page, you can see your virtual machine instance, as shown below:

 

3. On the right side of the picture above, the name of my virtual machine is linux-1. This is the name I chose when applying for the virtual machine server. Click [Connect] in the figure above, choose to open in a browser window, and a browser window pops up. In the SSH terminal window of this browser, you can use the command line to operate the Linux of the virtual machine.

4. I want to connect directly to SSH on the local Win10 computer instead of using a browser. First, I must create a key pair (a pair of public key and private key) for SSH on the local Win10 computer.

4.1.   First, create an SSH key pair on the local Win10 computer. How to create: Start PowerShell of WIN10, enter the command ssh-keygen and press Enter, then follow the prompts. Note here that you are prompted to enter the file name to save the SSH KEY, you need to enter the full path file name. Then it will create 2 files. When I typed, I didn't ask for my username. Later, when I used it, I found that the user name is my own login name in the WIN10 system. The file name I entered here is D: \ google. As a result, two files were created for me in the root directory of the D drive. The suffixed file is the public key. Another natural is the private key.

4.2.  Upload the public key to the Linux virtual machine: On the google management console page, which is the above picture, click the name of the virtual machine. The name of the virtual machine here is linux-1. There is a [modify] on the top, click it to make the page data can be modified. As shown below:

 

4.3. After entering the modification state, scroll the page to the bottom, and there is SSH management near the bottom as shown in the figure:

 

4.4. Click [Display and Modify] in the figure above, pull down to open the interface, the [Add One] button appears, click it, and a box will appear, with the prompt text: Enter the SSH public key. As shown:

 

 

4.5. Then, in the folder of the local WIN10 computer, use a text editor (I use nopad ++) to open the public key file that I created earlier. The file name here is the file google.pub. After opening, the text inside is the public key. Copy these strings and paste them into the box above. Pull to the bottom of the page and click the save button at the bottom.

5. Here I restarted the Linux virtual machine.

6. SSH connection to the remote Linux virtual machine server: I am in the PowerShell of the local Win10, and enter the SSH command:
ssh -i D: \ googleCloud \ google [email protected]
Connected to the remote virtual machine Linux successfully.


In the above command, D: \ googleCloud \ google is the full path file name of my private key file. pcplayer is the computer login name when I created the public and private keys.

Summary:
1. Create SSH public and private keys on the local computer, and upload the public key to Google's cloud server;
2. Connect to the server directly with the ssh command in PowerShell on the local computer.
 

Next, I will try to use Delphi's WebBroker to write a Web Server program and put it up to see if I can access the open page.

Published 120 original articles · 21 praises · 140,000 views

Guess you like

Origin blog.csdn.net/pcplayer/article/details/105301263