From ff2e5b8798fd0f95a3f61051d709de4f0f4ee451 Mon Sep 17 00:00:00 2001 From: Zhang Peng Date: Tue, 7 May 2019 12:07:59 +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 | 18 ++++++++++++++++-- codes/linux/ops/soft/jdk8-install.sh | 3 +++ codes/linux/ops/soft/main.sh | 1 + codes/linux/ops/soft/maven-install.sh | 2 ++ .../install-nodejs.sh => nodejs-install.sh} | 14 ++++++++++---- codes/linux/ops/soft/nodejs/README.md | 7 ------- codes/linux/ops/soft/redis-install.sh | 2 ++ 7 files changed, 34 insertions(+), 13 deletions(-) rename codes/linux/ops/soft/{nodejs/install-nodejs.sh => nodejs-install.sh} (80%) delete mode 100644 codes/linux/ops/soft/nodejs/README.md diff --git a/codes/linux/ops/soft/README.md b/codes/linux/ops/soft/README.md index 3ec09e6..02e54e9 100644 --- a/codes/linux/ops/soft/README.md +++ b/codes/linux/ops/soft/README.md @@ -19,7 +19,7 @@ wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux 说明: -- 脚本会下载解压 maven3 到 `/opt/maven` 路径下。 +- 脚本会下载解压 maven `3.6.0` 到 `/opt/maven` 路径下。 - 备份并替换 `settings.xml`,使用 aliyun 镜像加速 maven。 使用方法: @@ -31,12 +31,26 @@ 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/maven-install.sh | bash ``` +## Node.js 安装 + +说明: + +脚本会先安装 nvm(nodejs 版本管理器),并通过 nvm 安装 nodejs `10.15.2`。 + +使用方法: + +执行以下任意命令即可执行安装脚本。 + +```sh +curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/nodejs-install.sh | bash +wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/nodejs-install.sh | bash +``` ## Redis 安装 说明: -下载 `5.0.4` 版本的 redis 并解压安装到 `/opt/redis` 路径下。 +下载 redis `5.0.4` 并解压安装到 `/opt/redis` 路径下。 使用方法: diff --git a/codes/linux/ops/soft/jdk8-install.sh b/codes/linux/ops/soft/jdk8-install.sh index d59ed64..1f1e339 100644 --- a/codes/linux/ops/soft/jdk8-install.sh +++ b/codes/linux/ops/soft/jdk8-install.sh @@ -1,15 +1,18 @@ #!/usr/bin/env bash cat << EOF + ################################################################################### # 安装 JDK8 脚本 # 仅适用于所有 CentOS 发行版本 # JDK 会被安装到 /usr/lib/jvm/java 路径。 # Author: Zhang Peng ################################################################################### + EOF echo -e "\n>>>>>>>>> install jdk8" yum -y install java-1.8.0-openjdk.x86_64 yum -y install java-1.8.0-openjdk-devel.x86_64 +java -version diff --git a/codes/linux/ops/soft/main.sh b/codes/linux/ops/soft/main.sh index 9d3a186..6fbc48f 100644 --- a/codes/linux/ops/soft/main.sh +++ b/codes/linux/ops/soft/main.sh @@ -18,6 +18,7 @@ case ${item} in "git") yum install -y git ;; "jdk") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/jdk8-install.sh | bash ;; "maven") wget -qO- 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 ;; "redis") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/redis-install.sh | bash ;; *) echo -e "输入项不支持!" diff --git a/codes/linux/ops/soft/maven-install.sh b/codes/linux/ops/soft/maven-install.sh index 66d16e9..4ecd8d3 100644 --- a/codes/linux/ops/soft/maven-install.sh +++ b/codes/linux/ops/soft/maven-install.sh @@ -39,3 +39,5 @@ source /etc/profile echo -e "\n>>>>>>>>> replace ${path}/conf/settings.xml" cp ${path}/conf/settings.xml ${path}/conf/settings.xml.bak wget -N https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/config/settings-aliyun.xml -O ${path}/conf/settings.xml + +mvn -v diff --git a/codes/linux/ops/soft/nodejs/install-nodejs.sh b/codes/linux/ops/soft/nodejs-install.sh similarity index 80% rename from codes/linux/ops/soft/nodejs/install-nodejs.sh rename to codes/linux/ops/soft/nodejs-install.sh index 7408e54..23b6755 100644 --- a/codes/linux/ops/soft/nodejs/install-nodejs.sh +++ b/codes/linux/ops/soft/nodejs-install.sh @@ -1,26 +1,32 @@ #!/usr/bin/env bash +cat << EOF + ################################################################################### # 安装 Nodejs 脚本 # 适用于所有 linux 发行版本。 # Author: Zhang Peng ################################################################################### -echo -e "\n>>>>>>>>> install node.js" +EOF + +version=10.15.2 +if [[ -n $1 ]]; then + version=$1 +fi . ~/.nvm/nvm.sh nvm --version execode=$? if [[ ${execode} != 0 ]]; then - echo -e "\n未找到 nvm ,开始安装" echo -e "\n>>>>>>>>> install nvm" rm -rf ~/.nvm - curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash + curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash . ~/.nvm/nvm.sh nvm --version fi -version=8.9.4 +echo -e "\n>>>>>>>>> install nodejs by nvm" nvm install ${version} nvm use ${version} node --version diff --git a/codes/linux/ops/soft/nodejs/README.md b/codes/linux/ops/soft/nodejs/README.md deleted file mode 100644 index e668dcb..0000000 --- a/codes/linux/ops/soft/nodejs/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# 安装 Nodejs - -使用方法: - -```sh -curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/nodejs/install-nodejs.sh | bash -``` diff --git a/codes/linux/ops/soft/redis-install.sh b/codes/linux/ops/soft/redis-install.sh index 4b29212..093b984 100644 --- a/codes/linux/ops/soft/redis-install.sh +++ b/codes/linux/ops/soft/redis-install.sh @@ -1,10 +1,12 @@ #!/usr/bin/env bash cat << EOF + ################################################################################### # 安装 Redis 脚本 # Author: Zhang Peng ################################################################################### + EOF version=5.0.4