Centos7.x + Mono3.x + Jexus.Net5.x 安装脚本

#!/bin/bash
 
# Version Infomation
# Build By Simple,2014,11,17
# Install&Update:
# http://security.ivannet.com/linux/shell/centos7.x_mono_jexus_default.sh
 
# 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 "   Centos7.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 wget glib2-devel libtiff libtiff-devel libjpeg libjpeg-devel giflib giflib-devel libpng libpng-devel libX11 libX11-devel freetype freetype-devel fontconfig fontconfig-devel libexif libexif-devel gcc-c++ gettext unzip zip bzip2 bzip2-devel cario cario-devel libtool* git;
}
 
# Download libgdiplus/mono/jexus
function downloadfiles(){
	echo "============================"
		echo "Download libgdiplus from github now..."
		git clone https://github.com/mono/libgdiplus.git
 
		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
 
	cd libgdiplus
	./autogen.sh --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.local << EOF
	/usr/jexus/jws start
EOF
	chmod +x /etc/rc.local
	firewall-cmd --permanent --zone=public --add-port=80/tcp
}
 
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 "   Centos7.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 wget glib2-devel libtiff libtiff-devel libjpeg libjpeg-devel giflib giflib-devel libpng libpng-devel libX11 libX11-devel freetype freetype-devel fontconfig fontconfig-devel libexif libexif-devel gcc-c++ gettext unzip zip bzip2 bzip2-devel cario cario-devel libtool* git;
}
 
# Download libgdiplus/mono/jexus
function downloadfiles(){
	echo "============================"
		echo "Download libgdiplus from github now..."
		git clone https://github.com/mono/libgdiplus.git
 
		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
 
	cd libgdiplus
	./autogen.sh --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(){
	firewall-cmd --permanent --zone=public --add-port=80/tcp
}
 
sysenviron
downloadfiles
maininstall
sysservice
# End Shell

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

发表评论

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