Mongodb 安装脚本(附服务器自启动)((2))

shell脚本

#!/bin/bash
#mail:xuel@anchnet.com
#function:auto install mongodb
[ $(id -u) != "0" ] && echo "Error: You must be root to run this script" && exit 1
logfile="/var/log/mongod_install.log"
softdir="/software"
installdir="/usr/local"
sys_version=$(rpm -q centos-release|cut -d- -f3)
clear
echo "##########################################"
echo "#  Auto Install mongodb for centos6/7.x ##"
echo "#       Press Ctrl + C to cancel        ##"
echo "#       Any key to continue             ##"
echo "##########################################"
echo "(1) Install Mongodb-3.2"
echo "(2) Install Mongodb-3.4"
echo "(3) Install Mongodb-3.6"
echo "(4) EXIT"
read -p "Please input your choice:" NUM
if [ ${sys_version} == "6" ];then
	case $NUM in 
	1)
	       mongodb_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.2.20.tgz"	
	       software_version="mongodb-3.2"
	;;
	2)
	       mongodb_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.4.10.tgz"
	       software_version="mongodb-3.4"
	;;
	3)
	       mongodb_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.6.5.tgz"
	       software_version="mongodb-3.6"
	;;
	4)
	       echo -e "\033[41;37m You choice channel! \033[0m" && exit 0
	;;
	*)
	       echo -e "\033[41;37m Input Error! Place input{1|2|3|4} \033[0m" && exit 1
	;;
	esac
elif [ ${sys_version} == "7" ];then
	case $NUM in 
	1)
	       mongodb_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.2.20.tgz"	
	       software_version="mongodb-3.2"
	;;
	2)
	       mongodb_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.4.10.tgz"
	       software_version="mongodb-3.4"
	;;
	3)
	       mongodb_url="https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值