Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #!/bin/bash
  2. # Install Shadowsocks on CentOS 7
  3.  
  4. echo "Installing Shadowsocks..."
  5.  
  6. useradd shadowsocks
  7. read -p "input shadowsocks password: " SS_PASSWORD
  8.  
  9. CONFIG_FILE=/etc/shadowsocks.json
  10. SERVICE_FILE=/etc/systemd/system/shadowsocks.service
  11. SS_PORT=8388
  12. SS_METHOD=aes-256-cfb
  13. SS_IP=`ip route get 1 | awk '{print $NF;exit}'`
  14.  
  15. yum install python-pip -y
  16.  
  17. # install shadowsocks
  18. pip install --upgrade pip
  19. pip install shadowsocks
  20.  
  21. # create shadowsocls config
  22. cat <<EOF | sudo tee ${CONFIG_FILE}
  23. {
  24. "server": "0.0.0.0",
  25. "server_port": ${SS_PORT},
  26. "password": "${SS_PASSWORD}",
  27. "method": "${SS_METHOD}"
  28. }
  29. EOF
  30.  
  31. # create service
  32. cat <<EOF | sudo tee ${SERVICE_FILE}
  33. [Unit]
  34. Description=Shadowsocks
  35.  
  36. [Service]
  37. User=shadowsocks
  38. TimeoutStartSec=0
  39. ExecStart=/usr/bin/ssserver -c ${CONFIG_FILE}
  40.  
  41. [Install]
  42. WantedBy=multi-user.target
  43. EOF
  44.  
  45. # start service
  46. systemctl enable shadowsocks
  47. systemctl start shadowsocks
  48.  
  49. # view service status
  50. sleep 5
  51. systemctl status shadowsocks -l
  52.  
  53. echo "================================"
  54. echo ""
  55. echo "Congratulations! Shadowsocks has been installed on your system."
  56. echo "You shadowsocks connection info:"
  57. echo "--------------------------------"
  58. echo "server: ${SS_IP}"
  59. echo "server_port: ${SS_PORT}"
  60. echo "password: ${SS_PASSWORD}"
  61. echo "method: ${SS_METHOD}"
  62. echo "--------------------------------"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement