Skip to content

Commit 00c93db

Browse files
committed
更新脚本
1 parent f882607 commit 00c93db

3 files changed

Lines changed: 33 additions & 27 deletions

File tree

codes/linux/ops/soft/README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,27 @@ JDK8 会被安装到 `/usr/lib/jvm/java` 路径。
1111
执行以下任意命令即可执行安装脚本。
1212

1313
```sh
14-
curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/jdk8-install.sh | bash
15-
wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/jdk8-install.sh | bash
14+
curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/jdk8-install.sh | bash
15+
wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/jdk8-install.sh | bash
1616
```
1717

18+
## Maven 安装
19+
20+
说明:
21+
22+
- 脚本会下载解压 maven3 到 `/opt/maven` 路径下。
23+
- 备份并替换 `settings.xml`,使用 aliyun 镜像加速 maven。
24+
25+
使用方法:
26+
27+
执行以下任意命令即可执行安装脚本。
28+
29+
```sh
30+
curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/maven-install.sh | bash
31+
wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/maven-install.sh | bash
32+
```
33+
34+
1835
## Redis 安装
1936

2037
说明:
@@ -26,8 +43,8 @@ wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux
2643
执行以下任意命令即可执行安装脚本。
2744

2845
```sh
29-
curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/redis-install.sh | bash
30-
wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/redis-install.sh | bash
46+
curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/redis-install.sh | bash
47+
wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/redis-install.sh | bash
3148
```
3249

3350

codes/linux/ops/soft/main.sh

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,29 @@
11
#!/usr/bin/env bash
22

3-
# 打印头部信息
4-
printHeadInfo() {
53
cat << EOF
64
75
***********************************************************************************
8-
* 欢迎使用 Linux CentOS 服务安装配置脚本
6+
* 欢迎使用 Linux CentOS 软件安装配置脚本
97
* Author: Zhang Peng
108
***********************************************************************************
119
1210
EOF
13-
}
1411

15-
main() {
12+
path=$(cd "$(dirname "$0")"; pwd)
1613
PS3="Please select script type: "
1714
select item in "git" "jdk" "maven"
1815
do
1916
path=$(cd "$(dirname "$0")"; pwd)
2017
case ${item} in
2118
"git") yum install -y git ;;
22-
"jdk") ${path}/jdk/install-jdk8.sh ;;
23-
"maven") ${path}/maven/install-maven3.sh ;;
19+
"jdk") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/jdk8-install.sh | bash ;;
20+
"maven") wget -qO- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/maven-install.sh | bash ;;
21+
"redis") curl -o- https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/service/redis-install.sh | bash ;;
2422
*)
2523
echo -e "输入项不支持!"
2624
main
2725
;;
2826
esac
2927
break
3028
done
31-
}
32-
33-
filepath=$(cd "$(dirname "$0")"; pwd)
34-
35-
######################################## MAIN ########################################
36-
path=$(cd "$(dirname "$0")"; pwd)
3729

38-
printHeadInfo
39-
main

codes/linux/ops/soft/maven-install.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,20 @@ fi
2222

2323
echo -e "\n>>>>>>>>> download maven"
2424
mkdir -p ${root}
25-
cd ${root}
26-
27-
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
25+
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
2826

2927
echo -e "\n>>>>>>>>> install maven"
30-
tar -zxvf apache-maven-${version}-bin.tar.gz -C ${root}
28+
tar -zxvf ${root}/apache-maven-${version}-bin.tar.gz -C ${root}
3129

30+
path=${root}/apache-maven-${version}
3231
# 设置环境变量
3332
cat >> /etc/profile << EOF
34-
export MAVEN_HOME=/opt/maven/apache-maven-3.5.4
33+
export MAVEN_HOME=${path}
3534
export PATH=\$MAVEN_HOME/bin:\$PATH
3635
EOF
3736
source /etc/profile
3837

3938
# 备份并替换 settings.xml,使用 aliyun 镜像加速 maven
40-
echo -e "\n>>>>>>>>> replace /opt/maven/apache-maven-${version}/conf/settings.xml"
41-
cp /opt/maven/apache-maven-${version}/conf/settings.xml /opt/maven/apache-maven-${version}/conf/settings.xml.bak
42-
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
39+
echo -e "\n>>>>>>>>> replace ${path}/conf/settings.xml"
40+
cp ${path}/conf/settings.xml ${path}/conf/settings.xml.bak
41+
wget -N https://raw.githubusercontent.com/dunwu/os-tutorial/master/codes/linux/ops/soft/config/settings-aliyun.xml -O ${path}/conf/settings.xml

0 commit comments

Comments
 (0)