From 1535ae1299d59d3c62f7d93142dc29bfa220a8e6 Mon Sep 17 00:00:00 2001 From: Zhang Peng Date: Tue, 7 May 2019 15:21:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codes/linux/ops/soft/README.md | 29 ++++++++++++++++++- codes/linux/ops/soft/main.sh | 4 ++- .../install-mongodb.sh => mongodb-install.sh} | 23 ++++++++++----- codes/linux/ops/soft/mongodb/README.md | 9 ------ ...tall-zookeeper.sh => zookeeper-install.sh} | 23 +++++++++++---- codes/linux/ops/soft/zookeeper/README.md | 9 ------ 6 files changed, 64 insertions(+), 33 deletions(-) rename codes/linux/ops/soft/{mongodb/install-mongodb.sh => mongodb-install.sh} (63%) delete mode 100644 codes/linux/ops/soft/mongodb/README.md rename codes/linux/ops/soft/{zookeeper/install-zookeeper.sh => zookeeper-install.sh} (66%) delete mode 100644 codes/linux/ops/soft/zookeeper/README.md diff --git a/codes/linux/ops/soft/README.md b/codes/linux/ops/soft/README.md index e1402da..e5fceb8 100644 --- a/codes/linux/ops/soft/README.md +++ b/codes/linux/ops/soft/README.md @@ -61,6 +61,21 @@ curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/nodejs-install.sh | bash ``` +## MongoDB 安装 + +说明: + +下载 mongodb `4.0.9` 并解压安装到 `/opt/mongodb` 路径下。 + +使用方法: + +执行以下任意命令即可执行安装脚本。 + +```sh +curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/mongodb-install.sh | bash +wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/mongodb-install.sh | bash +``` + ## Redis 安装 说明: @@ -115,4 +130,16 @@ curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/rocketmq-install.sh | bash ``` -脚本会下载解压 kafka 到 `/opt/kafka` 路径下。 +## ZooKeeper 安装 + +说明: + +下载 zookeeper `3.4.12` 并解压安装到 `/opt/zookeeper` 路径下。 + +使用方法:执行以下任意命令即可执行脚本。 + +```sh +curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/zookeeper-install.sh | bash +wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/zookeeper-install.sh | bash +``` + diff --git a/codes/linux/ops/soft/main.sh b/codes/linux/ops/soft/main.sh index b8eb8f4..fff6256 100644 --- a/codes/linux/ops/soft/main.sh +++ b/codes/linux/ops/soft/main.sh @@ -11,7 +11,7 @@ EOF path=$(cd "$(dirname "$0")"; pwd) PS3="Please select script type: " -select item in "git" "zsh" "jdk" "maven" "nodejs" "redis" "tomcat" "kafka" "rocketmq" +select item in "git" "zsh" "jdk" "maven" "nodejs" "mongodb" "redis" "tomcat" "kafka" "rocketmq" "zookeeper" do path=$(cd "$(dirname "$0")"; pwd) case ${item} in @@ -20,10 +20,12 @@ case ${item} in "jdk") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/jdk8-install.sh | bash ;; "maven") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/maven-install.sh | bash ;; "nodejs") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/nodejs-install.sh | bash ;; + "mongodb") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/mongodb-install.sh | bash ;; "redis") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/redis-install.sh | bash ;; "tomcat") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/tomcat8-install.sh | bash ;; "kafka") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/kafka-install.sh | bash ;; "rocketmq") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/rocketmq-install.sh | bash ;; + "zookeeper") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/zookeeper-install.sh | bash ;; *) echo -e "输入项不支持!" main diff --git a/codes/linux/ops/soft/mongodb/install-mongodb.sh b/codes/linux/ops/soft/mongodb-install.sh similarity index 63% rename from codes/linux/ops/soft/mongodb/install-mongodb.sh rename to codes/linux/ops/soft/mongodb-install.sh index f0f60de..9f668bf 100644 --- a/codes/linux/ops/soft/mongodb/install-mongodb.sh +++ b/codes/linux/ops/soft/mongodb-install.sh @@ -1,20 +1,29 @@ #!/usr/bin/env bash +cat << EOF + ################################################################################### # 安装 mongodb 脚本 -# 适用于所有 linux 发行版本。 +# @system: 适用于所有 linux 发行版本。 # @author: Zhang Peng ################################################################################### -echo -e "\n>>>>>>>>> install mongodb" +EOF + +version=4.0.9 +if [[ -n $1 ]]; then + version=$1 +fi -# 下载并解压 mongodb root=/opt/mongodb -version=3.6.3 +if [[ -n $2 ]]; then + root=$2 +fi + +echo -e "\n>>>>>>>>> download mongodb" 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 zxf mongodb-linux-x86_64-${version}.tgz -mv mongodb-linux-x86_64-${version} mongodb-${version} +echo -e "\n>>>>>>>>> install mongodb" +tar zxf ${root}/mongodb-linux-x86_64-${version}.tgz -C ${root} mkdir -p /data/db diff --git a/codes/linux/ops/soft/mongodb/README.md b/codes/linux/ops/soft/mongodb/README.md deleted file mode 100644 index 2f4dac4..0000000 --- a/codes/linux/ops/soft/mongodb/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# 安装 mongodb - -使用方法: - -```sh -curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/mongodb/install-mongodb.sh | bash -``` - -脚本会下载解压 redis 到 `/opt/mongodb` 路径下。 diff --git a/codes/linux/ops/soft/zookeeper/install-zookeeper.sh b/codes/linux/ops/soft/zookeeper-install.sh similarity index 66% rename from codes/linux/ops/soft/zookeeper/install-zookeeper.sh rename to codes/linux/ops/soft/zookeeper-install.sh index 29b1e5b..7ca6676 100644 --- a/codes/linux/ops/soft/zookeeper/install-zookeeper.sh +++ b/codes/linux/ops/soft/zookeeper-install.sh @@ -1,17 +1,28 @@ #!/usr/bin/env bash +cat << EOF + ################################################################################### # 安装 zookeeper 脚本 -# 适用于所有 linux 发行版本。 +# @system: 适用于所有 linux 发行版本。 # @author: Zhang Peng ################################################################################### -echo -e "\n>>>>>>>>> install zookeeper" +EOF + +version=3.4.12 +if [[ -n $1 ]]; then + version=$1 +fi root=/opt/zookeeper -version=3.4.12 +if [[ -n $2 ]]; then + root=$2 +fi + +echo -e "\n>>>>>>>>> download zookeeper" mkdir -p ${root} wget -O ${root}/zookeeper-${version}.tar.gz http://mirrors.hust.edu.cn/apache/zookeeper/zookeeper-${version}/zookeeper-${version}.tar.gz -cd ${root} -tar -zxf zookeeper-${version}.tar.gz -cd zookeeper-${version} + +echo -e "\n>>>>>>>>> install zookeeper" +tar zxf ${root}/zookeeper-${version}.tar.gz -C ${root} diff --git a/codes/linux/ops/soft/zookeeper/README.md b/codes/linux/ops/soft/zookeeper/README.md deleted file mode 100644 index c7bf616..0000000 --- a/codes/linux/ops/soft/zookeeper/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# 安装 ZooKeeper - -使用方法: - -```sh -curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/zookeeper/install-zookeeper.sh | bash -``` - -脚本会下载解压 zookeeper 到 `/opt/zookeeper` 路径下。