diff --git a/codes/linux/ops/soft/README.md b/codes/linux/ops/soft/README.md index 2902069..3ec09e6 100644 --- a/codes/linux/ops/soft/README.md +++ b/codes/linux/ops/soft/README.md @@ -11,10 +11,27 @@ JDK8 会被安装到 `/usr/lib/jvm/java` 路径。 执行以下任意命令即可执行安装脚本。 ```sh -curl -o- 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/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/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 安装 说明: @@ -26,8 +43,8 @@ wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux 执行以下任意命令即可执行安装脚本。 ```sh -curl -o- 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/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/service/redis-install.sh | bash ``` diff --git a/codes/linux/ops/soft/main.sh b/codes/linux/ops/soft/main.sh index 63f928d..9d3a186 100644 --- a/codes/linux/ops/soft/main.sh +++ b/codes/linux/ops/soft/main.sh @@ -1,26 +1,24 @@ #!/usr/bin/env bash -# 打印头部信息 -printHeadInfo() { cat << EOF *********************************************************************************** -* 欢迎使用 Linux CentOS 服务安装配置脚本 +* 欢迎使用 Linux CentOS 软件安装配置脚本 * Author: Zhang Peng *********************************************************************************** EOF -} -main() { +path=$(cd "$(dirname "$0")"; pwd) PS3="Please select script type: " select item in "git" "jdk" "maven" do path=$(cd "$(dirname "$0")"; pwd) case ${item} in "git") yum install -y git ;; - "jdk") ${path}/jdk/install-jdk8.sh ;; - "maven") ${path}/maven/install-maven3.sh ;; + "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 ;; + "redis") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/redis-install.sh | bash ;; *) echo -e "输入项不支持!" main @@ -28,12 +26,4 @@ case ${item} in esac break done -} -filepath=$(cd "$(dirname "$0")"; pwd) - -######################################## MAIN ######################################## -path=$(cd "$(dirname "$0")"; pwd) - -printHeadInfo -main diff --git a/codes/linux/ops/soft/maven-install.sh b/codes/linux/ops/soft/maven-install.sh index 970a2fa..66d16e9 100644 --- a/codes/linux/ops/soft/maven-install.sh +++ b/codes/linux/ops/soft/maven-install.sh @@ -22,21 +22,20 @@ fi echo -e "\n>>>>>>>>> download maven" 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" -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 -export MAVEN_HOME=/opt/maven/apache-maven-3.5.4 +export MAVEN_HOME=${path} export PATH=\$MAVEN_HOME/bin:\$PATH EOF source /etc/profile # 备份并替换 settings.xml,使用 aliyun 镜像加速 maven -echo -e "\n>>>>>>>>> replace /opt/maven/apache-maven-${version}/conf/settings.xml" -cp /opt/maven/apache-maven-${version}/conf/settings.xml /opt/maven/apache-maven-${version}/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 +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