diff --git a/README.md b/README.md index 7f18ff9..e1187f4 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ * JDK 安装和配置:| [CODES](codes/deploy/tool/jdk) | [DOCS](docs/deploy/tool/jdk/install-jdk.md) | * Maven 安装和配置:| [CODES](codes/deploy/tool/maven) | [DOCS](docs/deploy/tool/maven/install-maven.md) | +* Mongodb 安装和配置:| [CODES](codes/deploy/tool/mongodb) | [DOCS](docs/deploy/tool/mongodb/install-mongodb.md) | * Nginx 安装和配置:| [CODES](codes/deploy/tool/nginx) | [DOCS](docs/deploy/tool/nginx/install-nginx.md) | * Nodejs 安装和配置:| [CODES](codes/deploy/tool/nodejs) | [DOCS](docs/deploy/tool/nodejs/install-nodejs.md) | * Redis 安装和配置:| [CODES](codes/deploy/tool/redis) | [DOCS](docs/deploy/tool/redis/install-redis.md) | diff --git a/codes/deploy/main.sh b/codes/deploy/main.sh index f2c7dc3..905289b 100644 --- a/codes/deploy/main.sh +++ b/codes/deploy/main.sh @@ -54,7 +54,7 @@ cat << EOF [jdk8] install jdk8 [maven] install maven [tomcat] install tomcat8 [nginx] install nginx [nodejs] install node.js [elk] install elk - [redis] install redis + [redis] install redis [mongodb] install mongodb 【3 - Recommended Tools】 [sdk] install sdkman @@ -86,6 +86,7 @@ function chooseOper() { tomcat ) ${filepath}/tool/tomcat/install-tomcat8.sh;; elk ) ${filepath}/tool/elk/install-elk.sh;; redis ) ${filepath}/tool/redis/install-redis.sh;; + mongodb ) ${filepath}/tool/mongodb/install-mongodb.sh;; # 3 - Recommended Tools sdk ) ${filepath}/tool/sdk/install-sdk.sh;; diff --git a/codes/deploy/tool/mongodb/README.md b/codes/deploy/tool/mongodb/README.md new file mode 100644 index 0000000..3c4f0f5 --- /dev/null +++ b/codes/deploy/tool/mongodb/README.md @@ -0,0 +1,11 @@ +# 安装 mongodb + +使用方法: + +```sh +wget --no-check-certificate --no-cookies https://raw.githubusercontent.com/dunwu/linux/master/codes/deploy/tool/mongodb/install-mongodb.sh +chmod -R 777 install-mongodb.sh +./install-mongodb.sh +``` + +脚本会下载解压 redis 到 `/opt/software/mongodb` 路径下。 diff --git a/codes/deploy/tool/mongodb/install-mongodb.sh b/codes/deploy/tool/mongodb/install-mongodb.sh new file mode 100644 index 0000000..d2c5976 --- /dev/null +++ b/codes/deploy/tool/mongodb/install-mongodb.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +################################################################################### +# 安装 mongodb 脚本 +# 适用于所有 linux 发行版本。 +# Author: Zhang Peng +################################################################################### + +echo -e "\n>>>>>>>>> install mongodb" + +# 下载并解压 mongodb +root=/opt/software/mongodb +version=3.6.3 +mkdir -p ${root} +wget -O ${root}/mongodb-linux-x86_64-${version}.tgz https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-${version}.tgz +cd ${root} +tar zxvf mongodb-linux-x86_64-${version}.tgz +mv mongodb-linux-x86_64-${version} mongodb-${version} + +mkdir -p /data/db diff --git a/docs/deploy/tool/mongodb/install-mongodb.md b/docs/deploy/tool/mongodb/install-mongodb.md new file mode 100644 index 0000000..211b692 --- /dev/null +++ b/docs/deploy/tool/mongodb/install-mongodb.md @@ -0,0 +1,41 @@ +# Mongodb 安装 + +## 安装 + +安装步骤如下: + +(1)下载并解压到本地 + +进入官网下载地址:https://www.mongodb.com/download-center#community ,选择合适的版本下载。 + +我选择的是最新稳定版本 3.6.3:https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.3.tgz + +我个人喜欢存放在:`/opt/software/mongodb` + +``` +wget -O /opt/software/mongodb/mongodb-linux-x86_64-3.6.3.tgz https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.6.3.tgz +cd /opt/software/mongodb +tar zxvf mongodb-linux-x86_64-3.6.3.tgz +mv mongodb-linux-x86_64-3.6.3 mongodb-3.6.3 +mkdir -p /data/db +``` + +## 启动 + +**启动 mongodb 服务** + +``` +cd /opt/software/mongodb/mongodb-3.6.3/bin +./mongod --dbpath=/data/db +``` + +**启动 mongodb 客户端** + +``` +cd /opt/software/mongodb/mongodb-3.6.3/bin +./mongo +``` + +## 脚本 + +| [安装脚本](https://github.com/dunwu/linux/tree/master/codes/deploy/tool/mongodb) |