shadowsocks一键安装脚本
摘自搬瓦工后台,脚本简洁明了,请自取。
一键安装需求:
centos6 + root用户。
请将下面一段代码保存为 ss.sh
,并上传至/tmp目录。
然后在终端执行sh /tmp/ss.sh
即可!。
yum -y install python-setuptools easy_install pip pip install shadowsocksecho 443 > /root/.kiwivm-shadowsocks-portecho rc4-md5 > /root/.kiwivm-shadowsocks-encryptiondate +%s%N | md5sum | base64 | head -c 10 > /root/.kiwivm-shadowsocks-passwordecho '' >> /etc/rc.d/rc.localecho '/usr/bin/ssserver -p `cat /root/.kiwivm-shadowsocks-port` -k `cat /root/.kiwivm-shadowsocks-password` -m `cat /root/.kiwivm-shadowsocks-encryption` --user nobody --workers 2 -d start' >> /etc/rc.d/rc.localecho 'Installation complete!'echo 'Running shadowsocks!'/usr/bin/ssserver -p `cat /root/.kiwivm-shadowsocks-port` -k `cat /root/.kiwivm-shadowsocks-password` -m `cat /root/.kiwivm-shadowsocks-encryption` --user nobody --workers 2 -d start
cd ~ && wget -O - "https://bootstrap.pypa.io/get-pip.py" | python pip install shadowsocks echo 'ssserver -p xxx -k xxxxx -m rc4-md5 --workers 10 --pid-file /tmp/ss.pid --log-file /tmp/ss.log --user nobody -v -d start' >> /etc/rc.d/rc.local
下面是后台源码
mkdir -p '/tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b'if [ ! -d "/root/.kiwivm-task" ]; then mkdir "/root/.kiwivm-task"fiPIDFILE=/root/.kiwivm-task/pidif [ -e ${PIDFILE} ] && kill -0 `cat ${PIDFILE}`; then echo "Another task is already running, PID: `cat ${PIDFILE}`" exitfitrap "rm -f ${PIDFILE}; rm -f /tmp/kiwivm_task_file_d1106540378a9f630a58cdab4678c5c4e1320097; exit" INT KILL TERM EXITecho $$ > ${PIDFILE}rm -f /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txttouch /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txtecho '**************************************************************' >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txtecho 'KiwiVM Task File, executed: Tue, 21 Apr 2015 21:00:03 -0400' >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txtecho '**************************************************************' >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txtecho '' > /tmp/.kiwivm-task/index.html UNAME_M=`uname -m` >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1if [ ${UNAME_M} == 'x86_64' ]; then >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1 ARCH='x86_64' >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1else >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1 ARCH='i686' >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1fi >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1 OS=`cat /etc/redhat-release | awk '{print $1}'` >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1if [ "$OS" != "CentOS" ]; then >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1echo "Detected OS: $OS. Sorry, this script requires CentOS 6."; >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1echo '*** End of transmission ***' >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1exit; >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1fi >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1 OSVER=`cat /etc/redhat-release | awk '{print $3}' | awk -F . '{print $1}'` >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1if [ "$OSVER" != "6" ]; then >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1echo "Detected OS: $OS $OSVER. Sorry, this script requires CentOS 6."; >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1echo '*** End of transmission ***' >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1exit; >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1fi >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1echo "OS: $OS $OSVER $ARCH" >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1 yum -y install python-setuptools >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1 easy_install pip >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1 pip install shadowsocks >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1echo 443 > /root/.kiwivm-shadowsocks-portecho rc4-md5 > /root/.kiwivm-shadowsocks-encryptiondate +%s%N | md5sum | base64 | head -c 10 > /root/.kiwivm-shadowsocks-passwordecho '' >> /etc/rc.d/rc.localecho '/usr/bin/ssserver -p `cat /root/.kiwivm-shadowsocks-port` -k `cat /root/.kiwivm-shadowsocks-password` -m `cat /root/.kiwivm-shadowsocks-encryption` --user nobody --workers 2 -d start' >> /etc/rc.d/rc.local /usr/bin/ssserver -p `cat /root/.kiwivm-shadowsocks-port` -k `cat /root/.kiwivm-shadowsocks-password` -m `cat /root/.kiwivm-shadowsocks-encryption` --user nobody --workers 2 -d start >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1echo '' >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1echo '******************************************************************' >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1echo '* Completed. *' >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1echo '******************************************************************' >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1rm -f ${PIDFILE}echo '*** End of transmission ***' >> /tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt 2>&1sleep 30cp '/tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b/logfile.txt' '/root/.kiwivm-task/taskfile-result-1429664403-7740.log'rm -f '/tmp/kiwivm_task_file_d1106540378a9f630a58cdab4678c5c4e1320097'rm -rf '/tmp/.kiwivm-task/ede0bee507b593659fe522d89761488de0f1708b'