Advertisement
ujiajah1

autoinstallsquid4 ./squid4.sh

May 13th, 2016
320
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 9.33 KB | None | 0 0
  1. #!/bin/bash
  2. read -p 'Masukan User Linux Anda: ' userver
  3. read -sp 'password Linux Anda: ' passserver
  4. echo "Aku Yakin Kamu pasti bisa"
  5. echo -e "selamat datang $userver di program installasi\n"
  6. echo -n "Masukan Nama Anda :"
  7. read nama
  8. echo "Hello $nama"
  9. echo "goodluck $nama"
  10. echo "oh iya ... !sebelumnya clone dari github git clone https://github.com/puji122/squid4-autoinstall.git"
  11. echo "|=====================================================|"
  12. echo "|                   Sajak Suara                       |"
  13. echo "|=====================================================|"
  14. echo "|     sesungguhnya suara itu tak bisa diredam         |"
  15. echo "|                mulut bisa dibungkam                 |"
  16. echo "|  namun siapa mampu menghentikan nyanyian bimbang    |"
  17. echo "|    dan pertanyaan-pertanyaan dari lidah jiwaku      |"
  18. echo "|      suara-suara itu tak bisa dipenjarakan          |"
  19. echo "|          di sana bersemayam kemerdekaan             |"
  20. echo "|           apabila engkau memaksa diam               |"
  21. echo "|       akan kusiapkan untukmu: pemberontakan!        |"
  22. echo "|                                                     |"
  23. echo "|        sesungguhnya suara itu bukan perampok        |"
  24. echo "|             yang ingin meraih hartamu               |"
  25. echo "|                 ia ingin bicara                     |"
  26. echo "|            mengapa kau kokang senjata               |"
  27. echo "|         dan gemetar ketika suara-suara itu          |"
  28. echo "|                menuntut keadilan?                   |"
  29. echo "|                                                     |"
  30. echo "|       sesungguhnya suara itu akan menjadi kata      |"
  31. echo "|          ialah yang mengajari aku bertanya          |"
  32. echo "|          dan pada akhirnya tidak bisa tidak         |"
  33. echo "|                engkau harus menjawabnya             |"
  34. echo "|            apabila engkau tetap bertahan            |"
  35. echo "|         aku akan memburumu seperti kutukan          |"
  36. echo "|           Wiji Thukul - 1996 (Sajak Suara)          |"
  37. echo "|=====================================================|"
  38. echo -e "Selamat datang di installasi server, \n"
  39. while true; do
  40.     read -p "Lanjutkan installasi?" yn
  41.     case $yn in
  42.         [Yy]* ) break;;
  43.         [Nn]* ) exit;;
  44.         * ) echo "Tolong jawab yes atau no";;
  45.     esac
  46. done                                                      
  47. # informasi perangkat keras                                                    
  48. echo "++ Perangkat keras "                                                      
  49. CPU=`grep "model name" /proc/cpuinfo | head -n 1 | cut -f 2 -d ':'`            
  50. RAM=`grep "MemTotal" /proc/meminfo | cut -f 2 -d ':'`                          
  51. echo " |- CPU : " $CPU                                                          
  52. echo " |- RAM : " $RAM                                                          
  53. echo "++ Sistem Operasi "                                                      
  54. # informasi sistem operasi                                                      
  55. OS=`uname -sr`                                                                  
  56. echo " |- OS : " $OS                                                            
  57. echo " |- Shell : " $SHELL
  58. echo -n "Waktu system   :"; date
  59. echo -n "Distro Info    :"; lsb_release -a
  60. echo -n "Anda           :"; whoami
  61. echo -n "Banyak pemakai :"; who | wc -l
  62. echo "ok langsung ajah"
  63. echo "sambil ngopi brayy duduk yang manis yah"
  64.  
  65. cp sysctl.conf /etc/sysctl.conf
  66. cp limits.conf /etc/security/limits.conf
  67. cp modules /etc/modules
  68.  
  69. apt-get update && apt-get upgrade -y
  70.  
  71. apt-get install devscripts build-essential openssl libssl-dev fakeroot libcppunit-dev pkg-config libsasl2-dev cdbs ebtables bridge-utils libcap2 libcap-dev libcap2-dev sysv-rc-conf iproute kernel-package libncurses5-dev fakeroot wget bzip2 debhelper linuxdoc-tools libselinux1-dev htop iftop dnstop perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python ccze pastebinit checkinstall libssl-dev htop iftop iptraf mtr-tiny bwm-ng ccze sysv-rc-conf devscripts build-essential openssl libssl-dev fakeroot libcppunit-dev libsasl2-dev cdbs ccze libfile-readbackwards-perl libcap2 libcap-dev libcap2-dev libnetfilter-conntrack-dev libfile-readbackwards-perl -y
  72.  
  73. tar -xvzf libsodium-0.7.0.tar.gz
  74.  
  75. cd libsodium-0.7.0
  76. ./configure && make && make install
  77.  
  78. cd -
  79. tar -xzvf dnscrypt-proxy-1.4.0.tar.gz
  80.  
  81. cd dnscrypt-proxy-1.4.0
  82. ./configure && make && make install
  83. ln -s /usr/local/lib/libsodium.so.13 /usr/lib/libsodium.so.13
  84. /usr/local/sbin/dnscrypt-proxy -a 127.0.0.1:40 -d -R d0wn-sg-ns1 -e 4096 -p /run/dnscrypt-proxy.pid
  85. netstat -tapen | grep ":40 "
  86.  
  87. cd -
  88. cp rc.local /etc/rc.local
  89. apt-get install unbound -y
  90. cp named.cache /etc/unbound/named.cache
  91. cp unbound.conf /etc/unbound/unbound.conf
  92.  
  93. cd /etc/unbound
  94. unbound-control-setup && groupadd unbound && useradd -d /var/unbound -m -g unbound -s /bin/false unbound
  95. chown unbound:root unbound_* && chmod 440 unbound_*
  96. killall unbound
  97. /etc/init.d/unbound stop
  98. /etc/init.d/unbound restart
  99.  
  100. cd -
  101. tar -xzf libecap-1.0.0.tar.gz
  102. cp DSI_ecap_youtube.so /usr/local/lib/
  103. cd libecap-1.0.0
  104. ./configure && make && make install
  105. echo '/usr/local/lib' >> /etc/ld.so.conf
  106. ldconfig
  107.  
  108. cd -
  109. tar -xzf ecap_adapter_sample-1.0.0.tar.gz
  110. cp patch_ecap_adapter_sample.patch ecap_adapter_sample-1.0.0/
  111. cd ecap_adapter_sample-1*
  112. patch -p1 < patch_ecap_adapter_sample.patch
  113. ./configure && make && make install
  114.  
  115. cd -
  116. tar -xzvf squid-4.0.4.tar.gz
  117. cd squid-4.0.4
  118. ./configure '--prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--libexecdir=/usr/lib/squid' '--sysconfdir=/etc/squid' '--localstatedir=/var' '--libdir=/usr/lib' '--includedir=/usr/include' '--datadir=/usr/share/squid' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--disable-dependency-tracking' '--disable-strict-error-checking' '--enable-async-io=24' '--with-aufs-threads=24' '--with-pthreads' '--enable-storeio=aufs,diskd' '--enable-removal-policies=lru,heap' '--with-aio' '--with-dl' '--disable-icmp' '--enable-esi' '--disable-icap-client' '--disable-wccp' '--disable-wccpv2' '--enable-kill-parent-hack' '--enable-cache-digests' '--disable-select' '--enable-http-violations' '--enable-linux-netfilter' '--enable-follow-x-forwarded-for' '--disable-ident-lookups' '--enable-x-accelerator-vary' '--enable-zph-qos' '--with-default-user=proxy' '--with-logdir=/var/log/squid' '--with-pidfile=/var/run/squid.pid' '--with-swapdir=/cache/cache' '--with-openssl' '--with-large-files' '--enable-ltdl-convenience' '--with-filedescriptors=65536' '--with-maxfd=65536' '--enable-storeid-rewrite-helpers' '--enable-ecap' '--enable-ssl-crtd' '--enable-err-languages=English' '--enable-default-err-language=English' '--build=x86_64' 'build_alias=x86_64' 'PKG_CONFIG_PATH=/usr/local/lib/pkgconfig'
  119. make && make install
  120.  
  121. cd -
  122. cp squid.conf /etc/squid/
  123. cp squid-cache.txt /etc/squid/
  124. cp squid-cache /etc/squid/
  125. cp squidrewrite /etc/squid/
  126. cp squid /etc/init.d/
  127.  
  128. cd /etc/init.d/
  129. chmod +x /etc/init.d/squid
  130. update-rc.d squid defaults
  131. /etc/init.d/squid stop
  132.  
  133. cd -
  134. chmod 755 /etc/squid/squid-cache
  135. chown root.root /etc/squid/squid-cache
  136. chown proxy.proxy /etc/squid/squid-cache
  137. chmod 644 /etc/squid/squid-cache.txt
  138. chown root.root /etc/squid/squid-cache.txt
  139. chown proxy:proxy /etc/squid/squid-cache.txt
  140. chmod 755 /etc/squid/squidrewrite
  141. chown root.root /etc/squid/squidrewrite
  142. chown proxy:proxy /etc/squid/squidrewrite
  143.  
  144. cd
  145. chown -R proxy:proxy /cache/cache/
  146. chmod -R 777 /cache/cache/
  147. cd /var/log/squid/
  148. touch access.log
  149. touch cache.log
  150.  
  151. cd
  152. chown -R proxy:proxy /var/log/squid/
  153. chmod -R 777 /var/log/squid/
  154. mkdir /etc/squid/ssl_certs/
  155.  
  156. cd /etc/squid/ssl_certs/
  157. openssl genrsa -out squid.key 2048
  158. openssl req -new -key squid.key -out squid.csr -nodes -subj "/C=ID/ST=Jakarta/L=Jakarta/O=Hipster/CN=Young Hipster"
  159. openssl x509 -req -days 3652 -in squid.csr -signkey squid.key -out squid.crt
  160.  
  161. cd
  162. /usr/lib/squid/ssl_crtd -c -s /etc/squid/ssl_db
  163. chown -R nobody /etc/squid/
  164. chown -R proxy:proxy /etc/squid/
  165. chmod -R 777 /etc/squid/
  166. echo "================================================================"
  167. echo "untuk mikrotiknya ="
  168. echo "================================================================"
  169. echo "add ipproxy in address_list= /ip firewall address list= ipproxy name= proxy
  170. /ip routes
  171. add gateway = ip proxy
  172. distance = 1
  173. scope = 30
  174. target scope = 10
  175. routing_mark = via_squid"
  176.  
  177. echo "================================================================"
  178. echo "/ip firewall mangle
  179. add chain = prerouting
  180. dst.address = !ip proxy/subnet
  181. protocol = tcp
  182. any port = 80,182,443
  183. in interface = !proxy
  184. add action = mark-routing
  185. new routing mark =  via squid"
  186.  
  187. echo "================================================================"
  188. echo "setelah reboot"
  189. echo "squid -k reconfigure"
  190. echo "/etc/init.d/squid restart"
  191. echo "byee sayang"
  192. echo "jangan lupa configurasi /etc/network/interface nya di bagian dns-nameserver di kosongkan"
  193. echo "unbound-control stats"
  194. echo "unbound-control stats | tail -16"
  195. echo "tail -f /var/log/squid/access.log | ccze"
  196. echo "buat direktory cache"
  197. squid -z
  198. echo "selesai_"
  199. echo -e "Instalasi Unbound dan Squid telah selesai. , \nsebaiknya restart server anda."
  200. while true; do
  201.     read -p "Serius Lo mau Direstart?" yn
  202.     case $yn in
  203.         [Yy]* ) init 6; break;;
  204.         [Nn]* ) exit;;
  205.         * ) echo "jawab aja yes atau no";;
  206.     esac
  207. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement