update 6/25/2019
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
To install Shadowsocks and BBR on VPS, I have googled a lot of tutorials. But some of them are outdated. Here is a feasible summary recorded the installation process.
Shadowsocks
Shadowsocks is a lightweight secured socks5 proxy. Shadowsocks-Libev is a lightweight and full-featured port for embedded devices and low-end boxes. It's a pure C implementation and has a very small footprint (several megabytes) for thousands of connections. So it is a great option compared to other versions for a low-end Server.
Process
VPS
First of all, you need to buy a foreign server. You can buy a VPS on Vultr or DigitalOcean et al. Then you will get a foreign IP. Open the Command Prompt and ping Your IP. For example, "ping 104.248.187.233". If it shows the following,
Pinging 104.248.187.233 with 32 bytes of data:
Reply from 104.248.187.233: bytes=32 time=211ms TTL=44
Reply from 104.248.187.233: bytes=32 time=213ms TTL=44
Reply from 104.248.187.233: bytes=32 time=213ms TTL=44
Reply from 104.248.187.233: bytes=32 time=226ms TTL=44
that means your IP is workable. If it shows "time out" you can destroy it and create a new VPS.
Connect Your VPS With SSH
After you buy a VPS, you will get a Username and a Password(sometimes they will be contained in an email sent to you) so that you can connect your VPS with SSH and use the command line to control it. There is much free SSH software like Xshell can easily connect your VPS. And the default port is 22.
Install Shadowsocks
After a successful SSH connection, enter the following three lines of code.
wget --no-check-certificate -O shadowsocks-libev.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-libev.sh
chmod +x shadowsocks-libev.sh
./shadowsocks-libev.sh 2>&1 | tee shadowsocks-libev.log
Then it will request you chose your Password, Port and Encryption Method. Wait a few minutes for it to configure. If it shows the following,
Congratulations, Shadowsocks-libev server install completed!
Your Server IP : 104.248.187.233
Your Server Port : 56789
Your Password : www.liuxuan.xyz
Your Encryption Method: aes-256-gcm
that means you successful install Shadowsocks. Record this text and open the client(the download link is below) enter the corresponding text.
Finally, open your browser and visit Google Scholar(https://scholar.google.com/). And enjoy it!
/etc/init.d/shadowsocks start
/etc/init.d/shadowsocks stop
/etc/init.d/shadowsocks restart
/etc/init.d/shadowsocks status
./shadowsocks-libev.sh uninstall
Install BBR(not necessary)
If you think the speed of your connection(you can open "Global Mode " in your client and test the speed in here) is too slow, you can install BBR to improve the speed.
BBR ("Bottleneck Bandwidth and Round-trip propagation time") is a new congestion control algorithm developed at Google. Congestion control algorithms — running inside every computer, phone or tablet connected to a network — that decide how fast to send data. BBR then uses a new model to control both how fast it sends data and the maximum amount of data it's willing to allow in the network at any time. (More detail click here)
Update the Kernel Version
BBR requires that the kernel version of Linux be newer than 4.9. For CentOS 6, we can use
uname -r
to view the kernel version of our VPS. Here shows my kernel version is "2.6.32-696.30.1.el6.x86_64". Now, let's update the kernel version.
#input ELRepo Public Key
wget https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm --import RPM-GPG-KEY-elrepo.org
#install ELRepo
rpm -Uvh http://www.elrepo.org/elrepo-release-6-8.el6.elrepo.noarch.rpm
#update the latest kernel
yum --enablerepo=elrepo-kernel install kernel-ml -y
After the upgrade, we need alter file "/etc/grub.conf". Enter the following command.
#open this file
vi /etc/grub.conf
Press the "I" key on the keyboard to go into "INSERT" mode. Alter "default=1" to "default=0". Press the "Esc" key on the keyboard. Input
#save and exit
:wq
and press "Enter" to return to the main interface. And input
reboot
to restart the VPS. Wait about 1 min, reconnect the VPS with SSH. Enter
uname -r
to see the kernel version. If it shows "4.18.9-1.el6.elrepo.x86_64", that means you successful update the kernel version.
Install BBR
Enter the following command.
#Modify the configuration
cat >>/etc/sysctl.conf << EOF
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
EOF
#Make the configuration take effect
sysctl -p
Enter the following command to check if you see that the returned result contains "BBR"
sysctl net.ipv4.tcp_available_congestion_control
#returned result, net.ipv4.tcp_available_congestion_control = bbr cubic reno
lsmod | grep bbr
#returned result, tcp_bbr 20480 0
If the returned result is right, congratulations on your successful installation of the BBR!
Client
Shadowsocks client for Android
https://github.com/shadowsocks/shadowsocks-android/releases
Shadowsocks client for Windows
https://github.com/shadowsocks/shadowsocks-windows/releases
References
https://teddysun.com/357.html
https://www.xiaoz.me/archives/9919
http://shadowsocks.org/en/index.html
About spend 3 hours writing this article. The most embarrassing thing was that my wireless mouse was out of power in the library #_#. The SS account in the article can be used normally within a week. Any questions can be left below.
The article was last updated on September 23, 2018.