---
title: Setup your own VPN server
description: 'Why do we need a VPN server? A VPN (Virtual Private Network) server
  is a network server that allows users to create a secure and encrypted connection
  to another network over the internet. Here are some reasons why we need a VPN server:
  Security: VPNs provide a secure way to access the internet, protecting sensitive  […]'
url: https://canonical.com/blog/setup-your-own-vpn-server
---

1. [Blog](https://canonical.com/blog)
2. Article

---

[Hugo Huang](https://canonical.com/blog/author/hugohuangtao "More about Hugo Huang")

1 March 2023

# Setup your own VPN server

[Google Cloud](https://canonical.com/blog/tag/google-cloud)
[Security](https://canonical.com/blog/tag/security)
[Ubuntu Pro](https://canonical.com/blog/tag/ubuntu-pro)
[VPN](https://canonical.com/blog/tag/vpn)

---

Share the article

Why do we need a VPN server? A VPN (Virtual Private Network) server is a network server that allows users to create a secure and encrypted connection to another network over the internet. Here are some reasons why we need a VPN server:

* Security: VPNs provide a secure way to access the internet, protecting sensitive data from being intercepted by hackers, snoopers, and other malicious actors. A VPN server encrypts all data transmitted between a user’s device and the internet, making it virtually impossible for anyone to intercept or access the data.
* Privacy: VPNs allow users to protect their privacy by hiding their online activity from their Internet Service Provider (ISP) and other third parties. A VPN server can mask a user’s IP address, making it difficult for anyone to track their online activity and location.
* Access to restricted content: Many websites and online services are geo-restricted, meaning they can only be accessed from certain locations. A VPN server allows users to bypass these restrictions and access content from anywhere in the world.
* Remote access: VPNs can be used to provide secure remote access to corporate networks and resources, allowing employees to work from anywhere while maintaining a secure connection to company data.

# Create a Ubuntu Virtual Machine on Google Cloud

First, we need a Virtual Machine to host the VPN server. For this demo, we will create a Virtual Machine instance on [Google Cloud](https://console.cloud.google.com/) (follow [this video to create a VM on Google Cloud step by step](https://www.youtube.com/watch?v=0JxqWE5pmKs)) and pick a region close to the location of your client machines. Here I chose us-west2:

Choose your OS for your server. For security and stability, I chose Ubuntu 20.04 Pro:

# Setup Shadowsocks VPN server

In a few seconds, your Ubuntu VM will be running. Now, SSH into the server through the “SSH” button on the right:

A SSH-in-browser will pop out like this:

Now, login as root:

```
sudo su
```

Update your OS:

```
apt-get update
```

Install pip:

```
apt-get install python3-pip
```

Install Shadowsocks

```
pip install shadowsocks
```

Create a configuration file for your Shadowsocks to configure the Shadowsocks server

```
vi /etc/shadowsocks.json
```

Add the following content to your config JSON file:

```
{
    "server":"0.0.0.0",
    "server_port":8000,
    "local_port":1080,
    "password":"Your_Password",
    "timeout":600,
    "method":"chacha20"
}
```

Start the server

```
ssserver -c /etc/shadowsocks.json -d start
```

If you want to stop the server

```
ssserver -c /etc/shadowsocks.json -d stop
```

If you want to re-start the server

```
ssserver -c /etc/shadowsocks.json -d restart
```

Now you successfully created a running Shadowsocks server on Google Cloud, you can connect to it through a Shadowscocks Client.

# Connecting to your Shadowsocks server

Download the Shadowsocks Client to your local machine.

From <https://github.com/nojsja/shadowsocks-electron/releases/tag/v1.2.3>, choose the version suitable for your personal computer. I downloaded the Mac version and then installed it.

After I successfully installed the client, I add the server in the Client UI:

The Server Address is the IP address of my server in Google Cloud. You can find the IP address in your GCP console. For more information about the Shadowsocks client, check out this github repo: <https://github.com/nojsja/shadowsocks-electron>.

Click “SAVE” and you are all set. Enjoy your own VPN!

[Get in touch

Interested in running Ubuntu in your organization?](https://ubuntu.com/about/contact-us/form)

## Sign up for our newsletter

Get the latest Canonical news and updates in your inbox.

Work email:

\*I agree to receive information about Canonical's
products and services.

In submitting this form, I confirm that I have read and agree to
[Canonical's Privacy Notice](https://canonical.com/legal/data-privacy/contact)
and [Privacy Policy](https://canonical.com/legal/data-privacy).

Sign up

## Share on

---

## Related posts

[### Securing open source software dependencies in the public cloud](https://canonical.com/blog/securing-open-source-software-dependencies-in-the-public-cloud)

Building stable and secure software requires understanding build systems and having a plan for vulnerabilities in your software dependencies.

[Aaron Whitehouse](https://canonical.com/blog/author/aaron-whitehouse)

5 October 2026

[### Accelerating delivery of CVE fixes with a new Kernel release strategy](https://canonical.com/blog/accelerating-delivery-of-cve-fixes-with-a-new-kernel-release-strategy)

When it comes to fixing security vulnerabilities, speed is crucial. Canonical is officially outlining a transition from its current 4-week regular and 2-week security kernel...

[Canonical](https://canonical.com/blog/author/canonical)

23 September 2026

[### Beyond the 10-year mark: Extending Ubuntu Pro 16.04 LTS security coverage](https://canonical.com/blog/extending-ubuntu-pro-16-04-coverage)

A decade ago, Canonical launched Ubuntu 16.04 LTS (codenamed “Xenial Xerus”). As a Long-Term Support (LTS) release, it comes with 5 years of standard security coverage, which...

[Carlos Bravo](https://canonical.com/blog/author/carlos-bravo)

17 September 2026

[### Canonical joins the Open Secure AI Alliance](https://canonical.com/blog/open-secure-ai-alliance)

Canonical is now part of the Open Secure AI Alliance, announced by NVIDIA with partners across cloud computing, cybersecurity, enterprise software, open source foundations, and...

[Canonical](https://canonical.com/blog/author/canonical)

28 August 2026
