How To Install ShadowSocks On Google Cloud Linux

This article will tell you how to install ShadowSocks server in 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 has 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.
    google cloud-vpc network-firewall rules menu
  2. Then click CREATE FIREWALL RULE button at top bar to open below web page. Input firewall rule name, and set all other field as below picture. Select IP ranges in Source filter drop down list. The Source IP ranges value should be 0.0.0.0/0 to allow any ip address to connect.  If you want to expose all protocols and ports number to the client in this firewall rule, you can choose Allow all radio button in Protocols and ports section.
    google cloud create a firewall rule
  3. But some time 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. In this example, ShadowSocks will use 9090 port number and use both TCP and UDP protocol. So the Specified protocols and ports value should be tcp:9090;udp:9090. The Target tags is the google cloud virtual machine tags, if specified here means that virtual machine which has shadowsocks tag will use this firewall rule. Do not forget click Save button to save the changes.
    google cloud edit firewall rule
  4. Now you can see the newly added firewall rule in the Firewall rules list page. We will use this firewall rule in virtual machine configuration later.
    google cloud firewall rules list
READ :   Linux User Group And File Permission Introduction

2. Create Google Cloud Virtual Machine Instance.

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

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

Now the firewall rule and the vm instance has been added correctly. We will install ShadowSocks server in that vm now.

  1. Go to the vm instance list page, click the down arrow behind the SSH Connect type, then click Open in browser window menu item. The ip address in below page is hidden for security issue.
    google cloud connect instance use ssh in browser menu 1
  2. Then it will open a ssh client ( in a web browser ) that you can use to interact with the Linux server. In that server you can setup ShadowSocks server and configure the ShadowSocks port number to 9090 which is allowed by the firewall rule. For more detail about how to setup ShadowSocks server and client tool to connect to it, please refer article How To Setup ShadowSocks VPN On Mac, Windows And Linux
    google cloud vm instance browser ssh client 1
READ :   How To Setup ShadowSocks VPN On Mac, Windows And Linux

Reference

  1. ShadowSocks Wiki
  2. Create, Modify, or Close Your Billing Account
  3. Google Cloud Identity and Access Management Documentation
(Visited 28 times, 1 visits today)

Leave a Reply

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.