Knowledge Base Ever

Install Shadowsocks service using TeddySun script on CentOS7 and optimize TcpBBR

2020-01-13 14:39:19

label: Shadowsocks,ShadowsocksR,Shadowsocks-Python,Shadowsocks-Libev,CentOS,CentOS7,Tcp BBR,

In some scenarios, you need to use the Shadowsocks service. To install Shadowsocks on CentOS 7, you can refer to the official documentation, or you can use a very convenient script from TeddySun.

Preparation, installation of necessary software

sudo -i
yum install wget vim -y

Three-line command to install the Shadowsocks service using a script

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
The script will ask you which server to use, including Python, R, Go, and libev.
Python: mature
R: Added confusion
Go: there may be better concurrency
libev: based on asynchronous libraries, theoretically the best concurrency

If there are no particularly demanding requirements, you can use the default Shadowsocks-Python, and then the script will prompt for the password and port, as well as the encryption method. You can use: xchacha20-ietf-poly1305, chacha20-ietf-poly1305, aes-256-gcm, etc.
Which Shadowsocks server you'd select:
Please enter a number (default 1):
After the installation is complete, the script will give feedback on the installation configuration information. This configuration is in /etc/shadowsocks-python/config.json. If necessary, you can also use VIM to modify it after installation.
Congratulations, Shadowsocks-Python server install completed!
Your Server IP        :  x.x.x.x
Your Server Port      :  12345
Your Password         :  PASSWORD
Your Encryption Method:  aes-256-gcm

Advanced configuration section

BBR Is short for Bottleneck Bandwidth and Round-trip Time, here TeddySun also provides a script to install.
wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh

chmod +x bbr.sh

After the execution is complete, you can use the sysctl command to view and confirm the configured values ​​as follows
[root@instance-1 ~]# sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = reno cubic bbr
[root@instance-1 ~]# sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = bbr
[root@instance-1 ~]# sysctl net.core.default_qdisc
net.core.default_qdisc = fq
[root@instance-1 ~]# lsmod | grep bbr
tcp_bbr                20480  12
If the return value is different from the above, execute the following code:
echo "net.core.default_qdisc = fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control = bbr" >> /etc/sysctl.conf
Finally, start the service. You can also write a script.
/etc/init.d/shadowsocks-python restart
Non-CentOS uses Linux common methods to create control scripts
sudo vim /etc/init.d/shadowsocks
# Provides: shadowsocks
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start shadowsocks
# Description: start shadowsocks
   ssserver -c /etc/ss-conf.json -d start
   ssserver -c /etc/ss-conf.json -d stop
case “$1” in
   echo “Usage: $0 {start|reload|stop}”
   exit 1
sudo chmod +x /etc/init.d/shadowsocks
Add to boot
sudo vim /etc/init/shadowsocks.conf
start on (runlevel [2345])stop on (runlevel [016])pre-start script
/etc/init.d/shadowsocks start
end script
post-stop script
/etc/init.d/shadowsocks stop
end script
sudo update-rc.d shadowsocks defaults


CentOS7 CentOS PHP Linux Python3 Python MySQL YUM JavaScript MariaDB Redis MySQL8 caching_sha2_password HTML mysql_native_password PHP7 CSS data INDENTIFIED BY password policy requirements SOCKS Web Development Fedora Media Writer msodbcsql Redis5 SVN absolute Deepin jemalloc SQLAlchemy convert FuelPHP mysqlclient Shadowsocks toggle at-symbol Error Control Operator margin PHPUnit Framework ss5.passwd daemon process IIS password SOCKET vps center Fatal Errors MongoDB4 sudoers .htaccess DATE_SUB Phalcon SQL Server 2017 WiFi Compiling PHP frequency conflict set_error_handler TestCase apr Elasticsearch7.3 PHPUnit ss5.conf daemon HTTP particles.js Slim Vincent Garreau Failed to build these modules: _uuid MongoDB Sudo DATE_ADD ip command pg_bha.conf SQL Server width Compiling Apache Frameworks MySQL-python scrollbar Tcp BBR Apache2.4 Elasticsearch libpython3.7m.so.1.0 PHPStorm ss5-3.8.9 CURLOPT_POSTFIELDS NodeJs show VIM Bluetooth Failed to build these modules: _ctypes Minimal ISO substr date sub INTERVAL PECL SQL Date Funcitons Wi-Fi CodeIgniter font-size root Tag Cloud apache httpd dual network interfaces Laravel ss5 CURLFille horiz-align node.js ShadowsocksR vertical-align BarManager exec mb_substr PyCharm SUBDATE date add IntelliJIDEA PEAR SOCKS5 Proxy Server WebStorm Chrome find remi Tag Apache du jQuery PHP5.5 src cURL hide nginx Shadowsocks-Python V2Ray availability eth0 MariaDB10.4 PostgreSQL sub folder date Install MongoDB pdo_sqlsrv SOCKS5 Web Server File Upload mssql-tools register_shutdown_function Symfony ADDDATE DevExpress JetBrain php-fpm sqlsrv Zend Framework height network interface Shadowsocks-Libev unixODBC-devel Aura error_get_last Port 80 string