Advertisement
Guest User

Untitled

a guest
Apr 8th, 2018
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.40 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ $USER != 'root' ]; then
  4. echo "You must run this as root"
  5. exit
  6. fi
  7.  
  8. # initialisasi var
  9. export DEBIAN_FRONTEND=noninteractive
  10. OS=`uname -m`;
  11.  
  12. if [[ -e /etc/debian_version ]]; then
  13. #OS=debian
  14. RCLOCAL='/etc/rc.local'
  15. else
  16. echo "You are not running this script on Debian OS"
  17. exit
  18. fi
  19.  
  20. vps="vps";
  21.  
  22. if [[ $vps = "vps" ]]; then
  23. source="https://raw.githubusercontent.com/Clrkz/VPSAutoScrptz/master"
  24. else
  25. source="https://raw.githubusercontent.com/Clrkz/VPSAutoScrptz/master"
  26. fi
  27.  
  28. # go to root
  29. cd
  30.  
  31. MYIP=$(wget -qO- ipv4.icanhazip.com);
  32.  
  33. # check registered ip
  34. wget -q -O daftarip http://188.166.215.119:85/ocs/ip.txt
  35. if ! grep -w -q $MYIP daftarip; then
  36. echo "Sorry, only registered IPs can use this script!"
  37. if [[ $vps = "vps" ]]; then
  38. echo "Powered by Clrkz"
  39. else
  40. echo "Powered by Clrkz"
  41. fi
  42. rm -f /root/daftarip
  43. exit
  44. fi
  45.  
  46. #https://github.com/adenvt/OcsPanels/wiki/tutor-debian
  47.  
  48. clear
  49. echo ""
  50. echo "I need to ask some questions before starting setup"
  51. echo "You can leave the default option and just hit enter if you agree with the option"
  52. echo ""
  53. echo "First I need to know the new password of MySQL root user:"
  54. read -p "Password baru: " -e -i clrkz DatabasePass
  55. echo ""
  56. echo "Finally, name the Database Name for OCS Panels"
  57. echo " Please, use one word only, no special characters other than Underscore (_)"
  58. read -p " Database Name: " -e -i OCS_PANEL DatabaseName
  59. echo ""
  60. echo "Okay, that's all I need. We are ready to setup your OCS Panels now"
  61. read -n1 -r -p "Press any key to continue..."
  62.  
  63. #apt-get update
  64. apt-get update -y
  65. apt-get install build-essential expect -y
  66.  
  67. echo "clear" >> .bashrc
  68. echo 'echo -e " # ### ### /"' >> .bashrc
  69. echo 'echo -e " / /### / ### #/"' >> .bashrc
  70. echo 'echo -e " / / ###/ ## ##"' >> .bashrc
  71. echo 'echo -e " / ## ## ## ##"' >> .bashrc
  72. echo 'echo -e " / ### ## ##"' >> .bashrc
  73. echo 'echo -e "## ## ## ### /### ## /## ######"' >> .bashrc
  74. echo 'echo -e "## ## ## ###/ #### / ## / ### /#######"' >> .bashrc
  75. echo 'echo -e "## ## ## ## ###/ ##/ / / ##"' >> .bashrc
  76. echo 'echo -e "## ## ## ## ## / /"' >> .bashrc
  77. echo 'echo -e "## ## ## ## ## / /"' >> .bashrc
  78. echo 'echo -e " ## ## ## ## ## ## ###"' >> .bashrc
  79. echo 'echo -e " ## # / ## ## ###### ###"' >> .bashrc
  80. echo 'echo -e " ### / ## ## ## ### ###"' >> .bashrc
  81. echo 'echo -e " ######/ ### / ### ## ### / ##"' >> .bashrc
  82. echo 'echo -e " ### ##/ ### ## ##/ ##"' >> .bashrc
  83. echo 'echo -e " /"' >> .bashrc
  84. echo 'echo -e " /"' >> .bashrc
  85. echo 'echo -e " /"' >> .bashrc
  86. echo 'echo -e " /"' >> .bashrc
  87. echo 'echo -e "welcome to the server $HOSTNAME" | lolcat' >> .bashrc
  88. echo 'echo -e "Script mod by Clrkz"' >> .bashrc
  89. echo 'echo -e "Type menu to display a list of commands"' >> .bashrc
  90. echo 'echo -e ""' >> .bashrc
  91.  
  92. apt-get install -y mysql-server
  93.  
  94. #mysql_secure_installation
  95. so1=$(expect -c "
  96. spawn mysql_secure_installation; sleep 3
  97. expect \"\"; sleep 3; send \"\r\"
  98. expect \"\"; sleep 3; send \"Y\r\"
  99. expect \"\"; sleep 3; send \"$DatabasePass\r\"
  100. expect \"\"; sleep 3; send \"$DatabasePass\r\"
  101. expect \"\"; sleep 3; send \"Y\r\"
  102. expect \"\"; sleep 3; send \"Y\r\"
  103. expect \"\"; sleep 3; send \"Y\r\"
  104. expect \"\"; sleep 3; send \"Y\r\"
  105. expect eof; ")
  106. echo "$so1"
  107. #\r
  108. #Y
  109. #pass
  110. #pass
  111. #Y
  112. #Y
  113. #Y
  114. #Y
  115.  
  116. chown -R mysql:mysql /var/lib/mysql/
  117. chmod -R 755 /var/lib/mysql/
  118.  
  119. apt-get -y install nginx php5 php5-fpm php5-cli php5-mysql php5-mcrypt
  120. rm /etc/nginx/sites-enabled/default
  121. rm /etc/nginx/sites-available/default
  122. mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.backup
  123. mv /etc/nginx/conf.d/vps.conf /etc/nginx/conf.d/vps.conf.backup
  124. wget -O /etc/nginx/nginx.conf "http://script.hostingtermurah.net/repo/blog/ocspanel-debian7/nginx.conf"
  125. wget -O /etc/nginx/conf.d/vps.conf "http://script.hostingtermurah.net/repo/blog/ocspanel-debian7/vps.conf"
  126. sed -i 's/cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /etc/php5/fpm/php.ini
  127. sed -i 's/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g' /etc/php5/fpm/pool.d/www.conf
  128.  
  129. useradd -m vps
  130. mkdir -p /home/vps/public_html
  131. rm /home/vps/public_html/index.html
  132. echo "<?php phpinfo() ?>" > /home/vps/public_html/info.php
  133. chown -R www-data:www-data /home/vps/public_html
  134. chmod -R g+rw /home/vps/public_html service php5-fpm restart
  135. service php5-fpm restart
  136. service nginx restart
  137.  
  138. apt-get -y install zip unzip
  139. cd /home/vps/public_html
  140. wget $source/OCS.zip
  141. unzip OCS.zip
  142. rm -f OCS.zip
  143. chown -R www-data:www-data /home/vps/public_html
  144. chmod -R g+rw /home/vps/public_html
  145.  
  146. #mysql -u root -p
  147. so2=$(expect -c "
  148. spawn mysql -u root -p; sleep 3
  149. expect \"\"; sleep 3; send \"$DatabasePass\r\"
  150. expect \"\"; sleep 3; send \"CREATE DATABASE IF NOT EXISTS $DatabaseName;EXIT;\r\"
  151. expect eof; ")
  152. echo "$so2"
  153. #pass
  154. #CREATE DATABASE IF NOT EXISTS OCS_PANEL;EXIT;
  155.  
  156. chmod 777 /home/vps/public_html/config
  157. chmod 777 /home/vps/public_html/config/inc.php
  158. chmod 777 /home/vps/public_html/config/route.php
  159.  
  160. apt-get -y --force-yes -f install libxml-parser-perl
  161.  
  162. clear
  163. echo "Open Browser, access http://$MYIP:85/ and complete the data as below!"
  164. echo "Database:"
  165. echo "- Database Host: localhost"
  166. echo "- Database Name: $DatabaseName"
  167. echo "- Database User: root"
  168. echo "- Database Pass: $DatabasePass"
  169. echo ""
  170. echo "Admin Login:"
  171. echo "- Username: anything you want"
  172. echo "- Password Baru: anything you want"
  173. echo "- Re-enter New Password: as desired"
  174. echo ""
  175. echo "Click Install and wait for the process to finish, go back to terminal and then press [ENTER key]!"
  176.  
  177. sleep 3
  178. echo ""
  179. read -p "If the above step has been done, please Press [Enter] key to continue...."
  180. echo ""
  181. read -p "If you really believe the above step has been done, please Press [Enter] key to continue..."
  182. echo ""
  183. cd /root
  184. #wget http://www.webmin.com/jcameron-key.asc
  185. #apt-key add jcameron-key.asc
  186. #sed -i 's/ssl=1/ssl=0/g' /etc/webmin/miniserv.conf
  187. #service webmin restart
  188.  
  189. #rm -f /root/jcameron-key.asc
  190.  
  191. #rm -R /home/vps/public_html/installation
  192.  
  193. cd
  194. rm -f /root/.bash_history && history -c
  195. echo "unset HISTFILE" >> /etc/profile
  196.  
  197. chmod 755 /home/vps/public_html/config
  198. chmod 644 /home/vps/public_html/config/inc.php
  199. chmod 644 /home/vps/public_html/config/route.php
  200.  
  201. # info
  202. clear
  203. echo "=======================================================" | tee -a log-install.txt
  204. echo "Please login Reseller Panel at http://$MYIP:85" | tee -a log-install.txt
  205. echo "" | tee -a log-install.txt
  206. echo "Auto Script Installer OCS Panels Mod by Clrkz" | tee -a log-install.txt
  207. echo " (http://bytehax.blogspot.com/ - fb.com/143Clarkz) " | tee -a log-install.txt
  208. echo "" | tee -a log-install.txt
  209. echo "Thanks " | tee -a log-install.txt
  210. echo "" | tee -a log-install.txt
  211. echo "Installation Log --> /root/log-install.txt" | tee -a log-install.txt
  212. echo "=======================================================" | tee -a log-install.txt
  213. cd ~/
  214.  
  215. #rm -f /root/ocspanel.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement