Learn how to install ShadowsocksR (not Shadowsocks) server on Amazon EC2 Ubuntu instance (Free Tier) easily. I set SSR in the title because it’s superior to Shadowsocks. The script included in this tutorial comes with the option to choose between Shadowsocks or ShadowsocksR during installation. It’s your call.
Heads up: unlike the DigitalOcean guide I posted before, this one involves fewer commands and scripts. 😉
Update: I recommend SocketPro, a dirt cheap option ($2.41/mo annual) if you prefer to rely on a service provider. Their services are top-notch and I’ve been using it for almost two years alongside my DIY servers. Click here to read my review.
Update 2: Thanks Janosch for pointing out the error in the installation script. I’ve updated it now.
ShadowsocksR is a fork of the original Shadowsocks project, claimed to be superior regarding security and stability.
Warning: Although this guide is intended to be 100% n00b friendly, there are chances you may face minor issues or errors during setup. Be prepared. Just comment here or write to webmaster[at]mighil.com or connect with me on WeChat @mighil if you want me set it up for you for a small fee.
- Access to AWS console. (Requires one time credit/debit card verification)
- Read more about EC2 Free Tier.
- SSH client.
Sign in to the AWS Console & Create an EC2 Instance
AWS may take you to the US region by default. It’s up to you choose the location.
Select EC2 in the Compute Section
Select Asian region (Tokyo or Singapore recommended) if you’re from China.
Click Launch Instance
Go on and read their Getting Started Guide if you’ve got enough time.
Select The Ubuntu Server 16.04 LTS
Ubuntu Server 16.04 LTS is Free Tier Eligible, and that’s what we’re going to use for this guide as well. Click Select and proceed to the next step.
Choose the Instance Type
Look for the t2.micro which is Free Tier eligible. Select it and Click Review and Launch.
Configure Security Group
Open the TCP ports you’re going to use for ShadowsocksR. I’ve set Port Range from 8000–8083 for this guide. You can limit the source according to your preference. Click Review and Launch when you’re ready.
Create a New Key Pair
Create, download and save keypairname.pem file in a safe place.
Congrats on the 60% progress…n00bs, before jumping to the next big step, learn how to use PEM key on Mac.
!! Windows users, you have to convert PEM file to PPK. Please read it here and come back to this article.
Copy The AWS Generated PEM File to a Safe Location
Here’s how to copy keypairname.pem to /Users/usrname/.ssh/ (hidden directory)
- Copy the keypairname.pem file.
- Open Finder, use the shortcut “Shift + Command + G” and type in /Users/usrname/.ssh/
- Paste the keypairname.pem file.
chmod 400 the PEM file
We have to set the right permissions for PEM file. Use the chmod command to make sure that your private key file isn’t publicly viewable. For example, if the name of your private key file is keypairname.pem, use the following command:
$ chmod 400 /Users/username/.ssh/keypairname.pem
Alright, it’s about time fellas! Let’s dive into the Terminal/Putty.
Uncheck this Sucker in Terminal Preferences (Recommended)
There are chances some users may get locale errors, it’s a best practice to uncheck this from Terminal Preferences.
Connecting to The EC2 Instance
Let’s connect to your instance from Putty or Terminal:
$ ssh -i /Users/username/.ssh/keypairname.pem [email protected]
!! Check your public IP from the corresponding AWS EC2 webpage.
Load your PPK and connect to the server as ubuntu user
Switch User in EC2 instance
Once you’re inside the EC2 instance. Switch to the root user:
$ sudo su
Run The ShadowsocksR Auto-Installer
Script by @teddysun. Copy and paste each line separately.
$ wget --no-check-certificate -O shadowsocks-all.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh $ chmod +x shadowsocks-all.sh $ ./shadowsocks-all.sh 2>&1 | tee shadowsocks-all.log
This installer is intuitive and will guide you setup ShadowsocksR on your instance.
Note: It contains installers for other Shadowsocks packages as well.
!! the installer will generate and display the final config. It displays Private IP (not public IP). So make sure you use Public IP within client apps. As I mentioned EARLIER, you can find your public IP within the corresponding AWS EC2 instance page or run the command below to display the public IP
$ wget -qO- -t1 -T2 ipinfo.io/ip
Commands to start | stop | restart | check status
$ /etc/init.d/shadowsocks-python start | stop | restart | status
$ /etc/init.d/shadowsocks-r start | stop | restart | status
$ /etc/init.d/shadowsocks-go start | stop | restart | status
$ /etc/init.d/shadowsocks-libev start | stop | restart | status
That’s it, congrats on the 100% progress.
Write to mighilcn at gmail dot com or connect with me on WeChat @mighil if you want me set it up for a small fee.
Join The Mailing List
Get tips on WordPress optimization, website hosting and VPN/proxy optimization guides for expats in China. Subscribe via email. MailChimp automates Mighil.com mailing list. We won’t spam your inbox. You can unsubscribe at any time.