Centos6.x + Mono3.x + Jexus.Net5.x 脚本

#!/bin/bash
 
 
# Export Path
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
 
# Check Root
if [ $(id -u) != "0" ]; then
    echo "Error: Please use root role to install me!"
    exit 1
fi
 
# Welcome Tips
clear
echo "==============Recommend================="
echo ""
echo "========================================"
echo "CTMJ V1.0 for CentOS/RadHat Linux Server"
echo "========================================"
echo "   Centos6.x + Mono3.x + Jexus.Net5.x   "
echo "========================================"
 
# Dir Done
cd /root/
mkdir ctmj
cd ctmj/
cur_dir=$(pwd)
 
 
# Mono Version
echo "==========================="
 
input_mono_version="3.10.0"
echo "Mono:"
echo "Please input the full version what you like, excample (3.10.0)! Thanks!"
read -p "(Please input the full version):" input_mono_version
 
if [ "$input_mono_version" = "" ]; then
	echo "Error: You must input mono version!"
	exit 1
fi
 
#Jexus Version
echo "==========================="
 
input_jexus_version="5.6.3"
echo "Jexus:"
echo "Please input the full version what you like, excample (5.6.3)! Thanks!"
read -p "(Please input the full version):" input_jexus_version
 
if [ "$input_jexus_version" = "" ]; then
	echo "Error: You must input jexus version!"
	exit 1
fi
 
get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo ""
echo "Press any key to start...or Press Ctrl+c to cancel"
char=`get_char`
 
# System Environment
function sysenviron(){
	# Check Memory
	cat /etc/issue
	uname -a
	MemTotal=`free -m | grep Mem | awk '{print  $2}'`  
	echo -e "\n Memory is: ${MemTotal} MB "
 
	# Set Timezone
	rm -rf /etc/localtime
	ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 
	# Update Date
	yum install -y ntp
	ntpdate -u pool.ntp.org
	date
 
	# Update System
	yum -y update
 
	# Disable SeLinux
	if [ -s /etc/selinux/config ]; then
	sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
	fi
 
	# Install Base Packages
	yum -y install gcc gcc-c++ bison pkgconfig glib2-devel gettext make libpng-devel libjpeg-devel libtiff-devel libexif-devel giflib-devel libX11-devel freetype-devel fontconfig-devel cairo-devel;
}
 
# Download libgdiplus/mono/jexus
function downloadfiles(){
	echo "============================"
		echo "Download libgdiplus-2.10.9 now..."
		wget -c http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.9.tar.bz2
 
		echo "Download mono-$input_mono_version now..."
		wget -c http://download.mono-project.com/sources/mono/mono-$input_mono_version.tar.bz2
 
		echo "Download jexus-$input_jexus_version now..."
		wget -c http://linuxdot.net/down/jexus-$input_jexus_version.tar.gz
	echo "============================"
}
 
# Main Install
function maininstall(){
	cd $cur_dir
 
	tar jxf libgdiplus-2.10.9.tar.bz2
	cd libgdiplus-2.10.9/
	./configure --prefix=/usr
	make && make install
	ldconfig
	cd ../
 
	tar jxf mono-$input_mono_version.tar.bz2
	cd mono-$input_mono_version/
	./configure --prefix=/usr
	sed -i 's/#define HAVE_LOCALCHARSET_H 1/#define HAVE_LOCALCHARSET_H 0/g' eglib/config.h
	make && make install
	cd ../
 
	mono -V
 
	tar zxf jexus-$input_jexus_version.tar.gz
	cd jexus-$input_jexus_version/
	./install
	cd ../
	/usr/jexus/jws start
 
	echo "Install ctmj v1.0 completed!"
	echo "======================================"
	echo "         Written by Simple:)          "
	echo "       http://www.so-love.com/        "
	echo "======================================"
	echo "Here is the path:"
	echo "Mono: /usr/mono"
	echo "Jexus: /usr/jexus/"
	echo "======================================"
	echo "Here is the help for removing:"
	echo "Mono: rm -rf /usr/mono"
	echo "Jexus: rm -rf /usr/jexus/"
	echo "======================================"
	echo "Enjoy it:)"
	echo ""
}
 
# Service Option
function sysservice(){
	cat > /etc/rc.d/init.d/jexus <<EOF
#! /bin/bash
case "\$1" in
start)
  echo "Jexus Start.."
  /usr/jexus/jws start
  ;;
stop)
  echo "Jexus Stop.."
  /usr/jexus/jws stop
  ;;
restart)
  echo "Jexus Restart"
  /usr/jexus/jws restart
  ;;
status)
  /usr/jexus/jws status
  ;;
*)
  exit 1
  ;;
esac
EOF
 
	chmod +x /etc/rc.d/init.d/jexus
	chkconfig --add jexus
	echo "Service is add success, named jexus!"
	echo "Test:"
	echo "service jexus status"
	echo "Result:"
	service jexus status
}
 
sysenviron
downloadfiles
maininstall
sysservice
# End Shell

#!/bin/bash
 
 
# Export Path
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
 
# Check Root
if [ $(id -u) != "0" ]; then
    echo "Error: Please use root role to install me!"
    exit 1
fi
 
# Welcome Tips
clear
echo "========================================"
echo "CTMJ V1.0 for CentOS/RadHat Linux Server"
echo "========================================"
echo "   Centos6.x + Mono3.x + Jexus.Net5.x   "
echo "========================================"
 
# Dir Done
cd /root/
mkdir ctmj
cd ctmj/
cur_dir=$(pwd)
 
# Warning Tips
echo "###############################################"
echo "      This shell just for linux superior       "
echo "If you are a new one, Please choose anthor one!"
echo "###############################################"
 
# Mono Version
echo "==========================="
 
input_mono_version="3.10.0"
echo "Mono:"
echo "Please input the full version what you like, excample (3.10.0)! Thanks!"
read -p "(Please input the full version):" input_mono_version
 
if [ "$input_mono_version" = "" ]; then
	echo "Error: You must input mono version!"
	exit 1
fi
 
#Jexus Version
echo "==========================="
 
input_jexus_version="5.6.3"
echo "Jexus:"
echo "Please input the full version what you like, excample (5.6.3)! Thanks!"
read -p "(Please input the full version):" input_jexus_version
 
if [ "$input_jexus_version" = "" ]; then
	echo "Error: You must input jexus version!"
	exit 1
fi
 
get_char()
{
SAVEDSTTY=`stty -g`
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo ""
echo "Press any key to start...or Press Ctrl+c to cancel"
char=`get_char`
 
# System Environment
function sysenviron(){
	# Check Memory
	cat /etc/issue
	uname -a
	MemTotal=`free -m | grep Mem | awk '{print  $2}'`  
	echo -e "\n Memory is: ${MemTotal} MB "
 
	# Set Timezone
	rm -rf /etc/localtime
	ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
 
	# Update Date
	yum install -y ntp
	ntpdate -u pool.ntp.org
	date
 
	# Update System
	yum -y update
 
	# Disable SeLinux
	if [ -s /etc/selinux/config ]; then
	sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
	fi
 
	# Install Base Packages
	yum -y install gcc gcc-c++ bison pkgconfig glib2-devel gettext make libpng-devel libjpeg-devel libtiff-devel libexif-devel giflib-devel libX11-devel freetype-devel fontconfig-devel cairo-devel;
}
 
# Download libgdiplus/mono/jexus
function downloadfiles(){
	echo "============================"
		echo "Download libgdiplus-2.10.9 now..."
		wget -c http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.9.tar.bz2
 
		echo "Download mono-$input_mono_version now..."
		wget -c http://download.mono-project.com/sources/mono/mono-$input_mono_version.tar.bz2
 
		echo "Download jexus-$input_jexus_version now..."
		wget -c http://linuxdot.net/down/jexus-$input_jexus_version.tar.gz
	echo "============================"
}
 
# Main Install
function maininstall(){
	cd $cur_dir
 
	tar jxf libgdiplus-2.10.9.tar.bz2
	cd libgdiplus-2.10.9/
	./configure --prefix=/opt/mono
	make && make install
	echo "/opt/mono/lib" > /etc/ld.so.conf.d/mono.conf
	ldconfig
	cd ../
 
	tar jxf mono-$input_mono_version.tar.bz2
	cd mono-$input_mono_version/
	./configure --prefix=/opt/mono
	sed -i 's/#define HAVE_LOCALCHARSET_H 1/#define HAVE_LOCALCHARSET_H 0/g' eglib/config.h
	make && make install
	echo export PKG_CONFIG_PATH=/opt/mono/lib/pkgconfig:$PKG_CONFIG_PATH>>~/.bash_profile
	echo export LD_LIBRARY_PATH=/opt/mono/lib:$LD_LIBRARY_PATH>>~/.bash_profile
	echo export PATH=/opt/mono/bin:$PATH>>~/.bash_profile
	source ~/.bash_profile
	cd ../
 
	mono -V
 
	tar zxf jexus-$input_jexus_version.tar.gz
	cd jexus-$input_jexus_version/
	mkdir /usr/local/jexus/
	./install /usr/local/jexus/
	cd ../
	/usr/local/jexus/jws start
 
	echo "Install ctmj v1.0 completed!"
	echo "======================================"
	echo "         Written by Simple:)          "
	echo "       http://www.so-love.com/        "
	echo "======================================"
	echo "Here is the path:"
	echo "Mono: /opt/mono"
	echo "Jexus: /usr/local/jexus/"
	echo "======================================"
	echo "Here is the help for removing:"
	echo "Mono: rm -rf /opt/mono"
	echo "Jexus: rm -rf /usr/local/jexus/"
	echo "======================================"
	echo "Enjoy it:)"
	echo ""
}
 
# Service Option
function sysservice(){
	cat > /etc/rc.d/init.d/jexus <<EOF
#! /bin/bash
case "\$1" in
start)
  echo "Jexus Start.."
  /usr/local/jexus/jws start
  ;;
stop)
  echo "Jexus Stop.."
  /usr/local/jexus/jws stop
  ;;
restart)
  echo "Jexus Restart"
  /usr/local/jexus/jws restart
  ;;
status)
  /usr/local/jexus/jws status
  ;;
*)
  exit 1
  ;;
esac
EOF
 
	chmod +x /etc/rc.d/init.d/jexus
	# chkconfig --add jexus
	echo "Service is add success, named jexus!"
	echo "Test:"
	echo "service jexus status"
	echo "Result:"
	service jexus status
	echo ""
}
 
sysenviron
downloadfiles
maininstall
sysservice
# End Shell

还没有评论,快来抢沙发!

发表评论

  • 😉
  • 😐
  • 😡
  • 😈
  • 🙂
  • 😯
  • 🙁
  • 🙄
  • 😛
  • 😳
  • 😮
  • emoji-mrgree
  • 😆
  • 💡
  • 😀
  • 👿
  • 😥
  • 😎
  • ➡
  • 😕
  • ❓
  • ❗
  • 68 queries in 0.416 seconds