Last active
October 25, 2023 02:08
-
-
Save tuxlinuxien/31819c99067af06cfe074006cf49b3a2 to your computer and use it in GitHub Desktop.
Shadowsocks installer for ubuntu 16.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cd $HOME; | |
echo "Running apt-get update ..." | |
sudo apt-get update > /dev/null | |
echo "Install installing dependencies ..." | |
sudo apt-get install -y --no-install-recommends gettext build-essential autoconf libtool libpcre3-dev asciidoc xmlto libev-dev libc-ares-dev automake libmbedtls-dev libsodium-dev > /dev/null | |
if [ -d "shadowsocks-libev" ]; then | |
echo -n; | |
else | |
git clone https://github.com/shadowsocks/shadowsocks-libev.git $HOME/shadowsocks-libev; | |
fi | |
cd $HOME/shadowsocks-libev | |
git submodule update --init --recursive | |
if [ -f "configure" ]; then | |
echo -n; | |
else | |
./autogen.sh; | |
fi | |
if [ -f "Makefile" ]; then | |
echo -n; | |
else | |
./configure; | |
fi | |
make >> /dev/null | |
sudo make install >> /dev/null | |
cat << EOF | |
################################# | |
# # | |
# Configure shadowsocks service # | |
# # | |
################################# | |
EOF | |
read -p "Port to listen: " PORT | |
read -p "Password: " PASSWORD | |
cat << EOF > /etc/systemd/system/ss-server.service | |
[Unit] | |
Description=Shadowsocks server | |
After=network.target | |
[Service] | |
LimitNOFILE=49152 | |
ExecStart=/usr/local/bin/ss-server -u -p $PORT -k $PASSWORD -m aes-256-cfb | |
Restart=always | |
RestartSec=5 | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
echo "Adding service to systemd: /etc/systemd/system/ss-server.service" | |
systemctl daemon-reload | |
systemctl enable ss-server.service | |
systemctl start ss-server.service | |
echo "Please check https://gist.github.com/tuxlinuxien/31819c99067af06cfe074006cf49b3a2 for better performance settings." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/security/limits.conf | |
* soft nofile 102400 | |
* hard nofile 102400 | |
* soft nproc 10240 | |
* hard nproc 10240 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/sysctl.conf | |
fs.file-max = 102400 | |
net.core.rmem_max = 67108864 | |
net.core.wmem_max = 67108864 | |
net.core.netdev_max_backlog = 250000 | |
net.core.somaxconn = 4096 | |
net.ipv4.tcp_syncookies = 1 | |
net.ipv4.tcp_tw_reuse = 1 | |
net.ipv4.tcp_tw_recycle = 0 | |
net.ipv4.tcp_fin_timeout = 30 | |
net.ipv4.tcp_keepalive_time = 1200 | |
net.ipv4.ip_local_port_range = 10000 65000 | |
net.ipv4.tcp_max_syn_backlog = 8192 | |
net.ipv4.tcp_max_tw_buckets = 5000 | |
net.ipv4.tcp_fastopen = 3 | |
net.ipv4.tcp_mem = 25600 51200 102400 | |
net.ipv4.tcp_rmem = 4096 87380 67108864 | |
net.ipv4.tcp_wmem = 4096 65536 67108864 | |
net.ipv4.tcp_mtu_probing = 1 | |
net.ipv4.tcp_congestion_control = hybla |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment