APT_PATH=/usr/bin/apt-get
WGET_PATH=/usr/bin/wget
MKDIR_PATH=/bin/mkdir
CLEAR_PATH=/usr/bin/clear
ECHO_PATH=/bin/echo
PRINTF_PATH=/usr/bin/printf
TAR_PATH=/bin/tar
PHP_PATH=/usr/bin/php
P7Z_PATH=/usr/bin/7z
DPKG_PATH=/usr/bin/dpkg
PRELOG=/tmp/install.log
MIRROR=http://talisman.servertalks.com/
function status {
echo $1;
}
function _info_msg() {
$CLEAR_PATH
_header
$ECHO_PATH " | |"
$ECHO_PATH " | Welcome to Talisman Online installer V.3.1.0 by Bharat B |"
$ECHO_PATH " | Instructions are located at the following link: |"
$ECHO_PATH " |
Bala Bharat | Facebook |"
$ECHO_PATH " | |"
$ECHO_PATH " | Hit [ENTER] to continue or ctrl+c to exit |"
$ECHO_PATH " | |"
status " o----------------------------------------------------------------o\n"
read entcs
$CLEAR_PATH
}
function install {
DEBIAN_FRONTEND=noninteractive apt-get -q -y install "$1"
apt-get clean
}
function _header() {
status " o----------------------------------------------------------------o\n"
status " | :: Talisman Installer v3.1.0 BHARAT B |\n"
status " o----------------------------------------------------------------o\n"
}
_info_msg
if [ `id -u` != "0" ]; then
status "You need to be be the root user to run this installer."
exit
fi
if [ `uname -m` != "i686" ]; then
status "You need to download our 64 bit installer for this operating system"
exit
fi
_header
status "Fetching updates..."
apt-get update >> $PRELOG 2>&1
status "Please Wait, Installing Dependencies for Talisman Online...";
install="nano apache2 libapache2-mod-php5 libapache2-mod-auth-mysql php5 php5-mysql php5-gd php5-imagick php5-mcrypt php5-cli php5-curl mysql-server rar p7zip-full libwww-perl sendmail gnome-core ubuntu-desktop vnc4server"
for program in $install
do
install $program
y=$(($y + 1));
status "Installing dependency : $y of 19"
done
apt-get clean
status "Configuring MySQL Server"
/etc/init.d/mysql stop >> /dev/null 2>&1
invoke-rc.d mysql stop >> /dev/null 2>&1
status "Generating secure MySQL password"
/etc/init.d/mysql start >> /dev/null 2>&1
mysqlpassword=$(< /dev/urandom tr -dc A-Z-a-z-0-9 | head -c${1:-32}
mysqladmin -u root password $mysqlpassword >> $PRELOG 2>&1
while ! mysql -u root -p$mysqlpassword -e ";" ; do
status "Unfortunately mysql failed to install correctly.".
done
status "MySQL password generated and secured"
status "Configuring database"
mysql -uroot -p$mysqlpassword --execute "CREATE DATABASE db_misc;CREATE DATABASE db_account;CREATE DATABASE db_game;CREATE DATABASE db_log;" >> $PRELOG 2>&1
$WGET_PATH $MIRROR/db_account.txt -O /tmp/db_account.txt >> $PRELOG 2>&1
mv /tmp/db_account.txt /tmp/db_account.sql >> $PRELOG 2>&1
mysql -uroot -p$mysqlpassword db_account < /tmp/db_account.sql >> $PRELOG 2>&1
status "Configuring database successfull"
status "Downloading required files & libraries"
$WGET_PATH $MIRROR/server.7z -O /tmp/server.7z >> /dev/null 2>&1
$WGET_PATH $MIRROR/lib.deb -O /tmp/lib.deb >> /dev/null 2>&1
$WGET_PATH $MIRROR/navicat100_lite_en.tar.gz -O /tmp/navicat100_lite_en.tar.gz >> /dev/null 2>&1
mkdir /root/navicat
tar -zxvf /tmp/navicat100_lite_en.tar.gz -C /root/navicat >> /dev/null 2>&1
status "Installing libraries and arranging files";
$DPKG_PATH -i /tmp/lib.deb >> /dev/null 2>&1 && rm /tmp/lib.deb
$P7Z_PATH -y x /tmp/server.7z -o/root/ >> /dev/null 2>&1 && rm /tmp/server.7z
status "Configuring db_server"
replace "username" "root" -- /root/db/db_server_user.ini >> $PRELOG 2>&1
replace "password" $mysqlpassword -- /root/db/db_server_user.ini >> $PRELOG 2>&1
status "Configuring db_server completed"
while [[ -z "$s_name" ]]
do
read -p "Please enter your server's name: " s_name
done
$WGET_PATH $MIRROR/ip.php -O /tmp/ip.txt >> $PRELOG 2>&1
ip=$(cat /tmp/ip.txt);
status "Please wait... Configuring login_server & game_server"
replace "WAN IP" $ip -- /root/login/login_user.ini /root/game/server_user.ini >> $PRELOG 2>&1
replace "LAN IP" $ip -- /root/login/login_user.ini /root/game/server_user.ini >> $PRELOG 2>&1
replace "server_name" "$s_name" -- /root/game/server_user.ini >> $PRELOG 2>&1
status "Configuring login_server & game_server completed"
status "Please wait... Configuring Webserver"
mkdir /root/public_html >> $PRELOG 2>&1
$WGET_PATH $MIRROR/webconfig.txt >> $PRELOG 2>&1
rm /etc/apache2/sites-available/default && cp webconfig.txt default >> $PRELOG 2>&1
mv default /etc/apache2/sites-available/
chmod o+x /etc/apache2/sites-available/
chmod o+x /root -R
a2enmod rewrite >> $PRELOG 2>&1
service apache2 restart >> $PRELOG 2>&1
rm webconfig.txt
status "Configuring Webserver completed"
status "Please Configure vncserver"
while [[ -z "$vnc_pwd" ]]
do
read -p "Enter password for your vnc :" vnc_pwd
done
while [[ -z "$vnc_port" ]]
do
read -p "Which port do you want to put for vnc ?: " vnc_port
done
crontab -l > file; echo '@reboot sudo vncserver :'$vnc_port' -geometry 1280x720' >> file; crontab file >> /dev/null 2>&1 && rm file
echo -e "$vnc_pwd\n$vnc_pwd" | vncserver :1 -geometry 1280x720
vncserver -kill :1 >> /dev/null 2>&1
rm ~/.vnc/xstartup >> /dev/null 2>&1
$WGET_PATH $MIRROR/vncconfig.txt >> /dev/null 2>&1
cp vncconfig.txt xstartup && rm vncconfig.txt
mv xstartup ~/.vnc/
chmod o+x /root -R
echo -e "$vnc_pwd\n$vnc_pwd" | vncserver :$vnc_port -geometry 1280x720 2>&1
status "Configuring vncserver completed"
status "All necessary installation has been done ! Thank you for using Talisman Installer, Donate us on paypal
sixtorz@yahoo.com";
status "Your MySQL User is root"
status "Your MySQL Password is $mysqlpassword"
status "Your vncport is $vnc_port"
status "Your vnc password is $vnc_pwd"
status "Put your website files in /root/public_html"
mv /tmp/install.log /root/
VPS SCRIPT