mongodb安装
#!/bin/bash
##############################################################
# File Name: install_redis.sh
# Version: V1.0
# Author: junwang
# Organization:
# Created Time : 2021-04-14 17:12:54
# Description:
##############################################################
tools_path=/server/tools
install_path=/web
THP=`grep sys/kernel/mm/transparent_hugepage/enabled /etc/rc.local -rl|wc -l`
yum install -y gcc wget
mkdir -p $tools_path
mkdir -p $install_path
# install_mongodb
install_mongodb(){
if [ $THP -le 1 ]
then
echo '
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi' >> /etc/rc.local
fi
/bin/sh /etc/rc.local
cd $tools_path && wget http://xxx/MongoDB/MongoDB-3.2.16/mongodb-linux-x86_64-rhel70-3.2.16.tgz
tar -xf mongodb-linux-x86_64-rhel70-3.2.16.tgz
mkdir -p $install_path/mongodb/bin
mkdir -p $install_path/mongodb/conf
mkdir -p $install_path/mongodb/log
mkdir -p $install_path/mongodb/data
cp -a $tools_path/mongodb-linux-x86_64-rhel70-3.2.16/bin/* $install_path/mongodb/bin
echo 'export PATH=$PATH:'$install_path'/mongodb/bin' >> /etc/profile
source /etc/profile
echo 'systemLog:
destination: file
path: "'$install_path'/mongodb/log/mongodb.log"
logAppend: true
storage:
journal:
enabled: true
dbPath: "'$install_path'/mongodb/data/"
processManagement:
fork: true
net:
port: 27017' > $install_path/mongodb/conf/mongo.conf
wget http://xxx/admin/home/caeri/MongoDB/MongoDB-3.2.16/mongod -O /etc/init.d/mongod
chmod +x /etc/init.d/mongod
/etc/init.d/mongod start
# mongod -f $install_path/mongodb/conf/mongo.conf
if [ $? -eq 0 ]
then
echo -e "###################### Mongodb installed successfully #################################### \n
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@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@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@*++======++++++++@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@=++======++++++++*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@**====****===*#@@@@@#**===****==*#@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@=+++=====++++++++=@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*++#@@@@@@#=+=*@@@@@@++=@@@@@=++#@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@=++++====++++++++=@@@@@@@@#@@@###@@@@@###@@@@@@@@@@#####@@@@@@@@@#@@##*#@@@@@@@@@####@@@@@@@@@@#####@@@@@@@@*++#@@@@@@@@#++=@@@@@=+=@@@@@*+=#@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@=++++====++++++++*@@@@@#=-.+*==+-.+*===+.-*@@@@@#++***=--+#@@#=---===+-.-#@@@@*+=*#*---++#@@*+=***+--=@@@@@@*++#@@@@@@@@@=++#@@@@=+=###*=+*@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@=++++===+++++++=@@@@@@@@+.+@@@@#-.=@@@@=.-@@@@*.-@@@@@@+.-#@@@=.-#@@@@+.-@@@*.-@@@@#..#@@@+.=@@@@@#-.+@@@@@*++#@@@@@@@@@*++#@@@@=+=#####*==*@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@#=++++==++++++=@@@@@@@@@+.=@@@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@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
"
for i in `pgrep mongod` ;do echo -e "$i `ls -l /proc/$i|grep cwd` \n `netstat -lntup|grep $i`" ;done
cd $tools_path && rm -rf *
else
echo "###################### Mongodb installed failed ####################################"
exit 1
fi
}
install_mongodb
本文来自博客园,作者:EJW,转载请注明原文链接:https://www.cnblogs.com/ejjw/p/17929139.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· 【自荐】一款简洁、开源的在线白板工具 Drawnix