update iptables rules & Fix swig failed error
This commit is contained in:
parent
113415945c
commit
8c462518a0
|
|
@ -123,7 +123,7 @@ function pre_install(){
|
||||||
#Install necessary dependencies
|
#Install necessary dependencies
|
||||||
if [ "$OS" == 'CentOS' ]; then
|
if [ "$OS" == 'CentOS' ]; then
|
||||||
yum install -y wget unzip openssl-devel gcc swig python python-devel python-setuptools autoconf libtool libevent
|
yum install -y wget unzip openssl-devel gcc swig python python-devel python-setuptools autoconf libtool libevent
|
||||||
yum install -y automake make curl curl-devel zlib-devel perl perl-devel cpio expat-devel gettext-devel
|
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 curl wget unzip gcc swig automake make perl cpio
|
apt-get -y install python python-dev python-pip curl wget unzip gcc swig automake make perl cpio
|
||||||
|
|
@ -144,10 +144,6 @@ function pre_install(){
|
||||||
# Download files
|
# Download files
|
||||||
function download_files(){
|
function download_files(){
|
||||||
if [ "$OS" == 'CentOS' ]; then
|
if [ "$OS" == 'CentOS' ]; then
|
||||||
if ! wget -t3 -T30 http://lamp.teddysun.com/ez_setup.py; then
|
|
||||||
echo "Failed to download ez_setup.py!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
# Download shadowsocks chkconfig file
|
# 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!"
|
||||||
|
|
@ -182,9 +178,10 @@ function iptables_set(){
|
||||||
echo "iptables start setting..."
|
echo "iptables start setting..."
|
||||||
/etc/init.d/iptables status 1>/dev/null 2>&1
|
/etc/init.d/iptables status 1>/dev/null 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
/etc/init.d/iptables status | grep '${shadowsocksport}' | grep 'ACCEPT' >/dev/null 2>&1
|
/sbin/iptables -L -n | grep '${shadowsocksport}' | grep 'ACCEPT' >/dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
/sbin/iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${shadowsocksport} -j ACCEPT
|
/sbin/iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${shadowsocksport} -j ACCEPT
|
||||||
|
/sbin/iptables -I INPUT -m state --state NEW -m udp -p udp --dport ${shadowsocksport} -j ACCEPT
|
||||||
/etc/init.d/iptables save
|
/etc/init.d/iptables save
|
||||||
/etc/init.d/iptables restart
|
/etc/init.d/iptables restart
|
||||||
else
|
else
|
||||||
|
|
@ -200,12 +197,25 @@ function install_ss(){
|
||||||
which pip > /dev/null 2>&1
|
which pip > /dev/null 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
if [ "$OS" == 'CentOS' ]; then
|
if [ "$OS" == 'CentOS' ]; then
|
||||||
python ez_setup.py install
|
which easy_install > /dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
easy_install pip
|
easy_install pip
|
||||||
|
else
|
||||||
|
echo "easy_install command not found. please check it and try again."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f /usr/bin/pip ]; then
|
if [ -f /usr/bin/pip ]; then
|
||||||
|
if [ "$OS" == 'CentOS' ]; then
|
||||||
|
if centosversion 6; then
|
||||||
|
# Fix swig failed error by install old version
|
||||||
|
pip install M2Crypto==0.22.3
|
||||||
|
fi
|
||||||
|
else
|
||||||
pip install M2Crypto
|
pip install M2Crypto
|
||||||
|
fi
|
||||||
pip install greenlet
|
pip install greenlet
|
||||||
pip install gevent
|
pip install gevent
|
||||||
pip install shadowsocks
|
pip install shadowsocks
|
||||||
|
|
@ -226,7 +236,7 @@ function install_ss(){
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
clear
|
clear
|
||||||
echo ""
|
echo
|
||||||
echo "Congratulations, shadowsocks install completed!"
|
echo "Congratulations, shadowsocks install completed!"
|
||||||
echo -e "Your Server IP: \033[41;37m ${IP} \033[0m"
|
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 Server Port: \033[41;37m ${shadowsocksport} \033[0m"
|
||||||
|
|
@ -234,13 +244,13 @@ function install_ss(){
|
||||||
echo -e "Your Local IP: \033[41;37m 127.0.0.1 \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 Local Port: \033[41;37m 1080 \033[0m"
|
||||||
echo -e "Your Encryption Method: \033[41;37m aes-256-cfb \033[0m"
|
echo -e "Your Encryption Method: \033[41;37m aes-256-cfb \033[0m"
|
||||||
echo ""
|
echo
|
||||||
echo "Welcome to visit:https://teddysun.com/342.html"
|
echo "Welcome to visit:https://teddysun.com/342.html"
|
||||||
echo "Enjoy it!"
|
echo "Enjoy it!"
|
||||||
echo ""
|
echo
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo ""
|
echo
|
||||||
echo "pip install failed! Please visit https://teddysun.com/342.html and contact."
|
echo "pip install failed! Please visit https://teddysun.com/342.html and contact."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -288,12 +298,12 @@ function install_shadowsocks(){
|
||||||
pre_install
|
pre_install
|
||||||
download_files
|
download_files
|
||||||
config_shadowsocks
|
config_shadowsocks
|
||||||
|
install_ss
|
||||||
if [ "$OS" == 'CentOS' ]; then
|
if [ "$OS" == 'CentOS' ]; then
|
||||||
if ! centosversion 7; then
|
if centosversion 6; then
|
||||||
iptables_set
|
iptables_set
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
install_ss
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization step
|
# Initialization step
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user