Update install-multicraft.sh
This commit is contained in:
@@ -16,13 +16,13 @@ IP="$(curl -4 icanhazip.com)"
|
||||
|
||||
# Password Generator
|
||||
# MySQL, Multicraft Daemon, Multicraft Panel, Multicraft Admin, phpMyAdmin BlowFish Secret
|
||||
export MySQLRoot=`cat /dev/urandom | tr -dc A-Za-z0-9 | dd bs=25 count=1 2>/dev/null`
|
||||
export Daemon=`cat /dev/urandom | tr -dc A-Za-z0-9 | dd bs=25 count=1 2>/dev/null`
|
||||
export Panel=`cat /dev/urandom | tr -dc A-Za-z0-9 | dd bs=25 count=1 2>/dev/null`
|
||||
export MySQLPWD=`cat /dev/urandom | tr -dc A-Za-z0-9 | dd bs=25 count=1 2>/dev/null`
|
||||
export DaemonPassword=`cat /dev/urandom | tr -dc A-Za-z0-9 | dd bs=25 count=1 2>/dev/null`
|
||||
export AdminPassword=`cat /dev/urandom | tr -dc A-Za-z0-9 | dd bs=25 count=1 2>/dev/null`
|
||||
export BlowFish=`cat /dev/urandom | tr -dc A-Za-z0-9 | dd bs=32 count=1 2>/dev/null`
|
||||
|
||||
MYSQLPARAM='mysql -H 10.5.10.56 -P 3307 -u root -p'
|
||||
|
||||
|
||||
|
||||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8507EFA5
|
||||
@@ -37,34 +37,19 @@ add-apt-repository -y ppa:ondrej/php
|
||||
${APTFUNC} update
|
||||
${APTFUNC} -y upgrade
|
||||
export DEBIAN_FRONTEND="noninteractive"
|
||||
${APTFUNC} -y install apache2 php5.6 php5.6-mysqlnd sqlite php5.6-gd php5.6-mbstring php5.6-xml php5.6-curl php5.6-sqlite wget nano zip unzip percona-server-server-5.6 git dos2unix
|
||||
${APTFUNC} -y install apache2 php5.6 php5.6-mysqlnd sqlite php5.6-gd php5.6-mbstring php5.6-xml php5.6-curl php5.6-sqlite wget nano zip unzip git dos2unix
|
||||
|
||||
|
||||
/sbin/service mysql start
|
||||
service mysql start
|
||||
mysql -e "SET PASSWORD FOR 'root'@'localhost' = PASSWORD('${MySQLRoot}');"
|
||||
|
||||
# Save Generated MySQL Root Password.
|
||||
cd /root/
|
||||
cat > .my.cnf << eof
|
||||
[client]
|
||||
user="root"
|
||||
password="${MySQLRoot}"
|
||||
eof
|
||||
|
||||
# Multicraft Databases
|
||||
mysql -e "CREATE DATABASE daemon;"
|
||||
mysql -e "CREATE DATABASE panel;"
|
||||
mysql -e "GRANT ALL ON daemon.* to daemon@localhost IDENTIFIED BY '${Daemon}';"
|
||||
mysql -e "GRANT ALL ON panel.* to panel@localhost IDENTIFIED BY '${Panel}';"
|
||||
mysql -e "GRANT ALL ON daemon.* to daemon@'%' IDENTIFIED BY '${Daemon}';"
|
||||
mysql -e "GRANT ALL ON panel.* to panel@'%' IDENTIFIED BY '${Panel}';"
|
||||
${MYSQLPARAM} -e "CREATE DATABASE multicraft_daemon;"
|
||||
${MYSQLPARAM} -e "CREATE DATABASE multicraft_panel;"
|
||||
${MYSQLPARAM} -e "GRANT ALL ON multicraft_daemon.* to multicraft@'%' IDENTIFIED BY '${MySQLPWD}';"
|
||||
${MYSQLPARAM} -e "GRANT ALL ON multicraft_panel.* to multicraft@'%' IDENTIFIED BY '${MySQLPWD}';"
|
||||
|
||||
WebRoot="/var/www/html"
|
||||
|
||||
# Multicraft Download
|
||||
mkdir /home/root/
|
||||
cd /home/root/
|
||||
cd /opt/
|
||||
wget --no-check-certificate http://multicraft.org/download/linux64 -O multicraft.tar.gz
|
||||
tar -xf multicraft.tar.gz
|
||||
rm -fv multicraft.tar.gz
|
||||
@@ -81,7 +66,7 @@ rm -fv multicraft-jar-confs.zip
|
||||
wget http://s3.amazonaws.com/MCProHosting-Misc/Spigot/Spigot.jar -O Spigot.jar
|
||||
wget http://s3.amazonaws.com/MCProHosting-Misc/PaperSpigot/PaperSpigot.jar -O PaperSpigot.jar
|
||||
wget http://ci.md-5.net/job/BungeeCord/lastSuccessfulBuild/artifact/bootstrap/target/BungeeCord.jar -O Bungeecord.jar
|
||||
cd /home/root/multicraft/
|
||||
cd /opt/multicraft/
|
||||
|
||||
# Multicraft Panel
|
||||
ProtectedConf="/protected/config/config.php"
|
||||
@@ -89,19 +74,10 @@ cd ${WebRoot}/multicraft/
|
||||
mv protected /
|
||||
mv ${ProtectedConf}.dist ${ProtectedConf}
|
||||
chmod 777 assets
|
||||
chmod 777 /protected/runtime/
|
||||
chmod 777 ${ProtectedConf}
|
||||
chmod -rf 777 /protected
|
||||
sed -i 's/dirname(__FILE__)./\E/g' index.php
|
||||
rm -fv api.php install.php
|
||||
|
||||
# Automated phpMyAdmin Installer
|
||||
cd ${WebRoot}/
|
||||
git clone --depth=1 --branch=STABLE git://github.com/phpmyadmin/phpmyadmin.git phpMyAdmin
|
||||
mv ${WebRoot}/phpMyAdmin/config.sample.inc.php ${WebRoot}/phpMyAdmin/config.inc.php
|
||||
sed -i "s/\$cfg\[.blowfish_secret.\]\s*=.*/\$cfg['blowfish_secret'] = '${BlowFish}';/" ${WebRoot}/phpMyAdmin/config.inc.php
|
||||
cd ${WebRoot}/phpMyAdmin/
|
||||
wget https://getcomposer.org/composer.phar -O composer.phar
|
||||
php composer.phar update --no-dev
|
||||
|
||||
# php.ini Auto-Detector
|
||||
PHP="$(php -r "echo php_ini_loaded_file();")"
|
||||
@@ -119,17 +95,17 @@ MemTotal="$(awk '/MemTotal/ {print $2}' /proc/meminfo)"
|
||||
Memory="$((${MemTotal} / 1024))"
|
||||
|
||||
# Multicraft Config
|
||||
MulticraftConf="/home/root/multicraft/multicraft.conf"
|
||||
sed -i 's/user =\(.*\)/\Euser = root/g' ${MulticraftConf}
|
||||
MulticraftConf="/opt/multicraft/multicraft.conf"
|
||||
sed -i 's/user =\(.*\)/\Euser = www-data/g' ${MulticraftConf}
|
||||
sed -i 's/webUser =\(.*\)/\EwebUser = /g' ${MulticraftConf}
|
||||
sed -i 's/\#id =\(.*\)/\Eid = 1/g' ${MulticraftConf}
|
||||
sed -i 's/\#database = mysql\(.*\)/\Edatabase = mysql:host=127.0.0.1;dbname=daemon/g' ${MulticraftConf}
|
||||
sed -i 's/\#dbUser =\(.*\)/\EdbUser = daemon/g' ${MulticraftConf}
|
||||
sed -i "s/\#dbPassword =\(.*\)/\EdbPassword = ${Daemon}/g" ${MulticraftConf}
|
||||
sed -i 's/\#database = mysql\(.*\)/\Edatabase = mysql:host=10.5.10.56:3307;dbname=multicraft_daemon/g' ${MulticraftConf}
|
||||
sed -i 's/\#dbUser =\(.*\)/\EdbUser = multicraft/g' ${MulticraftConf}
|
||||
sed -i "s/\#dbPassword =\(.*\)/\EdbPassword = ${MySQLPWD}/g" ${MulticraftConf}
|
||||
sed -i "s/\#password =\(.*\)/\Epassword = ${DaemonPassword}/g" ${MulticraftConf}
|
||||
sed -i 's/\#name =\(.*\)/\Ename = Server 1/g' ${MulticraftConf}
|
||||
sed -i "s/#totalMemory =\(.*\)/\EtotalMemory = ${Memory}/g" ${MulticraftConf}
|
||||
sed -i "s/\(.*\)baseDir =\(.*\)/\EbaseDir = \/home\/root\/multicraft\//g" ${MulticraftConf}
|
||||
sed -i "s/\(.*\)baseDir =\(.*\)/\EbaseDir = \/opt\/multicraft\//g" ${MulticraftConf}
|
||||
sed -i 's/\#multiuser =\(.*\)/\Emultiuser = true/g' ${MulticraftConf}
|
||||
sed -i "s/\(.*\)forbiddenFiles\(.*\)/\#forbiddenFiles = /g" ${MulticraftConf}
|
||||
sed -i "s/\ip = 127.0.0.1/\Eip = ${IP}/g" ${MulticraftConf}
|
||||
@@ -139,8 +115,8 @@ cd /protected/config/
|
||||
cat > config.php << eof
|
||||
<?php
|
||||
return array (
|
||||
'panel_db' => 'mysql:host=localhost;dbname=panel',
|
||||
'daemon_db' => 'mysql:host=localhost;dbname=daemon',
|
||||
'panel_db' => 'mysql:host=10.5.10.56:3307;dbname=multicraft_panel',
|
||||
'daemon_db' => 'mysql:host=10.5.10.56:3307;dbname=dmulticraft_aemon',
|
||||
'daemon_password' => '${DaemonPassword}',
|
||||
'superuser' => 'admin',
|
||||
'api_enabled' => false,
|
||||
@@ -170,11 +146,11 @@ return array (
|
||||
'sqlitecache_schema' => false,
|
||||
'sqlitecache_commands' => false,
|
||||
'user_mysql' => true,
|
||||
'user_mysql_host' => 'localhost',
|
||||
'user_mysql_user' => 'root',
|
||||
'user_mysql_pass' => '${MySQLRoot}',
|
||||
'user_mysql_host' => '10.5.10.56:3307',
|
||||
'user_mysql_user' => 'sqluser',
|
||||
'user_mysql_pass' => 'dcs2057',
|
||||
'user_mysql_prefix' => 'db_',
|
||||
'user_mysql_admin' => 'http://${IP}/phpMyAdmin/index.php',
|
||||
'user_mysql_admin' => 'https://pma.scity.us/index.php',
|
||||
'show_repairtool' => 'superuser',
|
||||
'register_disabled' => true,
|
||||
'reset_token_hours' => '0',
|
||||
@@ -199,10 +175,10 @@ return array (
|
||||
'kill_button' => 'superuser',
|
||||
'fill_port_gaps' => true,
|
||||
'support_legacy_daemons' => false,
|
||||
'panel_db_user' => 'panel',
|
||||
'panel_db_pass' => '${Panel}',
|
||||
'daemon_db_user' => 'daemon',
|
||||
'daemon_db_pass' => '${Daemon}',
|
||||
'panel_db_user' => 'multicraft',
|
||||
'panel_db_pass' => '${DaemonPassword}',
|
||||
'daemon_db_user' => 'multicraft',
|
||||
'daemon_db_pass' => '${DaemonPassword}',
|
||||
'min_pw_length' => '',
|
||||
'default_displayed_ip' => '',
|
||||
'support_legacy_api' => false,
|
||||
@@ -223,37 +199,28 @@ java -version
|
||||
# Restart Services
|
||||
service apache2 stop
|
||||
service apache2 start
|
||||
/sbin/service httpd stop
|
||||
/sbin/service httpd start
|
||||
|
||||
# Output Vars
|
||||
cd /root/
|
||||
cat > logins.conf << eof
|
||||
# Stored Passwords
|
||||
MySQL Root Password: ${MySQLRoot}
|
||||
Multicraft Daemon: ${Daemon}
|
||||
Multicraft Panel: ${Panel}
|
||||
MySQL Password: ${MySQLPWD}
|
||||
|
||||
# Control Panel Link:
|
||||
http://${IP}/multicraft/index.php
|
||||
Username: admin
|
||||
Password: ${AdminPassword}
|
||||
|
||||
# phpMyAdmin Link
|
||||
http://${IP}/phpMyAdmin/index.php
|
||||
Username: root
|
||||
Password: ${MySQLRoot}
|
||||
eof
|
||||
|
||||
cat /root/logins.conf
|
||||
|
||||
# Automatically Import MySQL Database Schema's, thus removing the web installer. :)
|
||||
mysql -p${Panel} -u panel -D panel < /protected/data/panel/schema.mysql.sql
|
||||
mysql -p${Daemon} -u daemon -D daemon < /protected/data/daemon/schema.mysql.sql
|
||||
${MYSQLPARAM} -D multicraft_panel < /protected/data/panel/schema.mysql.sql
|
||||
${MYSQLPARAM} -D multicraft_daemon < /protected/data/daemon/schema.mysql.sql
|
||||
|
||||
# Daemon MySQL Changes
|
||||
mysql -p${Daemon} -u daemon -D daemon -e "INSERT INTO setting VALUES ('defaultServerIp', '1');"
|
||||
mysql -p${Daemon} -u daemon -D daemon -e "INSERT INTO setting VALUES ('minecraftEula', 'auto');"
|
||||
${MYSQLPARAM} -D multicraft_daemon -e "INSERT INTO setting VALUES ('defaultServerIp', '1');"
|
||||
${MYSQLPARAM} -D multicraft_daemon -e "INSERT INTO setting VALUES ('minecraftEula', 'auto');"
|
||||
|
||||
# Auto Start
|
||||
mv /etc/rc.local /etc/rc.local-old
|
||||
@@ -272,14 +239,10 @@ chmod +x /etc/rc.local
|
||||
chmod +x /etc/rc.d/rc.local
|
||||
/etc/rc.local
|
||||
|
||||
# Fix Remote MySQL Issues for Multicraft
|
||||
mysql -e "SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('${MySQLRoot}');"
|
||||
mysql -Dmysql -e "DELETE FROM user WHERE Password='';"
|
||||
mysql -Dmysql -e "DROP USER ''@'%';"
|
||||
mysql -Dmysql -e "FLUSH PRIVILEGES;"
|
||||
${MYSQLPARAM} -Dmysql -e "FLUSH PRIVILEGES;"
|
||||
|
||||
# Configure New Admin Password
|
||||
SaltPassword="$(python -c "import crypt, getpass, pwd; \
|
||||
print crypt.crypt('${AdminPassword}', '\$6\$saltsalt\$')")"
|
||||
mysql -p${Panel} -u panel -D panel -e "UPDATE user SET password='${SaltPassword}' WHERE name='admin';"
|
||||
mysql -p${Daemon} -u daemon -D daemon -e "UPDATE ftp_user SET password='${SaltPassword}' WHERE name='admin';"
|
||||
${MYSQLPARAM} -D multicraft_panel -e "UPDATE user SET password='${SaltPassword}' WHERE name='admin';"
|
||||
${MYSQLPARAM} -D multicraft_daemon -e "UPDATE ftp_user SET password='${SaltPassword}' WHERE name='admin';"
|
||||
Reference in New Issue
Block a user