Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- #Establishing Local Variables
- MULTIUSER='multipanel'
- MULTIKEY='C0E9-844A-27A5-0744'
- MYSQLROOTPASS='$$$Test'
- DAEMONID='1'
- DAEMONPASS='$$$Test'
- MYSQLMULTINAME='enderinstaller'
- MYSQLMULTIPASS='$$$EnderInstaller'
- IP='hostname -I'
- #Color Variables
- RED="\e[38;5;198m"
- GREEN="tput setaf 2"
- #Installs MySQL Server and Client
- sudo -E debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQLROOTPASS"
- sudo -E debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQLROOTPASS"
- sudo -E apt-get -y install mysql-server mysql-client
- #Check if installation was Successful
- mysqltest() {
- if hash mysql 2>/dev/null; then
- mysqlresult=1
- else
- mysqlresult=0
- fi
- }
- #Installs Apache2 Web Service
- sudo -E apt-get -y install apache2
- #Configuring Apache2 Secuirty Settings for Multicraft
- sudo -E sed -i -e '166s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
- sudo -E service apache2 restart
- #Installs php5
- sudo -E apt-get -y install php5 libapache2-mod-php5
- #Creates Databases and User Needed for Multicraft Installation
- mysql -u root -p$MYSQLROOTPASS -e "create database multicraft_panel;GRANT ALL PRIVILEGES ON multicraft_panel.* TO $MYSQLMULTINAME@localhost IDENTIFIED BY '$MYSQLMULTIPASS';FLUSH PRIVILEGES;"
- mysql -u root -p$MYSQLROOTPASS -e "create database multicraft_daemon;GRANT ALL PRIVILEGES ON multicraft_daemon.* TO $MYSQLMULTINAME@localhost IDENTIFIED BY '$MYSQLMULTIPASS';FLUSH PRIVILEGES;"
- #Java Installation
- sudo -E apt-get -y install openjdk-8-jre
- #Check if installation was Successful
- javatest() {
- if hash java 2>/dev/null; then
- javaresult=1
- else
- javaresult=0
- fi
- }
- #Install Expect
- sudo -E apt-get -y install expect
- #Multicraft Installation
- #Get Multicraft
- sudo -E wget http://www.multicraft.org/download?arch=linux64 -O multicraft.tar.gz
- sudo -E tar xvzf multicraft.tar.gz
- cd multicraft
- #Install Multicraft
- expect <<- DONE
- spawn sudo ./setup.sh
- set timeout 10
- expect {Run each Minecraft server under its own user? (Multicraft will create system users): [y]/n}
- send "y\r"
- expect {Run Multicraft under this user: [$USER]}
- send "$MULTIUSER\r"
- expect {User not found. Create user '$MULTIUSER' on start of installation? [y]/n}
- send "y\r"
- expect {Install Multicraft in: [/home/$MULTIUSER/multicraft]}
- send "\r"
- expect {If you have a license key you can enter it now: [no]}
- send "$MULTIKEY\r"
- 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]}
- send "$DAEMONID\r"
- expect {Will the PHP frontend run on this machine? [y]/n}
- send "y\r"
- expect {User of the webserver: [www-data]}
- send "\r"
- expect {Location of the PHP frontend: [/var/www/multicraft]}
- send "/var/www/html/panel\r"
- expect {Please enter a new daemon password (use the same password in the last step of the panel installer) [none]}
- send "$DAEMONPASS\r"
- expect {Enable builtin FTP server? [y]/n}
- send "y\r"
- expect {IP the FTP server will listen on (empty for same as daemon): [$IP]}
- send '$IP\r'
- expect {FTP server port: [21]}
- send "21\r"
- expect {Block FTP upload of .jar files and other executables (potentially dangerous plugins)? [y]/n}
- send "n\r"
- expect {What kind of database do you want to use? [sqlite]/mysql}
- send "mysql\r"
- expect {Database host: [127.0.0.1]}
- send '$IP\r'
- expect {Database name: [multicraft_daemon]}
- send "\r"
- expect {Database user: [root]}
- send "\r"
- expect {Database password: []}
- send "$DAEMONPASS\r"
- expect {Path to java program: [/usr/bin/java]}
- send "\r"
- expect {Path to zip program: [/usr/bin/zip]}
- send "\r"
- expect {Path to unzip program: [/usr/bin/unzip]}
- send "\r"
- expect {Ready to install Multicraft. Start installation? [y]/n}
- send "y\r"
- expect {After reading the instructions above, press [Enter] to continue.}
- send "\r"
- expect {Save entered settings? ([y]/n)}
- send "y\r"
- expect eof
- DONE
- #Final Output
- echo "------------------------------------------"
- echo " Multiple Installations Complete "
- echo "------------------------------------------"
- echo ""
- mysqltest
- if [ mysqlresult = 1 ] ; then
- echo -e '$GREENMySQL = Installed'
- else
- echo -e '$REDMySQL = Failed'
- fi
- javatest
- if [ javaresult = 1 ] ; then
- echo -e '$GREENJava = Installed'
- else
- echo -e '$REDJava = Failed'
- fi
- echo ""
- echo " MySQL Info: "
- echo ""
- echo " Root Password: $MYSQLROOTPASS"
- echo ""
- echo " DB Info: "
- echo ""
- echo " DB1: multicraft_panel"
- echo " DB2: multicraft_daemon"
- echo ""
- echo " DB User: $MYSQLMULTINAME"
- echo " DB Pass: $MYSQLMULTIPASS"
- echo ""
- echo "------------------------------------------"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement