How To Install ShadowSocks On Google Cloud Linux

This article will tell you how to install the ShadowSocks server in the google cloud Linux server (Ubuntu) and how to connect it from your local machine. But before you can exercise, you should have a google account and have applied google cloud service, please see this article’s reference section to learn how to do it.

1. Create A Firewall Rule In Google Cloud.

  1. Login to google cloud console. Click VPC network —> Firewall rules menu item in left Navigation Menu.
  2. Then click CREATE FIREWALL RULE button at the top bar to open the Create a firewall rule web page. Input firewall rule name, and set all other fields as below picture.
  3. Select IP ranges in the Source filter drop-down list. The Source IP ranges value should be 0.0.0.0/0 to allow any IP address to connect.
  4. If you want to expose all protocols and ports number to the client in this firewall rule, you can choose the Allow all radio button in the Protocols and ports section.
    google-cloud-create-a-firewall-rule
  5. But sometimes such as in this case, we should restrict the protocols and ports to clients to use this firewall rule so we can choose Specified protocols and ports radio button in the Protocols and ports section. And then input text with protocol_1:port_number_1; protocol_2:port_number_2 format.
  6. In this example, ShadowSocks will use the 9090 port number and use both TCP and UDP protocols. So the Specified protocols and ports value should be tcp:9090;udp:9090.
  7. The Target tags are the google cloud virtual machine tags, if you specify the value shadowsocks to it here means that the virtual machine which has the shadowsocks tag will use this firewall rule. Do not forget to click the Save button to save the changes.
    google-cloud-edit-firewall-rule
  8. Now you can see the newly added firewall rule on the VPC network —> Firewall rules list page. We will use this firewall rule in virtual machine configuration later.

2. Create Google Cloud Virtual Machine Instance.

  1. Log in to the Google Cloud Platform console, then click the Compute Engine —> VM instances menu item in the Navigation menu.
  2. Then click CREATE INSTANCE menu item at the top to create a google cloud virtual machine. Select micro in Machine type(micro is enough and not expensive). Select Ubuntu 18.0 in the Boot disk. Click the Create button to save the changes.
  3. Now you can return to the virtual machines list page, you can find the virtual machine instance you just created there. Click the instance link to go to it’s detail info page and click the Edit button at the top bar. Then input shadowsocks in the Network tags input box, so that this virtual machine instance is tagged as shadowsocks, and it will use the firewall rule created in step one which Target tags value is shadowsocks also.

3. Setup ShadowSocks Service In Google Cloud Virtual Machine Instance.

  1. Now the firewall rule and the virtual machine instance have been added correctly. We will install the ShadowSocks server on that virtual machine now.
  2. Go to the virtual machine instance list page, click the down arrow behind the SSH Connect type, then click Open in browser window menu item.
  3. Then it will open an ssh client ( in a web browser ) that you can use to interact with the Linux server.
  4. In that server, you can set up the ShadowSocks server and configure the ShadowSocks server port number to 9090 which is allowed by the firewall rule.
  5. For more detail about how to set up the ShadowSocks server and the client tool to connect to it, please refer article How To Setup ShadowSocks VPN On Mac, Windows And Linux

4. Example Demo Video.

  1. You can see this example demo video on URL https://youtu.be/6jFjUJgEa9k.

Reference

  1. ShadowSocks Wiki
  2. Create, Modify, or Close Your Billing Account
  3. Google Cloud Identity and Access Management Documentation

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.