更新脚本

This commit is contained in:
Zhang Peng 2019-05-07 11:39:42 +08:00
parent f882607677
commit 00c93dbb2d
3 changed files with 33 additions and 27 deletions

View File

@ -11,10 +11,27 @@ JDK8 会被安装到 `/usr/lib/jvm/java` 路径。
执行以下任意命令即可执行安装脚本。 执行以下任意命令即可执行安装脚本。
```sh ```sh
curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/jdk8-install.sh | bash curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/jdk8-install.sh | bash
wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/jdk8-install.sh | bash wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/jdk8-install.sh | bash
``` ```
## Maven 安装
说明:
- 脚本会下载解压 maven3 到 `/opt/maven` 路径下。
- 备份并替换 `settings.xml`,使用 aliyun 镜像加速 maven。
使用方法:
执行以下任意命令即可执行安装脚本。
```sh
curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/maven-install.sh | bash
wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/maven-install.sh | bash
```
## Redis 安装 ## Redis 安装
说明: 说明:
@ -26,8 +43,8 @@ wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux
执行以下任意命令即可执行安装脚本。 执行以下任意命令即可执行安装脚本。
```sh ```sh
curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/redis-install.sh | bash curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/redis-install.sh | bash
wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/redis-install.sh | bash wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/redis-install.sh | bash
``` ```

View File

@ -1,26 +1,24 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# 打印头部信息
printHeadInfo() {
cat << EOF cat << EOF
*********************************************************************************** ***********************************************************************************
* 欢迎使用 Linux CentOS 服务安装配置脚本 * 欢迎使用 Linux CentOS 软件安装配置脚本
* Author: Zhang Peng * Author: Zhang Peng
*********************************************************************************** ***********************************************************************************
EOF EOF
}
main() { path=$(cd "$(dirname "$0")"; pwd)
PS3="Please select script type: " PS3="Please select script type: "
select item in "git" "jdk" "maven" select item in "git" "jdk" "maven"
do do
path=$(cd "$(dirname "$0")"; pwd) path=$(cd "$(dirname "$0")"; pwd)
case ${item} in case ${item} in
"git") yum install -y git ;; "git") yum install -y git ;;
"jdk") ${path}/jdk/install-jdk8.sh ;; "jdk") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/jdk8-install.sh | bash ;;
"maven") ${path}/maven/install-maven3.sh ;; "maven") wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/maven-install.sh | bash ;;
"redis") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/redis-install.sh | bash ;;
*) *)
echo -e "输入项不支持!" echo -e "输入项不支持!"
main main
@ -28,12 +26,4 @@ case ${item} in
esac esac
break break
done done
}
filepath=$(cd "$(dirname "$0")"; pwd)
######################################## MAIN ########################################
path=$(cd "$(dirname "$0")"; pwd)
printHeadInfo
main

View File

@ -22,21 +22,20 @@ fi
echo -e "\n>>>>>>>>> download maven" echo -e "\n>>>>>>>>> download maven"
mkdir -p ${root} mkdir -p ${root}
cd ${root} wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" -O ${root}/apache-maven-${version}-bin.tar.gz http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/${version}/binaries/apache-maven-${version}-bin.tar.gz
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" -O ${root}/apache-maven-${version}-bin.tar.gz http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/${version}/binaries/apache-maven-${version}-bin.tar.gz
echo -e "\n>>>>>>>>> install maven" echo -e "\n>>>>>>>>> install maven"
tar -zxvf apache-maven-${version}-bin.tar.gz -C ${root} tar -zxvf ${root}/apache-maven-${version}-bin.tar.gz -C ${root}
path=${root}/apache-maven-${version}
# 设置环境变量 # 设置环境变量
cat >> /etc/profile << EOF cat >> /etc/profile << EOF
export MAVEN_HOME=/opt/maven/apache-maven-3.5.4 export MAVEN_HOME=${path}
export PATH=\$MAVEN_HOME/bin:\$PATH export PATH=\$MAVEN_HOME/bin:\$PATH
EOF EOF
source /etc/profile source /etc/profile
# 备份并替换 settings.xml使用 aliyun 镜像加速 maven # 备份并替换 settings.xml使用 aliyun 镜像加速 maven
echo -e "\n>>>>>>>>> replace /opt/maven/apache-maven-${version}/conf/settings.xml" echo -e "\n>>>>>>>>> replace ${path}/conf/settings.xml"
cp /opt/maven/apache-maven-${version}/conf/settings.xml /opt/maven/apache-maven-${version}/conf/settings.xml.bak 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 /opt/maven/apache-maven-${version}/conf/settings.xml wget -N https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/config/settings-aliyun.xml -O ${path}/conf/settings.xml