Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.79 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. #Establishing Local Variables
  4. MULTIUSER='multipanel'
  5. MULTIKEY='C0E9-844A-27A5-0744'
  6. MYSQLROOTPASS='$$$Test'
  7. DAEMONID='1'
  8. DAEMONPASS='$$$Test'
  9. MYSQLMULTINAME='enderinstaller'
  10. MYSQLMULTIPASS='$$$EnderInstaller'
  11.  
  12. IP='hostname -I'
  13.  
  14. #Color Variables
  15. RED="\e[38;5;198m"
  16. GREEN="tput setaf 2"
  17.  
  18. #Installs MySQL Server and Client
  19. sudo -E debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQLROOTPASS"
  20. sudo -E debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQLROOTPASS"
  21. sudo -E apt-get -y install mysql-server mysql-client
  22.  
  23. #Check if installation was Successful
  24. mysqltest() {
  25.     if hash mysql 2>/dev/null; then
  26.         mysqlresult=1
  27.     else
  28.         mysqlresult=0
  29.     fi
  30. }
  31.  
  32. #Installs Apache2 Web Service
  33. sudo -E apt-get -y install apache2
  34.  
  35. #Configuring Apache2 Secuirty Settings for Multicraft
  36. sudo -E sed -i -e '166s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
  37. sudo -E service apache2 restart
  38.  
  39. #Installs php5
  40. sudo -E apt-get -y install php5 libapache2-mod-php5
  41.  
  42. #Creates Databases and User Needed for Multicraft Installation
  43. mysql -u root -p$MYSQLROOTPASS -e "create database multicraft_panel;GRANT ALL PRIVILEGES ON multicraft_panel.* TO $MYSQLMULTINAME@localhost IDENTIFIED BY '$MYSQLMULTIPASS';FLUSH PRIVILEGES;"
  44. mysql -u root -p$MYSQLROOTPASS -e "create database multicraft_daemon;GRANT ALL PRIVILEGES ON multicraft_daemon.* TO $MYSQLMULTINAME@localhost IDENTIFIED BY '$MYSQLMULTIPASS';FLUSH PRIVILEGES;"
  45.  
  46.  
  47. #Java Installation
  48. sudo -E apt-get -y install openjdk-8-jre
  49.  
  50. #Check if installation was Successful
  51. javatest() {
  52.     if hash java 2>/dev/null; then
  53.         javaresult=1
  54.     else
  55.         javaresult=0
  56.     fi
  57. }
  58.  
  59. #Install Expect
  60. sudo -E apt-get -y install expect
  61.  
  62. #Multicraft Installation
  63.  
  64. #Get Multicraft
  65. sudo -E wget http://www.multicraft.org/download?arch=linux64 -O multicraft.tar.gz
  66. sudo -E tar xvzf multicraft.tar.gz
  67. cd multicraft
  68.  
  69. #Install Multicraft
  70. expect <<- DONE
  71.   spawn sudo ./setup.sh
  72.   set timeout 10
  73.   expect {Run each Minecraft server under its own user? (Multicraft will create system users): [y]/n}
  74.   send "y\r"
  75.   expect {Run Multicraft under this user: [$USER]}
  76.   send "$MULTIUSER\r"
  77.   expect {User not found. Create user '$MULTIUSER' on start of installation? [y]/n}
  78.   send "y\r"
  79.   expect {Install Multicraft in: [/home/$MULTIUSER/multicraft]}
  80.   send "\r"
  81.   expect {If you have a license key you can enter it now: [no]}
  82.   send "$MULTIKEY\r"
  83.   expect {If you control multiple machines from one control panel you need to assign each daemon a unique ID (requires a Dynamic or custom license). Daemon ID? [1]}
  84.   send "$DAEMONID\r"
  85.   expect {Will the PHP frontend run on this machine? [y]/n}
  86.   send "y\r"
  87.   expect {User of the webserver: [www-data]}
  88.   send "\r"
  89.   expect {Location of the PHP frontend: [/var/www/multicraft]}
  90.   send "/var/www/html/panel\r"
  91.   expect {Please enter a new daemon password (use the same password in the last step of the panel installer) [none]}
  92.   send "$DAEMONPASS\r"
  93.   expect {Enable builtin FTP server? [y]/n}
  94.   send "y\r"
  95.   expect {IP the FTP server will listen on (empty for same as daemon): [$IP]}
  96.   send '$IP\r'
  97.   expect {FTP server port: [21]}
  98.   send "21\r"
  99.   expect {Block FTP upload of .jar files and other executables (potentially dangerous plugins)? [y]/n}
  100.   send "n\r"
  101.   expect {What kind of database do you want to use? [sqlite]/mysql}
  102.   send "mysql\r"
  103.   expect {Database host: [127.0.0.1]}
  104.   send '$IP\r'
  105.   expect {Database name: [multicraft_daemon]}
  106.   send "\r"
  107.   expect {Database user: [root]}
  108.   send "\r"
  109.   expect {Database password: []}
  110.   send "$DAEMONPASS\r"
  111.   expect {Path to java program: [/usr/bin/java]}
  112.   send "\r"
  113.   expect {Path to zip program: [/usr/bin/zip]}
  114.   send "\r"
  115.   expect {Path to unzip program: [/usr/bin/unzip]}
  116.   send "\r"
  117.   expect {Ready to install Multicraft. Start installation? [y]/n}
  118.   send "y\r"
  119.   expect {After reading the instructions above, press [Enter] to continue.}
  120.   send "\r"
  121.   expect {Save entered settings? ([y]/n)}
  122.   send "y\r"
  123.   expect eof
  124. DONE
  125.  
  126. #Final Output
  127. echo "------------------------------------------"
  128. echo "     Multiple Installations Complete "
  129. echo "------------------------------------------"
  130. echo ""
  131. mysqltest
  132. if [ mysqlresult = 1 ] ; then
  133.     echo -e '$GREENMySQL = Installed'
  134. else
  135.     echo -e '$REDMySQL = Failed'
  136. fi
  137. javatest
  138. if [ javaresult = 1 ] ; then
  139.     echo -e '$GREENJava = Installed'
  140. else
  141.     echo -e '$REDJava = Failed'
  142. fi
  143. echo ""
  144. echo " MySQL Info: "
  145. echo ""
  146. echo " Root Password: $MYSQLROOTPASS"
  147. echo ""
  148. echo " DB Info: "
  149. echo ""
  150. echo " DB1: multicraft_panel"
  151. echo " DB2: multicraft_daemon"
  152. echo ""
  153. echo " DB User: $MYSQLMULTINAME"
  154. echo " DB Pass: $MYSQLMULTIPASS"
  155. echo ""
  156. echo "------------------------------------------"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement