From 5ef7e1b11eed848cbdb2dad2988c2ebda2cf81e1 Mon Sep 17 00:00:00 2001 From: Zhang Peng Date: Tue, 7 May 2019 15:04:19 +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/kafka-install.sh | 28 ++++++++++++++++++ codes/linux/ops/soft/kafka/README.md | 12 -------- codes/linux/ops/soft/kafka/install-kafka.sh | 17 ----------- codes/linux/ops/soft/main.sh | 4 ++- .../linux/ops/soft/mongodb/install-mongodb.sh | 2 +- codes/linux/ops/soft/nginx/install-nginx.sh | 2 +- codes/linux/ops/soft/nginx/install-pcre.sh | 2 +- codes/linux/ops/soft/redis-install.sh | 2 +- codes/linux/ops/soft/rocketmq-install.sh | 28 ++++++++++++++++++ codes/linux/ops/soft/rocketmq/README.md | 9 ------ .../ops/soft/rocketmq/install-rocketmq.sh | 17 ----------- codes/linux/ops/soft/tomcat8-install.sh | 2 +- 13 files changed, 92 insertions(+), 62 deletions(-) create mode 100644 codes/linux/ops/soft/kafka-install.sh delete mode 100644 codes/linux/ops/soft/kafka/README.md delete mode 100644 codes/linux/ops/soft/kafka/install-kafka.sh create mode 100644 codes/linux/ops/soft/rocketmq-install.sh delete mode 100644 codes/linux/ops/soft/rocketmq/README.md delete mode 100644 codes/linux/ops/soft/rocketmq/install-rocketmq.sh diff --git a/codes/linux/ops/soft/README.md b/codes/linux/ops/soft/README.md index c402fd5..e1402da 100644 --- a/codes/linux/ops/soft/README.md +++ b/codes/linux/ops/soft/README.md @@ -6,7 +6,7 @@ 安装 [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh) -使用方法: +使用方法 执行以下任意命令即可执行安装脚本。 @@ -89,3 +89,30 @@ 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/tomcat8-install.sh | bash ``` +## Kafka 安装 + +说明: + +下载 kafka `2.2.0` 并解压安装到 `/opt/kafka` 路径下。 + +使用方法:执行以下任意命令即可执行脚本。 + +```sh +curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/kafka-install.sh | bash +wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/kafka-install.sh | bash +``` + +## RocketMQ 安装 + +说明: + +下载 rocketmq `4.5.0` 并解压安装到 `/opt/rocketmq` 路径下。 + +使用方法:执行以下任意命令即可执行脚本。 + +```sh +curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/rocketmq-install.sh | bash +wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/rocketmq-install.sh | bash +``` + +脚本会下载解压 kafka 到 `/opt/kafka` 路径下。 diff --git a/codes/linux/ops/soft/kafka-install.sh b/codes/linux/ops/soft/kafka-install.sh new file mode 100644 index 0000000..7db97bb --- /dev/null +++ b/codes/linux/ops/soft/kafka-install.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +cat << EOF + +################################################################################### +# 安装 Kafka 脚本 +# @system: 适用于所有 linux 发行版本。 +# @author: Zhang Peng +################################################################################### + +EOF + +version=2.2.0 +if [[ -n $1 ]]; then + version=$1 +fi + +root=/opt/kafka +if [[ -n $2 ]]; then + root=$2 +fi + +echo -e "\n>>>>>>>>> download kafka" +mkdir -p ${root} +wget -O ${root}/kafka_2.12-${version}.tgz http://mirrors.tuna.tsinghua.edu.cn/apache/kafka/${version}/kafka_2.12-${version}.tgz + +echo -e "\n>>>>>>>>> install kafka" +tar zxf ${root}/kafka_2.12-${version}.tgz -C ${root} diff --git a/codes/linux/ops/soft/kafka/README.md b/codes/linux/ops/soft/kafka/README.md deleted file mode 100644 index 5d1b98d..0000000 --- a/codes/linux/ops/soft/kafka/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# 脚本使用说明 - -## 安装 Kafka - -使用方法:执行以下任意命令即可执行脚本。 - -```sh -curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/kafka/install-kafka.sh | bash -wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/kafka/install-kafka.sh | bash -``` - -脚本会下载解压 kafka 到 `/opt/kafka` 路径下。 diff --git a/codes/linux/ops/soft/kafka/install-kafka.sh b/codes/linux/ops/soft/kafka/install-kafka.sh deleted file mode 100644 index c5e6c79..0000000 --- a/codes/linux/ops/soft/kafka/install-kafka.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -################################################################################### -# 安装 kafka 脚本 -# 适用于所有 linux 发行版本。 -# @author: Zhang Peng -################################################################################### - -# 下载并解压 kafka -echo -e "\n>>>>>>>>> install kafka" - -root=/opt/kafka -version=2.11-1.1.0 -mkdir -p ${root} -wget -O ${root}/kafka_${version}.tgz http://mirrors.shu.edu.cn/apache/kafka/1.1.0/kafka_${version}.tgz -cd ${root} -tar -xzf kafka_${version}.tgz diff --git a/codes/linux/ops/soft/main.sh b/codes/linux/ops/soft/main.sh index 67111d1..b8eb8f4 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" +select item in "git" "zsh" "jdk" "maven" "nodejs" "redis" "tomcat" "kafka" "rocketmq" do path=$(cd "$(dirname "$0")"; pwd) case ${item} in @@ -22,6 +22,8 @@ case ${item} in "nodejs") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/nodejs-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 ;; *) echo -e "输入项不支持!" main diff --git a/codes/linux/ops/soft/mongodb/install-mongodb.sh b/codes/linux/ops/soft/mongodb/install-mongodb.sh index c8a8668..f0f60de 100644 --- a/codes/linux/ops/soft/mongodb/install-mongodb.sh +++ b/codes/linux/ops/soft/mongodb/install-mongodb.sh @@ -14,7 +14,7 @@ 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 +tar zxf mongodb-linux-x86_64-${version}.tgz mv mongodb-linux-x86_64-${version} mongodb-${version} mkdir -p /data/db diff --git a/codes/linux/ops/soft/nginx/install-nginx.sh b/codes/linux/ops/soft/nginx/install-nginx.sh index fec7365..c57f5e0 100644 --- a/codes/linux/ops/soft/nginx/install-nginx.sh +++ b/codes/linux/ops/soft/nginx/install-nginx.sh @@ -22,7 +22,7 @@ nginxVersion=1.12.2 mkdir -p ${ngixnRoot} wget -O ${ngixnRoot}/nginx-${nginxVersion}.tar.gz http://nginx.org/download/nginx-${nginxVersion}.tar.gz cd ${ngixnRoot} -tar zxvf nginx-${nginxVersion}.tar.gz +tar zxf nginx-${nginxVersion}.tar.gz # 编译 cd nginx-${nginxVersion} diff --git a/codes/linux/ops/soft/nginx/install-pcre.sh b/codes/linux/ops/soft/nginx/install-pcre.sh index b78b7ce..03debcb 100644 --- a/codes/linux/ops/soft/nginx/install-pcre.sh +++ b/codes/linux/ops/soft/nginx/install-pcre.sh @@ -16,7 +16,7 @@ version=$2 mkdir -p ${root} wget -O ${root}/pcre-${version}.tar.gz http://downloads.sourceforge.net/project/pcre/pcre/${version}/pcre-${version}.tar.gz cd ${root} -tar zxvf pcre-${version}.tar.gz +tar zxf pcre-${version}.tar.gz cd pcre-${version} # 编译 diff --git a/codes/linux/ops/soft/redis-install.sh b/codes/linux/ops/soft/redis-install.sh index 0fb8943..2cbe8f9 100644 --- a/codes/linux/ops/soft/redis-install.sh +++ b/codes/linux/ops/soft/redis-install.sh @@ -28,7 +28,7 @@ mkdir -p ${root} wget -O ${root}/redis-${version}.tar.gz http://download.redis.io/releases/redis-${version}.tar.gz echo -e "\n>>>>>>>>> install redis" -tar zxvf ${root}/redis-${version}.tar.gz -C ${root} +tar zxf ${root}/redis-${version}.tar.gz -C ${root} cd ${root}/redis-${version} make & make install cd - diff --git a/codes/linux/ops/soft/rocketmq-install.sh b/codes/linux/ops/soft/rocketmq-install.sh new file mode 100644 index 0000000..d3c3652 --- /dev/null +++ b/codes/linux/ops/soft/rocketmq-install.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +cat << EOF + +################################################################################### +# 安装 rocketmq 脚本 +# @system: 适用于所有 linux 发行版本。 +# @author: Zhang Peng +################################################################################### + +EOF + +version=4.5.0 +if [[ -n $1 ]]; then + version=$1 +fi + +root=/opt/rocketmq +if [[ -n $2 ]]; then + root=$2 +fi + +echo -e "\n>>>>>>>>> download rocketmq" +mkdir -p ${root} +wget -O ${root}/rocketmq-all-${version}-bin-release.zip http://mirrors.tuna.tsinghua.edu.cn/apache/rocketmq/${version}/rocketmq-all-${version}-bin-release.zip + +echo -e "\n>>>>>>>>> install rocketmq" +unzip -o ${root}/rocketmq-all-${version}-bin-release.zip -d ${root}/rocketmq-all-${version}/ diff --git a/codes/linux/ops/soft/rocketmq/README.md b/codes/linux/ops/soft/rocketmq/README.md deleted file mode 100644 index 479a24a..0000000 --- a/codes/linux/ops/soft/rocketmq/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# 安装 RocketMQ - -使用方法: - -```sh -curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/rocketmq/install-rocketmq.sh | bash -``` - -脚本会下载解压 RocketMQ 到 `/opt/rocketmq` 路径下。 diff --git a/codes/linux/ops/soft/rocketmq/install-rocketmq.sh b/codes/linux/ops/soft/rocketmq/install-rocketmq.sh deleted file mode 100644 index 7b55595..0000000 --- a/codes/linux/ops/soft/rocketmq/install-rocketmq.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -################################################################################### -# 安装 rocketmq 脚本 -# 适用于所有 linux 发行版本。 -# @author: Zhang Peng -################################################################################### - -# 下载并解压 rocketmq -echo -e "\n>>>>>>>>> install rocketmq" - -root=/opt/rocketmq -version=4.2.0 -mkdir -p ${root} -wget -O ${root}/rocketmq-all-${version}-bin-release.zip http://mirrors.hust.edu.cn/apache/rocketmq/${version}/rocketmq-all-${version}-bin-release.zip -cd ${root} -unzip -o rocketmq-all-${version}-bin-release.zip -d rocketmq-all-${version}/ diff --git a/codes/linux/ops/soft/tomcat8-install.sh b/codes/linux/ops/soft/tomcat8-install.sh index 3cc0146..524ea66 100644 --- a/codes/linux/ops/soft/tomcat8-install.sh +++ b/codes/linux/ops/soft/tomcat8-install.sh @@ -25,4 +25,4 @@ mkdir -p ${root} wget -O ${root}/apache-tomcat-${version}.tar.gz https://archive.apache.org/dist/tomcat/tomcat-8/v${version}/bin/apache-tomcat-${version}.tar.gz echo -e "\n>>>>>>>>> install tomcat" -tar zxvf ${root}/apache-tomcat-${version}.tar.gz -C ${root} +tar zxf ${root}/apache-tomcat-${version}.tar.gz -C ${root}