update shadowsocks version to 2.9.0
This commit is contained in:
parent
a4a721536e
commit
89d876303b
153
shadowsocks.sh
153
shadowsocks.sh
|
|
@ -19,6 +19,14 @@ echo "# Thanks: @clowwindy <https://twitter.com/clowwindy> #"
|
||||||
echo "#############################################################"
|
echo "#############################################################"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
#Current folder
|
||||||
|
cur_dir=`pwd`
|
||||||
|
# Get public IP address
|
||||||
|
IP=$(ip addr | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | egrep -v "^192\.168|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-2]\.|^10\.|^127\.|^255\.|^0\." | head -n 1)
|
||||||
|
if [[ "$IP" = "" ]]; then
|
||||||
|
IP=$(wget -qO- -t1 -T2 ipv4.icanhazip.com)
|
||||||
|
fi
|
||||||
|
|
||||||
# Make sure only root can run our script
|
# Make sure only root can run our script
|
||||||
function rootness(){
|
function rootness(){
|
||||||
if [[ $EUID -ne 0 ]]; then
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
|
@ -74,7 +82,7 @@ fi
|
||||||
function pre_install(){
|
function pre_install(){
|
||||||
# Not support CentOS 5
|
# Not support CentOS 5
|
||||||
if centosversion 5; then
|
if centosversion 5; then
|
||||||
echo "Not support CentOS 5, please change to CentOS 6+ or Debian 7+ or Ubuntu 12+ and try again."
|
echo "Not supported CentOS 5, please change to CentOS 6+ or Debian 7+ or Ubuntu 12+ and try again."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
# Set shadowsocks config password
|
# Set shadowsocks config password
|
||||||
|
|
@ -126,25 +134,25 @@ function pre_install(){
|
||||||
yum install -y automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel which
|
yum install -y automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel which
|
||||||
else
|
else
|
||||||
apt-get -y update
|
apt-get -y update
|
||||||
apt-get -y install python python-dev python-pip python-setuptools curl wget unzip gcc swig automake make perl cpio
|
apt-get -y install python python-dev python-pip python-setuptools python-m2crypto curl wget unzip gcc swig automake make perl cpio build-essential
|
||||||
fi
|
fi
|
||||||
# Get IP address
|
|
||||||
echo "Getting Public IP address, Please wait a moment..."
|
|
||||||
IP=$(curl -s -4 icanhazip.com)
|
|
||||||
if [[ "$IP" = "" ]]; then
|
|
||||||
IP=$(curl -s -4 ipinfo.io/ip)
|
|
||||||
fi
|
|
||||||
echo -e "Your main public IP is\t\033[32m$IP\033[0m"
|
|
||||||
echo
|
|
||||||
#Current folder
|
|
||||||
cur_dir=`pwd`
|
|
||||||
cd $cur_dir
|
cd $cur_dir
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download files
|
# Download files
|
||||||
function download_files(){
|
function download_files(){
|
||||||
|
# Download libsodium file
|
||||||
|
if ! wget --no-check-certificate -O libsodium-1.0.11.tar.gz https://github.com/jedisct1/libsodium/releases/download/1.0.11/libsodium-1.0.11.tar.gz; then
|
||||||
|
echo "Failed to download libsodium file!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Download Shadowsocks file
|
||||||
|
if ! wget --no-check-certificate -O shadowsocks-master.zip https://github.com/shadowsocks/shadowsocks/archive/master.zip; then
|
||||||
|
echo "Failed to download Shadowsocks file!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Download ShadowsocksR chkconfig file
|
||||||
if [ "$OS" == 'CentOS' ]; then
|
if [ "$OS" == 'CentOS' ]; then
|
||||||
# Download shadowsocks chkconfig file
|
|
||||||
if ! wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks -O /etc/init.d/shadowsocks; then
|
if ! wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks -O /etc/init.d/shadowsocks; then
|
||||||
echo "Failed to download shadowsocks chkconfig file!"
|
echo "Failed to download shadowsocks chkconfig file!"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -214,64 +222,62 @@ function firewall_set(){
|
||||||
|
|
||||||
# Install Shadowsocks
|
# Install Shadowsocks
|
||||||
function install_ss(){
|
function install_ss(){
|
||||||
which pip > /dev/null 2>&1
|
# Install libsodium
|
||||||
if [ $? -ne 0 ]; then
|
tar zxf libsodium-1.0.11.tar.gz
|
||||||
if [ "$OS" == 'CentOS' ]; then
|
cd $cur_dir/libsodium-1.0.11
|
||||||
which easy_install > /dev/null 2>&1
|
./configure && make && make install
|
||||||
if [ $? -eq 0 ]; then
|
echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
|
||||||
easy_install pip
|
ldconfig
|
||||||
else
|
# Install Shadowsocks
|
||||||
echo "easy_install command not found. please check it and try again."
|
cd $cur_dir
|
||||||
exit 1
|
unzip -q shadowsocks-master.zip
|
||||||
fi
|
if [ $? -ne 0 ];then
|
||||||
fi
|
echo "unzip shadowsocks-master.zip failed! Please check unzip command."
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f /usr/bin/pip ]; then
|
|
||||||
if centosversion 6; then
|
|
||||||
# Fix swig failed error by install old version
|
|
||||||
pip install M2Crypto==0.22.3
|
|
||||||
else
|
|
||||||
pip install M2Crypto
|
|
||||||
fi
|
|
||||||
pip install greenlet
|
|
||||||
pip install gevent
|
|
||||||
pip install shadowsocks
|
|
||||||
if [ -f /usr/bin/ssserver ] || [ -f /usr/local/bin/ssserver ]; then
|
|
||||||
chmod +x /etc/init.d/shadowsocks
|
|
||||||
# Add run on system start up
|
|
||||||
if [ "$OS" == 'CentOS' ]; then
|
|
||||||
chkconfig --add shadowsocks
|
|
||||||
chkconfig shadowsocks on
|
|
||||||
else
|
|
||||||
update-rc.d -f shadowsocks defaults
|
|
||||||
fi
|
|
||||||
# Run shadowsocks in the background
|
|
||||||
/etc/init.d/shadowsocks start
|
|
||||||
else
|
|
||||||
echo
|
|
||||||
echo "Shadowsocks install failed! Please visit https://teddysun.com/342.html and contact."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
clear
|
|
||||||
echo
|
|
||||||
echo "Congratulations, shadowsocks install completed!"
|
|
||||||
echo -e "Your Server IP: \033[41;37m ${IP} \033[0m"
|
|
||||||
echo -e "Your Server Port: \033[41;37m ${shadowsocksport} \033[0m"
|
|
||||||
echo -e "Your Password: \033[41;37m ${shadowsockspwd} \033[0m"
|
|
||||||
echo -e "Your Local IP: \033[41;37m 127.0.0.1 \033[0m"
|
|
||||||
echo -e "Your Local Port: \033[41;37m 1080 \033[0m"
|
|
||||||
echo -e "Your Encryption Method: \033[41;37m aes-256-cfb \033[0m"
|
|
||||||
echo
|
|
||||||
echo "Welcome to visit:https://teddysun.com/342.html"
|
|
||||||
echo "Enjoy it!"
|
|
||||||
echo
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo
|
|
||||||
echo "pip install failed! Please visit https://teddysun.com/342.html and contact."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cd $cur_dir/shadowsocks-master
|
||||||
|
python setup.py install --record /usr/local/shadowsocks_install.log
|
||||||
|
|
||||||
|
if [ -f /usr/bin/ssserver ] || [ -f /usr/local/bin/ssserver ]; then
|
||||||
|
chmod +x /etc/init.d/shadowsocks
|
||||||
|
# Add run on system start up
|
||||||
|
if [ "$OS" == 'CentOS' ]; then
|
||||||
|
chkconfig --add shadowsocks
|
||||||
|
chkconfig shadowsocks on
|
||||||
|
else
|
||||||
|
update-rc.d -f shadowsocks defaults
|
||||||
|
fi
|
||||||
|
# Run shadowsocks in the background
|
||||||
|
/etc/init.d/shadowsocks start
|
||||||
|
else
|
||||||
|
echo
|
||||||
|
echo "Shadowsocks install failed! Please visit https://teddysun.com/342.html and contact."
|
||||||
|
install_cleanup
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
clear
|
||||||
|
echo
|
||||||
|
echo "Congratulations, shadowsocks install completed!"
|
||||||
|
echo -e "Your Server IP: \033[41;37m ${IP} \033[0m"
|
||||||
|
echo -e "Your Server Port: \033[41;37m ${shadowsocksport} \033[0m"
|
||||||
|
echo -e "Your Password: \033[41;37m ${shadowsockspwd} \033[0m"
|
||||||
|
echo -e "Your Local IP: \033[41;37m 127.0.0.1 \033[0m"
|
||||||
|
echo -e "Your Local Port: \033[41;37m 1080 \033[0m"
|
||||||
|
echo -e "Your Encryption Method: \033[41;37m aes-256-cfb \033[0m"
|
||||||
|
echo
|
||||||
|
echo "Welcome to visit:https://teddysun.com/342.html"
|
||||||
|
echo "Enjoy it!"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
# Install cleanup
|
||||||
|
function install_cleanup(){
|
||||||
|
cd $cur_dir
|
||||||
|
rm -f shadowsocks-master.zip
|
||||||
|
rm -rf shadowsocks-master
|
||||||
|
rm -f libsodium-1.0.11.tar.gz
|
||||||
|
rm -rf libsodium-1.0.11
|
||||||
}
|
}
|
||||||
|
|
||||||
# Uninstall Shadowsocks
|
# Uninstall Shadowsocks
|
||||||
|
|
@ -297,12 +303,10 @@ function uninstall_shadowsocks(){
|
||||||
rm -f /etc/shadowsocks.json
|
rm -f /etc/shadowsocks.json
|
||||||
rm -f /var/run/shadowsocks.pid
|
rm -f /var/run/shadowsocks.pid
|
||||||
rm -f /etc/init.d/shadowsocks
|
rm -f /etc/init.d/shadowsocks
|
||||||
pip uninstall -y shadowsocks
|
if [ -f /usr/local/shadowsocks_install.log ]; then
|
||||||
if [ $? -eq 0 ]; then
|
cat /usr/local/shadowsocks_install.log | xargs rm -rf
|
||||||
echo "Shadowsocks uninstall success!"
|
|
||||||
else
|
|
||||||
echo "Shadowsocks uninstall failed!"
|
|
||||||
fi
|
fi
|
||||||
|
echo "Shadowsocks uninstall success!"
|
||||||
else
|
else
|
||||||
echo "uninstall cancelled, Nothing to do"
|
echo "uninstall cancelled, Nothing to do"
|
||||||
fi
|
fi
|
||||||
|
|
@ -320,6 +324,7 @@ function install_shadowsocks(){
|
||||||
firewall_set
|
firewall_set
|
||||||
fi
|
fi
|
||||||
install_ss
|
install_ss
|
||||||
|
install_cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization step
|
# Initialization step
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user