Advertisement
Guest User

Untitled

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